jeudi 15 septembre 2016

Java: Test compiled program with input file

I have a Java program that has a command line interface using Commons CLI and processes an input file and writes an output file.

I use JUnit to test objects and their methods. However, I wonder if there is a possibility to test my whole compiled program with JUnit or any other way inside the tool rather than write an own test suite program as a seperate Java project.

What I would like to do:

  1. Load an input file test.txt from a defined directory inside the Java project
  2. Call the program: java -jar -enableassertions MyTool.jar -i \Path\To\Test\test.txt
  3. See if any errors or assertions are thrown
  4. Repeat this for multiple test input files

Aucun commentaire:

Enregistrer un commentaire