{"id":17431,"date":"2020-04-15T20:04:39","date_gmt":"2020-04-15T20:04:39","guid":{"rendered":"https:\/\/applitools.com\/?page_id=17431"},"modified":"2022-09-27T11:41:16","modified_gmt":"2022-09-27T18:41:16","slug":"test-scripts-101","status":"publish","type":"page","link":"https:\/\/applitools.com\/learn\/concepts\/test-scripts-101\/","title":{"rendered":"Learn – Concepts – Test Scripts"},"content":{"rendered":"\n
\n

Introduction<\/h2>\n\n\n\n

What is a test script? There are many definitions, but we’ll focus on the one that seems to be the most common in the field and the most practical for today’s QA professionals:<\/p>\n\n\n\n

A test script<\/strong> is code that can be run automatically to perform a test on a user interface. The code will typically do the following one or more times:
(1)<\/strong> Identify input elements in the UI, (2)<\/strong> Navigate to the required UI component, wait and verify that input elements show up, (3)<\/strong> Simulate user input, (4)<\/strong> Identify output elements, (5)<\/strong> Wait and verify that output elements display the result, (6)<\/strong> Read the result from the output elements, (7)<\/strong> Assert that output value is equal to expected value, and (8)<\/strong> Write the result of the test to a log.<\/p><\/blockquote>\n\n\n\n


For example<\/strong>, if you want to automatically test the login function on a website, your test script might do the following:<\/p>\n\n\n\n

  1. Specify how to locate the \u201cusername\u201d and \u201cpassword\u201d fields in the login screen \u2013 say, by their CSS element IDs.<\/li>
  2. Load the website homepage, click on the \u201clogin\u201d link, verify that the Login screen appears and the \u201cusername\u201d and \u201cpassword\u201d fields are visible.<\/li>
  3. Type the username \u201cdavid\u201d and password \u201c16485\u201d, identify the \u201cSubmit\u201d button and click it.<\/li>
  4. Specify how to locate the title of the Welcome screen that appears after login \u2013 say, by its CSS element ID.<\/li>
  5. Wait and verify that the title of the Welcome screen is visible.<\/li>
  6. Read the title of the Welcome screen.<\/li>
  7. Assert that the title text is \u201cWelcome David\u201d.<\/li>
  8. If title text is as expected, record that the test passed. Otherwise, record that the test failed.<\/li><\/ol>\n\n\n\n

    You’ll notice we added a broken line after step #3, to separate between two important parts of the test script:<\/p>\n\n\n\n