From 57d696e8092c171da495ea68237ef77cccac00b0 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 24 Dec 2020 17:12:43 -0800 Subject: [PATCH] run tests from cmdline (#2132) * run tests * include junit in jar * tabs spaces --- .../com/rusefi/RealHardwareTestLauncher.java | 24 +++++++++++++++++++ java_console/build.xml | 4 +--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/java_console/autotest/src/com/rusefi/RealHardwareTestLauncher.java b/java_console/autotest/src/com/rusefi/RealHardwareTestLauncher.java index 87b59e226e..542bf79ddf 100644 --- a/java_console/autotest/src/com/rusefi/RealHardwareTestLauncher.java +++ b/java_console/autotest/src/com/rusefi/RealHardwareTestLauncher.java @@ -1,5 +1,8 @@ package com.rusefi; +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; + /** * dead? * @@ -16,6 +19,27 @@ package com.rusefi; public class RealHardwareTestLauncher { public static void main(String[] args) throws InterruptedException { + JUnitCore junit = new JUnitCore(); + Result result = junit.run( + FunctionalTest.class, + PwmHardwareTest.class, + VssHardwareLoopTest.class, + HighRevTest.class + ); + + // Print a summary of tests run + System.out.println("Ran " + result.getRunCount() + " tests total."); + System.out.println("Ignored " + result.getIgnoreCount() + " tests."); + System.out.println("Failed " + result.getFailureCount() + " tests."); + + result.getFailures().forEach(f -> { + System.out.println(f.toString()); + + System.out.println("Test failed: " + f.getTestHeader() + " because " + f.getMessage()); + System.out.println("Exception:"); + + f.getException().printStackTrace(); + }); } /** diff --git a/java_console/build.xml b/java_console/build.xml index 908611b8cc..353e4aa426 100644 --- a/java_console/build.xml +++ b/java_console/build.xml @@ -173,6 +173,7 @@ + @@ -187,9 +188,6 @@ - - -