Skip to main content
Solved

What makes a Unit test count as successful?


I have been experimenting what functionality might work for us to create a unit test for, but already in a simple test example I a struggling to get it to succeed.

I have a simple task to create a new user by using a task. The parameters are filled and because I am not using output parameters, I have used Assertion to give it Failed / Success (as suggested by the starter template).

This is the result:
 

Simple test task gives failed all the time despite succesful response Assertion.

The test still gives me the Failed marking, while the Assertion did return Successful. Manual running the test script, does indeed give me the Success message from “tsf_send_assertion_msg” (ASSERT_SUCCESS: Successful).

What am I doing wrong or am I missing to get the Test show Success for this example?

Best answer by J. de Lange

In your screenshot I see that your test expects the result to be rolled back but when executing the test, it's successful without a rollback and therefore doesn't match your expected result. Uncheck “should rollback” and it should succeed.
 

 

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

J. de Lange
Hero
Forum|alt.badge.img+4
  • Hero
  • 66 replies
  • Answer
  • June 19, 2024

In your screenshot I see that your test expects the result to be rolled back but when executing the test, it's successful without a rollback and therefore doesn't match your expected result. Uncheck “should rollback” and it should succeed.
 

 


@J. de Lange Thanks for the tip. I misunderstood this checkbox. Reading the documentation it states:

If the code should do a rollback if an error occurs, select the Should rollback checkbox.

I did interpret this as the code of the unit test, not my feature that is being tested.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings