Skip to main content
Solved

What makes a Unit test count as successful?

  • 18 June 2024
  • 2 replies
  • 38 views

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?

This topic has been closed for comments

2 replies

Userlevel 3
Badge +4

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.