Forum Discussion

skyhigh's avatar
skyhigh
Contributor
7 years ago
Solved

Is it possible to call assert with my own test result (Pass or Fail)?

Hi,   I would like to know if it's possible if I validate the test results with my own logics then call the assertion script to either pass/true or fail/false based on my own reasoning?  thanks
  • axeltoushirou's avatar
    7 years ago

    Are you trying to validate each testcase with 'Script Assertion (groovy script)'?

    If so, then you can pass or fail that script by using 'assert' then pass a true or false (boolean) condition on it, true (passed), false (failed)

     

    e.g.
    def getTotalNumbers = totalNumbersFromResponse;
    def expectedTotal = 10;
    
    assert getTotalNumbers == expectedTotal; // if both matches, your testcase will pass, else fail