This is a migrated thread and some comments may be shown as answers.

Unable to move/rename tests without breaking coded references to elements

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick
Top achievements
Rank 1
Nick asked on 12 May 2014, 06:49 PM
I have one test that was used to record many actions and elements in a silverlight application using TS/VS2012.  This was the very first test I ever recorded and is no longer needed/fits into the evolution of our test suite.  I want to either delete, move or rename the test to clean up our project, but doing so breaks many coded references to the elements that were recorded as part of that test.

- If I delete the test, all the elements recorded in that particular test are deleted as well, which breaks any coded references to the elements that were recorded in that same test.  
- If I move the test to another folder, all of the coded references to the recorded elements are broken and the below error is triggered.  
- If I rename the folder containing the tests to something else, all of the coded references to the recorded elements are broken and the below error is triggered.

Error:
'TestProject.Pages.TestPage.SilverlightAppElement' does not contain a definition for 'LoginButton' and no extension method 'LoginButton' accepting a first argument of type 'TestProject.Pages.TestPage.SilverlightAppElement' could be found (are you missing a using directive or an assembly reference?)

For example, the above error is triggered when the below line of code is used in a coded step of another test, OR when used in common/utility class, and the original test is moved, deleted or renamed:
Pages.TestPage.SilverlightApp.LoginButton.User.Click();

Is there any way to move/rename or delete the original test without breaking the link between coded steps and the original elements?

Steps to reproduce:
1. Create a new project using VS
2. Record a simple test of navigating to google and typing "test", name it Test1
3. Create another test, add a basic coded step to click search (Pages.Google.Search.User.Click()), name it Test2
4. Rename Test1 to xTest1
5. Rebuild the project and note the error that is displayed




1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 15 May 2014, 07:06 PM
Hello Nick,

No repro given the steps you outlined as demonstrated in this video:
http://screencast.com/t/0Hj3Fj2J

You're right in that if you delete a test that is holding the elements referenced by coded step in another test, it will cause compile failures. My suggestion in such a case is to copy the element definition out of the Pages.g.cs file before you delete the test and manually add it to coded step of test 2. You won't use Pages.PageName.Element format, but use your own code once you've extracted it out of Pages.g.cs.

For the problem you're having with renaming a test or moving it into another folder, can you send us a project that exhibits this behavior for us to study?

Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Nick
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or