Suppose that you need to test on different web browsers: Internet Explorer, Mozilla Firefox , Google Chrome , Edge and Safari. You may find yourself asking two questions:
• Do I need different interface definitions for each of Internet Explorer, Firefox , Chrome , Edge and Safari ?
• Do I need to write different tests for each browser?
1. If the web pages have similar titles, and controls inside the web pages have property values that are the same or similar in different browsers, you can avoid the need to create a different interface definition for each browser:
a. For windows (web pages), capture the property doc title, because its value generally remains constant across browsers.
b. For controls, capture properties that have the same or similar values across browsers, and which can uniquely identify the controls.
2. Controls inside a given web page may have property values that vary from one browser to the next. In some cases, Xpath locator to identify these web elements accurately and precisely may solve the problem. In others, you may find it too difficult to use a single interface to map all the controls you need in a way that will apply to all possible browsers. For these situations, TestArchitect supports Keyword variations and Systems& Platforms features to help users automate their tests across browsers.
Ø Open a web page that you want to capture the interface of, so that it may be tested on browsers (e.g https://www.logigear.com/company/company-overview/careers)
Ø Create a new interface entity in TestArchitect:
· Under the Interfaces subtree, right-click an interface node and then click New Interface Entity.
· Enter information for the interface:
+ Name: the interface name
+ Description: (Optional) short description for the interface
· Click Create. The new interface is added to the project under the selected interface node.
Ø Open the Interface Viewer (Press F7 or select Tools > Interface Viewer from the main menu; or click the Interface Viewer icon on the toolbar.) The Interface Viewer is launched.
Ø Capture the browser window using TA property doc title.
control: there are 2 options:
- Expand tree node
- Select control
- Select Turn on auto highlight on the toolbar to identify the control in the browser
- Click Identify icon on the toolbar.
- Move mouse to control that you want to identify on browser, and then click it
Control will be shown on Interface Viewer’s tree.
Ø Choose a property to capture with the control. You should choose a property-value pair that a), uniquely identifies the control, and b), does not vary in value either over time or across browsers. Typically, the properties name, id, or xpath are useful for identification.
Ø Map control
- Right-click the control to be mapped, and then select Rename.
- Type your choice of TA name for the item, and hit Enter. The control is now mapped.
Ø Save your settings to the interface entity by clicking Save on the toolbar.
Use keyword variations to create high-level actions or interface entities tailored to a given browser. To demonstrate this, we will perform the following steps:
- Create a high-level action
- Create keyword variations for the action
- Update the keyword variations
- Execute a test with variation.
Create an action, name it config, and enter a single setting action line as follows:
This is your default version of config.
Ø Copy a definition (of an action, or interface entity) of which you wish to create a variation: In the TestArchitect explorer tree.
1.select the item and press Ctrl+C on your keyboard, or
2.right-click the node and click Copy.
Ø Right-click a folder node where the variation is to reside and select Paste with
Variations from the context menu.
Ø Select the Use keywords check box. In the text field, type the keyword(s)
to be used to define this variation.
Ø The new variation appears as a node in the TestArchitect Explorer tree:
Modify your action to match the requirements of its target browser.
In this case, the target browser is FireFox. To have TestArchitect launch a FireFox browser window, specify it in the setting / use browser action line.
Ø Select test modules that you want to execute against the FireFox browser.
Ø Click the Execute button on the toolbar.
Ø In the Execute Test dialog box, type the keyword name (“firefox”) into the Keyword textbox, then click Execute to start the test.
The Systems & Platforms feature makes creating cross-browser tests easier. Supported browsers are Internet Explorer, Mozilla Firefox , Google Chrome and Edge . To do this we follow these steps:
- Create a platform and version
- Link each variation to a version
- Execute a test with variations
To execute your tests across multiple browsers types you must create a new platform and name it. For example, we’ll name ours “Browser”.
Ø Right-click the Systems & Platforms node, and then select New Systems or Platform. The New System dialog box appears.
Ø Enter details for the new platform:
- Name: The name of the new platform (“Browser”).
- Description: (optional) Short description of the platform.
Ø Click Create.
Ø The Browser platform is added as a node beneath the Systems & Platforms node.
You can now create three version nodes for the Browser system and platform. The three new version nodes you will create are Internet Explorer, Mozilla Firefox , Google Chrome and Edge.
Ø Right-click the Browser node beneath the Systems & Platforms node, and then select Add Version.
Ø Enter the details for the new version:
- Name: the name of the new version, (e.g., “Internet Explorer”).
- Description: (optional) short description for the new version.
Ø Click Create. The new version Internet Explorer is added as a node beneath the Browser system node.
Ø Repeat the above steps to create the other three versions, Chrome , Firefox and Edge
Ø The four new versions – Internet Explorer, Chrome, Firefox and Edge – are added as nodes beneath the Browser platform node.
Select the high-level action or interface entity for which you want to create a variation. The set of variations of a given item is used to execute cross-platform automation tests.
Example: You have a high-level action called config that is used to create essential initial configurations for the browser. It is suggested that you have variations of the config action that set up web automation tests for each of Internet Explorer , Edge , Google Chrome, and Mozilla Firefox:
Ø In the TestArchitect explorer tree, navigate to the node for the config action you created earlier, right-click it, and then select Copy.
Ø Right-click the Actions node in the explorer tree, and select Paste with Variations. You have now created a variation for the config action.
Ø In the Variations dialog box, select the Link to version node check box.
Ø From the Select system drop-down list, select Browser.
Ø In the displayed system subtree under Browser, select Chrome to link this variation to Google Chrome.
Ø Click OK. Your new config variation for Google Chrome appears as a node in the TestArchitect explorer tree.
Ø Repeat the above steps to create another variation linked to Mozilla Firefox and Edge
Important: You now have three variations of the default config action, but their contents are all identical. Obviously, you must edit them (well, two of them), to get them to have different behaviors – that is, to ensure that each is tailored for its respective target browser. That editing is fairly simple:
In TestArchitect explorer, select the test modules that you want to execute across multiple browsers.
Ø Click the Execute button on the toolbar. The Execute Test dialog box appears.
Ø Execute the test modules.
- In the Execute Test dialog box, click the Select Version button in the Variation Specification frame. The Select Version dialog box appears.
- Select a browser.
- Select the Internet Explorer check box to execute against Internet Explorer.
- Select the Chrome check box to execute against Google Chrome.
- Select the Edge check box to execute against Edge.
- Select the Firefox check box to execute against Mozilla Firefox.
- Click OK.
Ø On the Execute Test dialog box, click Execute to start the test.