trans-am
2 years agoOccasional Contributor
Assert = false and log.info to the console
When firstName is null I would like to assert false and print log.info but in "else" part I cannot print log.info to console. Any thoughts?
Following piece of script.
======================================================
def firstName1 = (json.nameList[0].firstName) // take Name
if ( firstName1 != null ) { // firstName1 has a value. It's not null
{assert true}
log.info("firstName = " + firstName1) // print to console
}
else { log.info("firstName = " + firstName1)
{ assert false}
}
Hi,
Can I ask, why go to the effort of building the IF to assert true/false? Why not "assert not null"?