Unit Testing & Testability Flashcards
What is unit testing?
Ensuring the functionality of each component works in isolation
Unit testing is not about how well things ________ with each other
interact
Describe the automated testing pyramid
It’s a 3 level pyramid. The bottom row is unit testing, the middle row is API/integration/component testing, and the top row is System & UI testing
In the automated testing pyramid, lower levels are __________ and quick to test, while upper levels are __________ and slower to test
isolated, integrated
In practice, there is a debate between how _______ a unit test should be and ____ and _______ testing methodologies
isolated, big, small
Another view of unit tests is that they specify the expected ________ of individual components
behavior
What is test driven development?
Building unit tests first, then using them to guide development
In practice, ______ _________ development has fallen out of favour due to the nature of agile development methods, which includes ever changing requirements
test driven
What are 3 guiding principles on writing unit tests?
- Focus on one component in isolation
- Be simple to set up and run
- Be easy to understand
In GoogleTest, what is the difference between ASSERT and EXPECT oracles?
ASSERT oracles terminate the program when the fail, which EXPECT oracles allow the program to continue running
If you have many tests the require a common set up and tear down routine, consider grouping them in a ______. What do they do?
fixture. Fixtures enable using the same configuration for multiple tests
What are the 3 steps usually occurring in a unit test? This is also known as AAA, which stands for what?
- Set up a scenario
- Run the scenario
- Check the outcome
AAA stands for Arrange, Act, and Assert
Two test cases modifying the same DB violates _______ because why?
isolation. The order of the test can affect the results
__________ __________ allows the use of mocks and stubs as necessary
Dependency injections
When checking pre and post conditions, you check the ________ state as well as the final state
initial