Katalon Studio v5.8 - It's time for the all-new API testing experience
Joel Johnson
Katalon Apprentice
05/24/2018

how to test clicking multiple objects without starting over?

Hello -I'm new to katalon. It's a great product with lots of potential for us. 

I have a website with hundreds of objects that I need to test in terms of clicking and seeing a result. (This is an interactive floorplan with hundreds of offices on a single page.)
How do I automate this? I have been over the tutorials, but they show a MANUAL entry of objects into the Object Repository. This is not practical for my use case. (The main reason I need automated testing is that I have hundreds of objects on a page.) 

1. What is the best way to import hundreds of objects into the repository? I have access to all of the ID's etc. in a spreadsheet.

2. In several of the data driven testing tutorials on youtube - the test suite is shown running from its entirety with every change in user login. (the scenarios generally show multiple user login ids, passwords as the data) The application closes and opens a new session each time. How would this test suite be altered so that it DOES NOT start from the beginning each time, but simply loops through the different logins?

3. Is there sample code showing how to import data from excel through script? I'd like to attempt import via a Excel the list of elementIDs to iterate though them and cofirm the results when they are clicked. 

Thanks!

Upvote
Quote

Comments

  • Mate Mrse
    Katalon Expert
    05/25/2018
    edited June 18
    Hi Joel

    If you have all of the ID's for your elements, you can use CSS or XPATH to locate your elements, and then you start changing the IDs (let's say). For example

    TestObject yourObject = WebUI.modifyObjectProperty(findTestObject('Object Repository/Some object'), 'css', 'equals', '#${i}', true)

    where 'i' is the loop counter. You can put it all inside of a loop that will read your excel sheet:

    for (def i=0; i <= findTestData('Path to your excel').getRowNumbers(); i++) {}

    see https://www.katalon.com/resources-center/tutorials/data-driven-testing/ for linking data with test.
    Upvote
    Quote
  • Joel Johnson
    Katalon Apprentice
    05/25/2018
    Thanks for the reply!
    When I run the script, the for loop is causing an error:

    Test Cases/C-XPATH IMPORT FAILED because (of) java.lang.IllegalArgumentException: Cannot find test data with id 'Data Files/C:\Users\myDirectory\testSuite\testXpaths.xlsx' because (of) 'java.lang.IllegalArgumentException: Test data with id 'Data Files/C:\Users\myDirectory\testSuite\testXpaths.xlsx' does not exist'

    It is appending "Data Files/" to my string. 

    Does this add objects to the object repository or does it expect the objects will already be there?
    Thanks again!
    Upvote
    Quote
  • Mate Mrse
    Katalon Expert
    05/25/2018
    You need to add the excel file first:


    The above setup won't add anything to the object repository, it will just perform a series of actions (click, for example) on elements with various ids.
    Upvote
    Quote
Sign In or Register to comment.