This document step-by-step instructions on how to create and manage test scripts in test cases. The test scripts of a test case are the Unit Tests that are to be performed when executing a test plan of auto type.
To manage test plans, you need a permission such as Project Manager, Create Plan/TC … . For more information, please refer to Global Permissions.
Creating new Test Scripts
To create test scripts:
In TESTaide home, select the project that you want to remove test scripts from.
Select the 'Test Cases' menu on the left sidebar.
On the test case page, click the ‘Step Create’ button and on the ‘Test Script’ pop-up window, enter the following information.
Click the ‘Save’ button at the bottom to complete the test script creation.
Field | Description |
---|---|
Test Case | This displays the name and key of the current test case that is selected. This value is fixed and cannot be modified. |
Title | (Optional) The maximum length for the title is 50 characters. |
Test Script | Here you will input the unit test that you want to be performed. |
Test Data | (Optional) Here you will input any required data that is used in the unit testing. E.g., any reoccurring variables used in the testing operation. |
Expected Result | (Optional) Here you will input the expected result from the unit test, e.g., assertions of any operations occurred in the testing. |
The script must be written according to the Python syntax, and method names for each test case are not written.
Writing the following in the test data field will make the variable usable within the test script.
user_id='testaide'
In the case of writing multiple script in one test case, the variable self.driver must be declared at the top of EACH test script. Refer to the example below for more information on the format of the test script.
Example Test Script
The following example contains two test scripts,
The first accesses the login page, enters the required information, and check that the result was successful by asserting that the next page contains the 'project
No | Test Script | Test Data | Expected Result |
---|---|---|---|
1 | self.driver.get(loginurl) my_driver = self.driver userIdEle = my_driver.find_element(By.NAME, 'logId') passwordEle = my_driver.find_element(By.NAME, 'logPw') submitEle = my_driver.find_element(By.CLASS_NAME, "btn-style") userIdEle.send_keys(user_id) passwordEle.send_keys(user_pw) submitEle.click() time.sleep(2) | loginurl = 'http://localhost:8080/loginForm.do' user_id='testaide' user_pw='welcome' | self.assertIn("project.", my_driver.current_url) |
2 | my_driver = self.driver project_url = my_driver.current_url + "?key={}".format(projectkey) my_driver.get(project_url) time.sleep(3) | projectkey = 'AUTO1' | self.assertIn('project', my_driver.current_url) |
Edit Test Script
To edit test scripts:
In TESTaide home, select a project that you want to edit test scripts.
Select the 'Test Cases' menu on the left sidebar.
In the test case page, select a test case from the list you want to edit test scripts.
In the test script panel below, click the ‘Edit’ icon besides the test step you want to edit from the test script list.
In the ‘Test Script’ pop-up window, edit the information you want.
Click the ‘Save’ button at the bottom to save changes.
📌 To change the order among test scripts, click the ‘Up’ or ‘Down’ icon besides the test script.
Delete Test Script
To remove test scripts:
In TESTaide home, select a project that you want to remove test scripts.
Select the 'Test Cases' menu on the left sidebar.
In the test case page, select a test case from the list you want to remove test scripts.
In the test script panel below, click the ‘Remove’ icon besides the test step you want to delete from the test step list.
When the deletion confirmation pop-up window appears, click the 'OK' button to complete the deletion.