There is this piece of code that is not yet covered by tests, and our product owner requested that we increase code coverage. Can you do it?
Three modes:
What do they check?
- easy: knowledge about tests in general, ability to test different execution paths, ability to handle exceptions, very basic creativity, simple unit testing
- normal: ability to write test cases for more than one object at the same time, more complex scenarios
- hard: mocking, dependency injection, functional testing
This question can be split into two phases:
- writing actual tests (few)
- listing possible test scenarios (i.e. “what scenarios would you write if you had to cover this code with tests?”)