jeudi 27 juin 2019

How to demonstrate or qualitatively test a Java class before packaging?

My current project contains an interface and an implementation of a RandomTextGenerator type (such as might be used in an adventure game to generate original character or place names). I am using Maven to compile and package the project and JUnit 5 for unit testing. I'd like to structure this project properly in order to open-source it (if only just to learn the proper setup).

My JUnit tests do a lot, but they can't qualitatively test the big question: do the randomly-generated names come out sounding good?

How should I test this? Options I'm considering:

  • Add a new class with a static void main() that generates and prints a bunch of these names to System.out.
  • Add a JUnit test that does the above and then ends with assertTrue(true).
  • Build a new project outside of this package, which imports the package and does the above.

I'd like to know what's the generally-accepted best practice, given my intent to open-source this project. Would consumers of my package want to see these tests, or not, and where?

Aucun commentaire:

Enregistrer un commentaire