Ask a Question

Converting an old project to CSS/XPATH

SOLVED
wmtan01
Contributor

Converting an old project to CSS/XPATH

Hi,

 

It seems most of the updates of TestComplete are geared toward Cross Platform Testing which is great. But my question is how do you convert an old project namemapping to the one that uses CSS/XPATH as its identifiers? 

 

I've been looking around at the config and the namemapping itself but I can't seem to pinpoint how to do it. We have a massive project since we've been using the app for 5 years now but with everything moving to CSS/XPATH I want to update the project to be more robust. Any ideas on how to do it? Or would I have to start from scratch again (that would definitely suck)

18 REPLIES 18
AlexKaras
Community Hero

Hi,

 

Any ideas on how to do it?

I see no other way but manual update.

Just because I don't believe that automatic conversion from 'classic' NameMapping identifiers to cross-platform XPath/CSS can be easy and reliable.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

When you say manual, I can update my current namemapping to include xpath/css selectors without remapping objects? I couldn't find that option in my namemapping

currently, the only way is to "start from scratch" (as in you cannot just select xpath or css as an identification property and have it work (each of the new objects mapped using the xpath/css method is essentially saving a combination of conditional findelement("whatever") as their identification properties (so its completely different)

----

the team (to my knowledge) is working on a namemapping converter, and I can try to get a timeline as well.

Best,
Justin Kim

So that means, if people want to use the new functionalities of TestComplete such as the cross browser compatibility, we would all have to start again lol. 

 

Now that definitely is not ideal. I wonder if Smartbear is considering this in developing new features? 

ApplePen
Community Leader

If you want to convert all objects in namemapping. It is a really huge job.

Why do you want to convert all? Almost every object cannot be located?

It's working fine for us for Web applications on Desktop and wanted to try out the Cross Platform functionality. But I guess that's not an option? I thought, the addition of the Cross Platform functionality in TestComplete would mean people who have been using it can easily transition testing into the cloud but I guess that's not their intention.

ApplePen
Community Leader

As I know, using the Xpath/CSS is the better way than property in cross test.

But the Xpath/CSS is not necessary for the cross environment.

When parts of objects cannot be located in cross test, just fixed them by Xpath/CSS instead of property.

 

I agree with u. It is better to add the convert function in the future version.

Do you mean our current project might still work with cross platform using CBT? I have not tried it yet as we are exploring a more selenium approach to some of our mobile testing. 

 

But I hope Smartbear introduces a converter or if not a hybrid namemapping that accepts both CSS Selectors/XPATH and the existing one, or does it allow us to do that now? I have not seen the option

the converter is available in 14.72 - the official documentation has not gone up yet

 

What is it
A simple conversion utility to help users convert their Namemapping file from proprietary object recognition format to cross-platform object recognition format (XPath and CSS Selectors). This will help users run
tests created prior to v14.40 on CBT. Our internal tests suggests that ~70% of conversion happens automatically.
How it works
There are two phases of conversion:
Data collection phase - TestComplete needs to analyze information in your Namemapping file and create new mapping criteria during runtime. You will need run your existing project several times so that TestComplete reads and understands as much information as possible.
Conversion phase- After TestComplete get generates the required files, it applies the new criteria to your existing project
 
Instructions
  1. Make sure to back up your entire project
  2. Launch TestComplete using a special command line key - -SaveNameMappingData:"<Directory_to_store_namemapping_data>"
  3. Run you test several times so all test cases are executed and all objects are interacted with
  4. Close TestComplete and restart TestComplete without the special command line key
  5. Go to Namemapping panel, right-click to bring up the context menu, and select “Convert Namemapping” 
     
    Select all the files that were generated in the “data collection” phase and click OKimage.png
  6. Your objects will now be in the cross-platform format (XPath and CSS Selectors)
Best,
Justin Kim
cancel
Showing results for 
Search instead for 
Did you mean: