Using variables in Test Objects

Is it possible to use a variable or test data within a Test Object?

For instance, I want to create an event in our events management system that pulls the title "Event 1" from test data (or a variable). Then, in second test case, I want to find the Event to edit it by locating and clicking the link element on that page whose label matches that same variable/test data.

Thanks in advance!

Comments

  • Hi Dean

    I'm also interested to find out if there is a simple way to reference a variable. Did you ever find a way?

    Thanks
  • There's no way to simply reference a variable as a property on the Test Object so I can "find object by"?

    For example:

    text=[variable]
  • Suppose below is your xpath for specific row in the table

    html/body/div[1]/section[2]/div[1]/section/aside/div[2]/aside/aside[2]/div[2]/div/div/div[1]/table/tbody/tr[1]/td[3]/a

    in this case you want to change the row dynamically i.e. tr[1] to be changed to tr[2], tr[3] ...and so on

    You can declare int i=1 and use the same if want to increase/ decrease its value

    xpath for the same will change

    html/body/div[1]/section[2]/div[1]/section/aside/div[2]/aside/aside[2]/div[2]/div/div/div[1]/table/tbody/tr["+i+"]/td[3]/a

  • @Dean Hicks said:
    Is it possible to use a variable or test data within a Test Object?

    For instance, I want to create an event in our events management system that pulls the title "Event 1" from test data (or a variable). Then, in second test case, I want to find the Event to edit it by locating and clicking the link element on that page whose label matches that same variable/test data.

    Thanks in advance!

    You can use object property wherein your "title" contains value "Event 1"

Sign In or Register to comment.