I'm using TestNG to run a test and I've been using the Assert.assert statements in Java.
Now there are a few places where I would like to validate whether a function returned true or not. If it didn't then I don't want to fail the test but would rather have it log a message and continue.
In effect, I'm trying something like this:
boolean return1 = funct1();
if(bool){
System.out.println("funct1 returned a false. An error occurred which needs to be investigated later but the test will continue for now")
}
I could of course do this via the code that I wrote but is there a more elegant method of doing this via TestNG?
How can I make some assertions without failing the test? SoftAssert seems to fail the test at the end when I call assertAll().
if (result > 5) {log.warning("Result to high %s", result );}
. I guess what you mean is good diagnostics messages like "Expected result to be great than 5, actual value was 4", then I agree -- JUnit/TestNG assertions have that reporting builting in.