Create Test Case

In Manual View

Tutorial

Katalon Studio supports Keywords-Driven testing where test cases consist of keywords that represent actions of users on the AUT (Applications Under Test). This allows users with less experience in programming to easily generate automation test. The below tutorial will give you step-by-step instruction in order to create an automation test case in manual mode.

Given a sample test case with the steps as below:

  • Open the browser
  • Navigate to a website
  • Click on certain control
  • Validate if a control exists on the page
  • Close the browser

Follow these steps to automate the above test scenario in Manual view:

  1. Select File > New > Test Case from the main menu. The New Test Case dialog will be displayed. Provide the name for the new test case, then click OK button.

  2. Once a new test case is created, it is opened in Manual view. This view allows users to create automation tests easily with little programming skills required.

  3. Select Add > Web UI Keyword from the command toolbar.

    Recent keywords allow users quickly add any of the last 10 recent used keywords in Item list.

  4. Select the Open Browser keyword. This keyword will open a browser and navigate to the specified URL if provided. (selected keywords will have their description displayed along for reference)

  5. Add the Navigate To Url keyword. This keyword will navigate to a specified URL. Double click on the Input cell to provide additional data (parameters) for the keyword.

  6. The Input dialog is displayed. Where:

    FieldDescription
    NoThe number of parameter for the selected keyword.
    Param NameThe name of the parameter.
    Param TypeThe required data type for the parameter.
    Value TypeThe type of your input value (e.g. strings, variables, data sources...)
    Value

    The input value for this parameter.

    Input value can be varied based on Value Type. Refer to Value Types in Katalon for more details.

    For now, enter the URL of Katalon demo AUT (http://demoaut.katalon.com) into the Value column then click OK.

  7. Add the Click keyword. This keyword represents the click action on a given object. Double click on the Object cell to provide the object for the keyword.

  8. All captured objects in Object Repository are displayed in the Test Object Input dialog (Refer to Spy Object for details regarding how to capture objects). Select your object then click OK.

  9. Add the Verify Element Present keyword. This keyword validates if a certain object is displayed on the executing browser. Similar to the previous step, you need to specify the object to be used with this keyword.

  10. Add the Close Browser keyword and save your test case.

  11. Click on Run in the main toolbar to execute the test case.

    Katalon Studio should be able to execute all the steps of the sample test case.

Recent Keywords

Recent keywords allow users quickly add any of the last 10 recent used keywords in Item list. For example, let's take test case above. To add another Verify Element Present after Step 4, recent keywords feature wouldaccomplished this in seconds.

Highlight Step 4. Click on Recent Keywords and select Verify Element Present. An extra step is added after Step 4 as illustrated below:

  

Recent Objects and Object Folders

Katalon Studio allows users to quickly select recently used Object or jump directly to recent used Object Folder in Object Repository.

Recent list will have two sections: Object Folder and Test Object

  • Test Object: Display the names of the last 5 selected objects
  • Object Folder: Display the names of 5 folders that contain anyrecent used objects

In Script View

Tutorial

In addition to the Manual view, Katalon Studio allows expert users to programmatically write automation test in the Script view of test cases. Users with Groovy/Java background can easily modify the test script as needed.

Given a sample test case with the steps as below:

  • Open the browser
  • Navigate to a website
  • Click on certain control
  • Validate if a control exists on the page
  • Close the browser

Follow these steps to automate the above test scenario in Script view:

  1. Select File > New > Test Case from the main menu. The New Test Case dialog will be displayed. Provide the name for the new test case, then click OK.

  2. Once a new test case is created, you can switch to the Script view using the corresponding tab at the footer of the test case editor. Test steps specified in the Manual view are translated into a Groovy script in Script view.

    The import statement in a test script allows referencing to classes to be used. Expand the import section to see all default imported classes by Katalon Studio. The name after 'as' in each import statement is an alias for the class. You can change the alias for each class. These classes are necessary for composing a test script.

    Katalon Studio is an automation tool that supports keyword-driven testing. All keywords are grouped into WebUI, Mobile and WebService packages accordingly. Press Ctrl + Space to view these packages and functions from the imported classes.

  3. In this scenario, you will create a Web application test script to make use of the Web UI built-in keywords. To use a built-in WebUI

    WebUI.
    

    The Content Assist function will be invoked after users enter the dot character. Content Assist provides users with a context-sensitive suggestion for code completion. Therefore, all the built-in keywords for WebUI testing will be displayed as below:

  4. After entering the dot character (.), all built-in keywords and their description for Web UI testing will appear as below:

    Content Assist Dialog Katalon Studio

  5. Select the Open Browser keyword. This keyword opens a browser and navigates to the specified URL if it is provided. Selected keywords will have their description displayed along for reference.

  6. Enter the Navigate To Url keyword. This keyword navigates to a specified URL. For now, enter the URL of Katalon Studio (katalon.com) as the value of the parameter.

  7. Enter the Click keyword. This keyword represents the click action on a given object. You need to specify an object for this action.

  8. Use the following syntax to refer to an object in Object Repository (alternatively, you can drag and drop the object to test case editor to generate the syntax):

    findTestObject('{Object ID}')
    

    Where Object ID is the ID of that object in Katalon Studio.

    You can find object ID from its Properties dialog. For example:

  9. Enter the Verify Element Present keyword. This keyword validates if a certain object is displayed on the executing browser. Similar to the previous step, you need to specify the object to be used with this keyword.

  10. Add the Close Browser keyword and save your test case.

    The following API docs may prove useful when working in Script view:

    Class Description
    Builtin Keywords List of common built-in keywords
    WebUI Builtin Keywords List of Web UI built-in keywords
    Web Service Builtin Keywords List of Web Service built-in keywords
    Mobile Builtin Keywords List of Mobile built-in keywords
  11. Click on Run in the main toolbar to execute the test case.

Katalon Studio should be able to execute all the steps of the sample test case.

The test execution results are shown in Log Viewer as below:

Test execution Dialog

Feedback