Fixing Failed Tests

This topic describes an example failing test and the way to fix it.

The following picture demonstrates a test case, which is implemented as the tSQLt.AssertLike stored procedure. The test compares the return result (N’Test’) with an expected pattern N’Test%T’. The result of running the test is displayed in the Test Result window.

The test has failed, because the return result ‘Test’ does not match the expected pattern N’Test%T’.

The window also shows the error message “Fail”. The message output is an optional feature, which can be realized by defining the Message parameter of the AssertLike procedure.

Test Failed

To fix the failed test:

  1. Double-click the test or right-click the test and choose Open Test on the context menu. The source code for the AssertLike test will be displayed.
  2. Modify the source code by writing N’Test%’ instead of N’Test’, as shown in the following picture, and run the test again. As you can see, the test has succeeded, because now the return result matches the expected value.

Test Succeded