I inherited two dozen or so java tests and when the suite is ran, everything is printed whether passing or failing. I would like to only print failures/failure logs and get a total count of tests that passed. Most of the tests use a data source CSV file and iterate over the rows to verify different data values. IntelliJ prints the total number of tests ran, failures and skips. How can I print the same information so that I can see it when I run the suites via the command line?
When I log anything, it prints every time the test is ran. I only want a final count of the total number of tests that passed printed once.
Below is a sample of the code that runs.
public class metaTest
{
public Iterable getData() throws IOException {
String inPath = Path.toResource("test.csv");
}
@Test(groups = {"test"}, threadPoolSize = 20)
@IterateOverReturnValue(method = "getData")
public void processLine(CsvLine line) throws Exception {
String URL = line.get(0);
AssertMulti asrt = new AssertMulti();
page_title = page.getTitle();
asrt.assertNotEmpty(page_title, "Could NOT parse page title");
try {
HtmlPage page = HtmlPage.fromUrl(URL);
response_code = String.valueOf(page.getCode());
} catch (Exception e) {
asrt.fail(e.getMessage());
throw e;
} finally {
String error_log = asrt.getAsOneString();
String pass_fail = error_log.isEmpty() ? "PASS" : "FAIL";
}
}