Skip to content

Discussion: Use of data providers in test classes #755

Open
@mk-mxp

Description

@mk-mxp

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions