Test Lint is an “as you type” parser that detects common readability, maintainability and trust anti-patterns in your unit tests. the addin for VS is free. there is also a command line version that you can use in your automated builds.
- we added 3 categories for rules – Trust, Readability, and Maintainability
We’ve added 10 new rules to Test Lint, that detect more “advanced” yet common problematic scenarios:
New Trust Related Issues:
- Avoid hand rolled mocks or stubs that contain custom logic (hard coded values or pure logic)
- We’ll try to detect when you put production logic in your unit test, and give you a hint about it
- We’ll help make sure you separate unit from integration tests, by detecting integration tests in a project that doesn’t have the word “integration” at its subject.
- Avoid Random Generation in tests: your test will keep changing on every run.
new Readability Rules:
- Avoid confusing mocks and stub variable names
- Don’t create fakes in setup methods
New Maintainability rules
- Prefer factory method to create objects under test
- Avoid over specification in test (calling verifyAll on mocks)
New Isolator Specific Rule
- Avoid calling “new” inside “whencalled” calls