Tuesday, April 8, 2008

QuickTest : Applying major changes to a repository

There are times when major changes need to be applied to a repository. Such an example is when a deployed application is moved from a local test server to a server in a pre-production environment. Nothing should change except for the URL, which unfortunately is hard-coded into every single object in your repository.
  1. Open Object Repository Manager [Resources > Object Repository Manager]
  2. Open your project repository [File > Open] Export to XML [File > Export to XML]
  3. Enter a filename [exported.xml]
  4. [ok]
  5. Open you’re favourite XML editor (i.e. Notepad++)
  6. Find and Replace on the current path to the new path
  7. Do any other maintenance work
  8. [Save xml-doc]
  9. ensure document is well-formed
  10. [Close xml-doc]
  11. Meanwhile… Back in Object Repository Manager
  12. Import from XML [File > Import from XML]
  13. Save your Imported repository [imported.tsr]
  14. In the file system, delete repository.tsr and exported.xml
  15. Rename: imported.tsr to repository.tsr
Note: You will need to open a different QuickTest project and then reopen your current project for the results of the merge to be visible in the Object Repository. It’s a pain, but that’s the way of things.

2 comments:

Anonymous said...

Nice tip.

Remember though that object properties can be defined using regular expressions.

So, instead of doing this each time for an environment shift, do it once with regular expressions defining the variety of environment urls or even better do it when your creating the objects.
eg:
http://URL1|http://URL2|http://URL3

Chad Stone said...

Cheers, I hadn't thought of that. I love regex.