cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

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

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

 

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

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

What are you trying to do? If you already applied your logic to validate the result, why do want to call assertion script?


Regards,
Rao.
Highlighted
Contributor

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

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

 

View solution in original post

Highlighted
Contributor

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

thanks.  I didn't know why I didn't do this "assert true"

Highlighted
Contributor

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

The reason I want to validate my own test result because I test one of the features that member requires license to perform the operation.  Since the license team hasn't fixed their defects and I cant fail that tested feature because the developer who owns that feature says it's not the functionality fault, it's the requirement does not meet so he wants me to pass the test case rather fail or block it.  Sometimes developers just have their own reasoning when deciding whether to pass or fail the test.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors