Unit Testing Flashcards
What does setup in nunit do?
It is used to provide a set of functions that are performed just before each test method is called
What are the three parts of a unit test
Arrange, Act, Assert
What are the characteristics of a good unit test
Fast: Takes little time to run.
Isolated: have no dependencies on any outside factors.
Repeatable: consistent with its results.
Self-Checking: automatically detect if it passed or failed.
Timely: should not take a long time to write.
What is the TDD cycle?
Fail, Pass, Refactor
What advantages of using TDD?
Better program design and code quality, reduces time required for project development, easier maintenance
If a Nunit class has a constructor, when does it run?
They only run once per test class. Test run with any order, usually alphabetically by default.
What does the [TestCaseSource] attribute do?
Uses a reference field, method or property that has test arguements that can be applied to multiple parameterized test methods.
What are the pitfalls of doing TDD?
You might have to rewrite code that doesn’t work anymore the further you go. You might end up with redundant tests over simple functionality