CSE 270: W06 Lab: Automation

Our lab activity this week is to create automation scripts using the Selenium tool. To do this, we will create a dozen tests on a web-based calculator.

Calculator

We will automate the functionality of "The Online Calculator™." This can be found here: https://www.theonlinecalculator.com/.
Please familiarize yourself with this calculator for a few minutes. It would be a good idea to view the source of the calculator, which can be done in the following ways:
Google Chrome, Firefox, and Edge – Right-click anywhere on the page and select “View Page Source.” To view individual elements, right-click them and choose “Inspect.”

Get Set Up with Katalon

An example of a test case is:

CSE270M06TeachAutomation.krecorder
Download this file so you can load it into Katalon.

Google Chrome and Microsoft Edge

Open Katalon IDE Project

Click on the Katalon icon in your extensions
Graphical user interface, application  Description automatically generated

It will then bring up the Katalon IDE.


Click “Open test suite” , either from Open Test Suites or from the "folder icon"

Click “Select: Open KR Test Suite”

Navigate to the location of automation file that you saved, and select the file “CSE270M06TeachAutomation.krecorder” Select “Got it!” to finish loading the file.

You should see the following tests within the Katalon IDE:

Run Test
Select the test case that you just loaded into the IDE, and then select “Play Test Case.”

Creating a Test
This automation was created using the following steps:

  1. Click on your browser’s icon for the Katalon plug in.
  2. While hovering over your test suite, select the  icon to create a new test case.
    1. If there are no suites under the “Test Suites” tab, you can create a suite by hovering over “Test Suites” and choosing the  icon. After doing this you can follow the instruction above.
  3. You are then given the option to name your test. For this example, choose the name: What is 6*7? 42.
  4. At any time, you can save your test to your local machine by hovering over your suite and clicking the  icon. You can then choose to download the Test Suite.
  5. After making sure that the new test case you made is selected, click on the  icon. This will add a new row to the test case, and needs to be done every time you create a new command.
  6. First, you will want to tell the test case to open the online calculator’s website.
    1. For command, type “open”
    2. For target, type “https://www.theonlinecalculator.com/”
    3. Leave the value field blank.
  7. Next, you will want to enter the value 6 into the calculator.
    1. For command, type “click”
    2. For target, type “name=six”
      1. Note that the names of each calculator object can be found by “inspecting” them within your browser.
    3. Leave the value field blank.
  8. You will want to specify multiplication.
    1. Create another click command.
    2. This time the name of your target is “multiply”
    3. Leave the value field blank.
  9. Enter the value 7 into the calculator.
    1. Create another click command.
    2. The name of your target is “seven”
    3. Leave the value field blank
  10. Finish the calculation
    1. Create another click command.
    2. The name of your target is “calculate”
    3. Leave the value field blank
  11. Create a verification (assert) step to confirm that the webpage is working correctly
    1. For command, type “assertValue”
    2. For target, type “id=display”
    3. For value, type “42”
  12. Verify that the test works by pressing the “Play Test Case” button ▶ at the top of the page.
  13. Save your test suite.

Mozilla Firefox

Open Katalon IDE Project

Click on the Katalon icon in your extensions

It will then bring up the Katalon IDE

Click “Import Selenium Test Suite”

Navigate to the location of automation file that you saved, and select the file “CSE270M06TeachAutomation.side.” Select “Got it!” to finish loading the file.

You should see the following tests within the Katalon IDE:

Run Test

Select the test case that you just loaded into the IDE, and then select “Play”

Creating a Test
This automation was created using the following steps:

  1. Click on your browser’s icon for the Katalon plug in.
  2. While hovering over your test suite, select the  icon and select “Add New Test Case.”
    1. If there are no suites under “Test Suites,” you can create a suite by clicking the  icon in the Test Suites header. After doing this you can follow the instruction above.
  3. You are then given the option to name your test. For this example, choose the name: What is 6*7? 42.
  4. At any time, you can save your test to your local machine by hovering over your suite and clicking the  icon. You can then choose to save the test suite to your computer.
  5. Before proceeding, make sure that you have selected your new test case. Then, create a new command by using the  icon near the center of the window. Note that you will need to create and then select a new command for every step of this test case.
  6. First select the blank command you made, and then tell it to open the online calculator’s website.
    1. For command, type “open”
    2. For target, type “https://www.theonlinecalculator.com/”
    3. Leave the value field blank.
  7. Next, you will want to enter the value 6 into the calculator.
    1. For command, type “click”
    2. For target, type “name=six”
      1. Note that the names of each calculator object can be found by “inspecting” them within your browser.
    3. Leave the value field blank.
  8. You will want to specify multiplication.
    1. Create another click command.
    2. This time the name of your target is “multiply”
    3. Leave the value field blank.
  9. Enter the value 7 into the calculator.
    1. Create another click command.
    2. The name of your target is “seven”
    3. Leave the value field blank
  10. Finish the calculation
    1. Create another click command.
    2. The name of your target is “calculate”
    3. Leave the value field blank
  11. Create a verification (assert) step to confirm that the webpage is working correctly
    1. For command, type “assertValue”
    2. For target, type “id=display”
    3. For value, type “42”
  12. Verify that the test works by pressing the “Play” button ▶ at the top of the page.
  13. Save your test suite.

Create Test Cases

With your partner(s), generate a dozen test cases. This will involve using Katalon to create twelve individual test cases.
Try to verify some of the following:

Come up with at least 2 of your own.
Challenge: Write tests cases that fail but are successful because the test cases are checking for failure.

Submission

Submit a screen-shot of each of your test cases in Katalon with a successful run. Show that the tests ran successfully in the screen shot. Save the pictures in a word document or presentation.

Assessment

This is a pass/fail assignment.