Declined
Last Updated: 30 Sep 2024 08:48 by ADMIN
Eng Keat
Created on: 24 Sep 2024 07:02
Type: Feature Request
0
Let user decide to remove an Test Studio Element

Current test studio would auto remove element if not used by any test cases, without user notification.

For real world scenario, those element may needed in later test cases. It is a nightmare if an element not found when needed. Also those element may used in custom code file.

Request to enhance Test Studio to let user decide which element to removed. Yours can highlight or change font of unused elements, so that user notified and manage it after that.

1 comment
ADMIN
Elena
Posted on: 30 Sep 2024 08:48

Hi Eng Keat,

The elements in Test Studio are one of the most complex concepts I understand it might be confusing sometimes. We discussed the case in a private thread and I've already shared the below information with you. I just want to add these notes about Test Studio elements also here in the public item. 

Test Studio Elements

Elements in Test Studio are directly related to a test and step in the test. These get deleted only if the user deletes the last step where the element is referenced. Please, find some details about elements below: 

Elements in the Elements Explorer 

When an element is recorded it is also added in the Elements Explorer. All elements are represented in certain hierarchy depending on the automated application's technology. Each element is directly associated with the steps in which it is used with its friendly name, e.g. the name displayed in the Elements Explorer. This is valid even if the steps are in different tests - the test itself keep the information for the element and its find expression. You can see which steps use an element in the Used By context menu option.

Converting steps to code 

When a recorded step is converted to a coded one the element is now referenced with its full path from the Elements Explorer - it is no longer used with only its friendly name, but also uses its parent nodes. Also at this point the element is now tied to the specific test as an independent element (not related to a step). 

Copying steps between tests and projects

Copying the recorded steps between tests, or even between different projects, will not cause any troubles because the elements is directly referenced to the recorded steps in which it is used. 

Copying coded steps, though, may be a bit tricky because the element is no longer tied to the step, but only to the test. Usually when the scope is one single project, that element used in the coded step, is still used in other step across the project and its reference reside in the Elements Explorer. However, if the test with the coded step or the step itself are copied to another project, the reference to the element is not automatically transferred. This leads to the compilation error about missing elements from the Pages file.

You can read further information about the Elements repository and how it is used in the project in this article.

Possible ways to fix the error

If you don't explicitly need to use recorded steps converted to code avoid doing that so that you don't face this type of errors. 

If you need the step to be handled in code then refer to the below steps.

  1. The element in the coded step is referenced as follows (the example talks for a web application): Pages.PageTitle.ElementFriendlyName where Pages is the Test Studio elements repository, then PageTitle is the name of the page node and ElementFriendlyName is the name of the element in question. 
  2. If you try to search that element in the Elements Explorer it will not be available.
    Or if it is, the page node will have different name. 
  3. If the element is present in the Elements Explorer and only the page node is different, you need to change the reference to element used in the coded step to point to that different page node. 
  4. If the element is not at all present in the Elements Explorer, you need to add it - in a recording session get to the point where this element is on the page and use the Add to elements option from the Recorder toolbar.
    The element gets added with a friendly name and is listed under a page node. You may need to revise if the reference in the coded step uses exactly that friendly name and page node. 

Elements in standalone code files

If you have standalone code files it is recommend to define the elements directly in the code and not rely on the Elements Explorer. Below are some useful articles on defining elements in code: 

  1. For web apps

  2. For WPF apps

 

 

Regards,
Elena
Progress Telerik

Virtual Classroom is the free self-paced technical training portal that gets you up to speed with Telerik and Kendo UI products including Telerik Test Studio! Check it out at https://learn.telerik.com/.