Header

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

In Qualitia Automation Studio (QAS), Objects refer to the controls of the application being tested. Each object is displayed with its attributes such as object name and class.

To describe a test object, you provide a set of property names and their corresponding values. This description helps to identify the objects in the Application Under Test (AUT).

Object-Related Functions

The Objects section on the Develop screen of QAS allows you to:

  • Create objects: Generate objects for form fields, such as username, email, and password and buttons, such as submit and cancel to support testing new features in web applications.

  • Edit objects: Modify object properties when the application's user interface changes, ensuring compatibility with updated elements. For example, changing the ID of the Submit button in the form from "submitBtn" to "submitButton."

  • Delete objects: Remove objects associated with discontinued features or elements during a redesign to maintain up-to-date test cases.

  • Locate objects: Easily find objects or search for objects in object collections. You can check or uncheck the smart locator to enable or disable it. For example, to update the properties of a Login" button object, you can use the search function instead of scrolling through a long list of objects.

Using Regular Expressions

Regular expressions, commonly referred to as regex, are a powerful feature used for pattern matching within Qualitia Automation Studio.

  • Match Patterns: You can use regular expressions to match specific patterns or text within your application's elements, such as web page titles, object properties, or text on a webpage. For example, you want to verify if a web page title starts with "Welcome to" followed by any text. You can use a regular expression as ^Welcome to.* .

  • Dynamic Object Identification: Regular expressions can be helpful when the properties of web elements or objects are dynamic or change based on the content. By using regex, you can create more flexible and robust automation scripts. Suppose you are automating a web application, and the ID attribute of a button changes dynamically, but it always starts with btn_submit. You can use a regular expression to identify this button as ^btn_submit.* .

  • Parameterization: You can use regular expressions to parameterize test data. This means you can use one test script for multiple test scenarios by defining the data pattern with regex. For example, if you have a set of email addresses, and you want to match any valid email address, you can use a regex like this: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}. This regex matches a wide range of valid email addresses.

Using Key Names in Parameterization

If you have a key TitleKey storing the value MyBrowser, you can use the Property Value for the Browser's title as {TitleKey}.

For example, you are testing a multi-language application where the title of the browser changes based on the selected language. Instead of creating separate objects for each language, you can store the title for each language in a key, such as EnglishTitleKey, SpanishTitleKey, and more. Now, use these keys in the Property Value field. This way, you can easily switch between languages during testing by just changing the key values.

Scope of Keys

Let us consider, you are testing an e-commerce website, and you have two test cases:

  1. Test Case 1: Add a product to the cart.

  2. Test Case 2: Remove a product from the cart.

In both the test cases, you need to interact with a product object. The product object has a property ProductID, which is used to identify the product.

  • In Test Case 1, you are testing the functionality of adding a product with ProductID "123" to the cart. So, you set a key ProductKey with the value 123. In your test steps, use {ProductKey} to refer to the ProductID. When the test runs, Qualitia will replace {ProductKey} with 123, and the test will add the product with ProductID 123 to the cart.

  • Now, in Test Case 2, you are testing the functionality of removing a product with ProductID 456 from the cart. You use the same key name ProductKey with value as 456. In your test steps, again use {ProductKey} to refer to the ProductID. When this test runs, Qualitia will replace {ProductKey} with 456, and the test will remove the product with ProductID 456 from the cart.

Even though you used the same key name ProductKey in both test cases, changing the key value in Test Case 2 did not affect Test Case 1. This is because the scope of the key is limited to the test case in which it is used. This allows you to reuse the same key names across different test cases without worrying about conflicts or unintended consequences.

Concatenating Keys and Strings

Let us consider, you have two keys:

  • StartKey = Begin

  • EndKey = End

You can combine them in several ways to yield different outputs, such as:

  • {StartKey}{EndKey} will yield BeginEnd

  • Start{EndKey} will yield StartEnd

  • {StartKey}ningwill yield Beginning

Suppose you are testing a web application that generates dynamic URLs based on user input. The URL structure is www.example.com/{userInput}Page. You can store the user input in a key, say UserKey. In your test steps, you can refer to the URL as www.example.com/{UserKey}Page. This way, you can easily test with different user inputs by just changing the value of UserKey.

Special Characters

  • Braces ({}) - Key Name Identifiers: If you have a key named TitleKey storing the value MyBrowser, you can insert it in the Property Value field as {TitleKey}. This is particularly useful when dealing with a web application where the page title changes based on user actions. Instead of creating separate objects for each title, you can store the title in a key and reference it in the Property Value field. This allows for easy adaptation to changes by simply modifying the key's value.

  • Forward Slash (/) - Escape Character in Qualitia: When you need to use a string containing braces in the Property Value field, you must precede the brace with a forward slash, like /{MyString. For example, in a code editor application testing scenario where users input code snippets, if you wish to include a brace in your string, you should escape it with a forward slash. This prevents QAS from interpreting it as a key name identifier.

  • Caret (^) - Array Data Separator: To pass an array of strings, such as "Apple," "Banana," and "Cherry," in the Property Value field, you can use a caret (^) as a separator, like Apple^Banana^Cherry. For instance, in a testing scenario where a user can select multiple items from a list, and these selected items are sent to the server as a string separated by caret (^), you can store Apple^Banana^Cherry in your test data. In your test steps, you can then use this string directly to simulate the user selecting "Apple," "Banana," and "Cherry" from the list.

  • No labels