0

I have an aws instance running with webservices that I want to test with a java application running JUnit. If I have a script that runs the jar during the validate services step of the code deploy process how does the code deployment handle the return value of the jar if a test fails?

Is it required that I catch exceptions thrown by the jar for the failing tests and call system.exit(-1) to have the script terminate the code deployment or does the exception thrown automatically give the return value of non-zero?

SN0flux
  • 19
  • 1

1 Answers1

0

If you are running JUnit using JunitCore, it should return a non-zero exit code if any of the tests fail.

main

public static void main(String... args)

Run the tests contained in the classes named in the args. If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1. Write feedback while tests are running and write stack traces for all failed tests after the tests all complete.

Parameters:

   args - names of classes in which to find tests to run

From: http://junit.org/apidocs/org/junit/runner/JUnitCore.html#main%28java.lang.String...%29

Jonathan Turpie
  • 1,343
  • 10
  • 16