cancel
Showing results for 
Search instead for 
Did you mean: 

Storing objects on separate file

SOLVED
Highlighted
Occasional Contributor

Storing objects on separate file

Hi Everyone,

I want to store all my object names in separate file which contain the NameMapping values and xpath values . How to do it in Testcomplete?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: Storing objects on separate file

If you are a glutton for punishment you could write a custom script that takes your file in and writes out a NameMapping.tcNM, but I don't see what the point would be.

 

If you're using Javascript (or another scripting language) you could read in your separate file and use the eval() function to substitute in the correct NameMapping and xpath values.

e.g.

 

function ReadObjectFile(filename) {
    // read the file in here and return an object with your mapping
}
all_objects = ReadObjectFile("path/to/file")
button_object = all_objects["button4"]
eval("Aliases.App.mainPage." + button_object).Click()

 


--------------------
QA Systems Architect
Integrated Control Technology
https://www.ict.co/

View solution in original post

2 REPLIES 2
Highlighted
Contributor

Re: Storing objects on separate file

If you are a glutton for punishment you could write a custom script that takes your file in and writes out a NameMapping.tcNM, but I don't see what the point would be.

 

If you're using Javascript (or another scripting language) you could read in your separate file and use the eval() function to substitute in the correct NameMapping and xpath values.

e.g.

 

function ReadObjectFile(filename) {
    // read the file in here and return an object with your mapping
}
all_objects = ReadObjectFile("path/to/file")
button_object = all_objects["button4"]
eval("Aliases.App.mainPage." + button_object).Click()

 


--------------------
QA Systems Architect
Integrated Control Technology
https://www.ict.co/

View solution in original post

Highlighted
Community Manager

Re: Storing objects on separate file

Great job tphillips! 

 

@prekar does this help?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors