Skip to content

Instantly share code, notes, and snippets.

@codingoutloud
Last active October 13, 2015 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingoutloud/4126612 to your computer and use it in GitHub Desktop.
Save codingoutloud/4126612 to your computer and use it in GitHub Desktop.
Decided to make a list of conventions I practice in development... They aren't necessarily *right*, but are what they are.

Naming Conventions:

Unit Testing:

  • Folder structure of tests should mimic folder structure of code under test: Foo and Foo/Identity should have Foo.Tests, and Foo.Tests/Identity
  • Naming of projects containing unit tests: Foo.Tests
  • Note - I find myself also using Foo.Tests.Unit and Foo.Tests.Integration to keep these separate
  • Note - I also find myself labeling Integration Tests - such as with this MS Test attribute: [TestCategory("Integration")] - so that I can identify Integration tests and selectively run just Unit tests should I choose
  • Naming convention for unit test methods - I like Roy's approach (http://osherove.com/blog/2005/4/3/naming-standards-for-unit-tests.html), except I prefer logical name in first part: so rather than (Roy's) [MethodName_StateUnderTest_ExpectedBehavior], I use [Function_StateUnderTest_ExpectedBehavior] - for example, SubdomainExtraction_InvalidSubdomain_ExceptionThrown, SubdomainExtraction_CompoundSubdomain_ExceptionThrown, SubdomainExtraction_ValidSubdomain_Parsed, LogicalArea_Condition_ExpectedOutcome...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment