Writing Unit tests - A Use Case

This FAQ explains when and how to write unit tests.

Let us say that you have the following requirement. In http://sahi.co.in/demo/training/login.htm, let us say that you wish to validate that
info In this case, writing multiple scripts for various validations is not the right approach. You would rather write multiple Test Cases in unit tests style to do all the validations.
Unit test cases can be written in a Sahi script as functions starting with test, example: testUserNameMax50Characters.

Refer to userdata\scripts\demo\clickCombo.sah as an example of how to write unit tests in a Sahi script.

As regards your specific scenarios, you may have the following tests In general, you would write extensive unit tests that cover all scenarios and put it inside one script.

The tests can be run as follows. userdata\scripts\demo\clickCombo.sah is another example of how to write unit tests in a Sahi script, and how to call them.