The way in which you write your test cases might have a great impact on the performance and stability of your test set. During
recording,
Silk Test Workbench creates scripts that are as fast and stable as possible. However, there might be circumstances that require you to manually
create or edit test scripts. This topic provides some general guidelines that might help you create test scripts that are
maintainable, reusable, and lead to stable tests.
- Name your tests consistently and ensure that test names are self-explaining. Try to make the names correspond with the application
under test and the tested functionality. For example, the test names
MyApp_SuccessfulLogin and
MyApp_FailingLogin are far easier to understand for other users than
Untitled_42 and
Untitled_43.
- Describe your test cases as thoroughly as possible in a comment. Without a good description of the test case in natural language,
someone who needs to change the implementing code might not be able to comprehend what exactly the test is doing.
- Ensure that your application under test is at the proper state when the test case starts. Return the application under test
to the correct state before executing the actions in a test case.
- Ensure that your application under test is at a proper state when the test case finishes. If additional tests depend on the
outcome of the test, ensure that they can start. Return the application under test to the correct state when the actions in
a test case are executed.
- Whenever possible, ensure that your test cases are not depending on the results of other test cases. When this is not possible,
ensure that the test cases are executed in the right order.
- Add verifications to your tests, to test the correctness of your application under test as well as the functional flow.
- Use keyword-driven testing to create highly reusable action sets. Bundle commonly used actions into keywords, combine keywords
that are often executed sequentially into keyword sequences, and execute combinations of keywords and keyword sequences as
keyword driven-tests.
- To keep your tests maintainable and reusable, prefer writing multiple simple test cases that are combinable to writing complex
test cases.
- To avoid redundancies in your test set, prefer updating existing test cases to adding new test cases.