Skip to content

Implement accuracy report tests using JUnit @TestFactory #4

@Marcono1234

Description

@Marcono1234

Consider implementing AbstractLanguageDetectionAccuracyReport using JUnit's @TestFactory.

Advantages:

  • Reduces a lot of code duplication which currently exists for all AbstractLanguageDetectionAccuracyReport implementations
    Instead could have a @TestFactory which creates a JUnit DynamicContainer for each language, containing DynamicContainer for the test variants (word, sentence, ...) and then DynamicTest for each input. In AbstractLanguageDetectionAccuracyReport it would then only be necessary to define the list of languages to test (or all?), and then automatically get their language code and the corresponding test data.

Disadvantages:

  • Might make merging upstream changes lightly more difficult (?)
  • Cannot easily run tests for individual languages anymore
    However, could consider adding system properties or similar which determine the detector and language, similar to the current existing logic in build.gradle.kts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions