I use two functions, for example test_valid_data()
and test_invalid_data()
, and two data sets, for example valid_data[]
and invalid_data[]
. Then I write four testing procedures:
- test_valid_data (valid_data []): this test must pass
- test_valid_data (invalid_data []): this test should fail
- test_invalid_data (valid_data []): this test should fail
- test_invalid_data (invalid_data []): this test must pass
By working this way, you can pinpoint a failed test according to a specific dataset. This behavior would be difficult to achieve with just one big test. It also confirms that valid data is not considered invalid and vice versa.
source share