? QA Design Gurus: How Element Explorer and Element Repository works in Telerik Test Studio

Jul 31, 2015

How Element Explorer and Element Repository works in Telerik Test Studio

In TTS Element Explorer and Element Repository plays vital roles. In this blog, I will explain how these work in TTS.

What is Element Repository?
Element Repository is an in-memory collection of all elements. This repository as single is not persisted on disk. It relies on the individual element definitions that are persisted with each test.

 What is Element Explorer?
Element explorer is similar to Dom Explorer. In short it contains the elements that are required to run your test. When a Test Project is loaded all the elements from all the tests are merged into Element Repository, which then gets displayed into Element Explorer.
 

On what basis elements get added to Element Explorer?
In TTS Project settings, we have an option called Compare Mode in 'Recording Options' section. Based on this setting only the elements will be added .Compare Mode can be checked against the page's Title or one of multiple settings that look at various parts of a URL. Choose corresponding Compare Mode with respect to your need basis.

When elements gets added to Element Explorer?
There are two ways from where we can add elements
1. While Recording steps  - Whenever we record a step, elements will get added to the element explorer automatically.
2. Manually Adding desired element using TTS Recorder - From the recorder choose an element in the Dom and select 'Add to Elements Repository'.


How the Elements are Organized in Element Explorer?
For HTML Tree view -> First it adds the page then Frame, then the Test Region and Element.
If we do not have any frame or region, then the element will be added directly to the page node. In the below example we do not have Frame and Region so elements are added directly to Page Node.






How elements are bind to test?
Each test file keeps a definition of all the elements that particular test uses. Each recorded step maintains 'Friendly Name' and Find Expression that is used to identify the element on the web page during execution. So whenever we are deleting a particular test, its corresponding elements will also gets deleted from Element Explorer.


How elements in coded steps work?
When we convert record step into a coded step, the element definitions are changed into 'External Reference'. This means that elements still binds to the test but they are not tied to specific test step. The same will be happen when we add elements by selecting element from Dom Explorer using 'Add to Element Repository'. There is a file called Pages.cs which is a hidden file and is automatically generated by Test Studio. This file is only used by coded steps.Test Studio generates this file from the elements contained in the element repository, which are displayed in the Elements Explorer.

When Pages.cs file will be generated?
Pages.cs file will be automatically generated by TTS in below cases.
  • When the test project is loaded by Test Studio.
  • When you add elements, such as when you record new test steps.
  • When you delete elements, such as when you delete a test step or an entire test.
  • When the test project is built on your local development box or on a build server.

How is the Element Repository used during test execution?
During test execution, the root Page node is not actually used to locate the element. The execution engine only uses the Frame, and the element's Find Expression to locate the correct element to interact with during any test step. This allows the test to continue to work when you need to test in a different testing environment (e.g. a Development server, then a Staging server, then a Production server).



No comments:

Post a Comment