Using data providers is a convenient way to reduce code and increase coherence inside the test classes. Having the test case data separated from the test code itself follows best practices and is encouraged in professional use.
But in Exercism it raises a bunch of problems:
- In the test runner, data provider based tests must be handled separately
- PHPUnit converts values to a different format (not like PHP code) to emit them in test names
- For beginners, even when working with the CLI, the test data is not intuitively connected to the test code
- It is much more inconvenient to connect UUIDs of practice exercises to test values in a data provider
- In the test generator, data providers might add more complexity and so may not be used
So I would prefer to convert existing data provider based tests to flat test methods and not add new exercises with data providers.
Any opinions about that?
Using data providers is a convenient way to reduce code and increase coherence inside the test classes. Having the test case data separated from the test code itself follows best practices and is encouraged in professional use.
But in Exercism it raises a bunch of problems:
So I would prefer to convert existing data provider based tests to flat test methods and not add new exercises with data providers.
Any opinions about that?