简体   繁体   中英

How to compile and run QTP script from command line

I want to use a text file containing the source code of the QTP script, and compile it (create the usr,cfg,usp etc files that get created when we manually "save" a script in QTP) by using the command line. Is there a way to do both?

All those extra files in QTP/UFT are for when you're doing "more" than just writing a script. It stores the test description, associated repositories, parameters, recovery scenarios, etc. If you're writing test logic in a text file, there's a good chance you're not using any of that extra stuff either.

Take any blank QTP/UFT test to create a "template" of a valid test. Then all you have to do is replace the 'Action1/script.mts' file with the contents of your text file.

If you want do to all of this from a command-line, you'll need to write a simple console-based application to do the heavy lifting for you.

To get rid of the problem, I´d make sure that run results never are saved in the test´s directory, and apply SVN on the whole directory of a test, or to the whole "tests" subdirectory root .

This might result in quite some subdirectory structure, but it has a meaning (for QTP), and without run results, it´s not hundreds of files, or megabytes, so SVN can indeed chew on them quite well.

Alternatively, you could use QC to save your tests in a QC repo, and enable version control in it. Then, QC will handle the "bundling" of all files of a tests, and guarantee that only one user can modify a given test.

Point is, if you just put the script into SVN, and, when you need it, re-create the other files programmatically, you lose info like (not limited to):

  • data table name, tab structure, content local repository content
  • associated repository file(s)
  • associated library file(s) run settings
  • ActiveScreen screens expected values for checkpoints
  • Action properties
  • Action parameters (formal and actual)
  • Action call hierarchy (test flow)
  • Subactions´ script content

which probably is unacceptable except for the simplest most trivial tests. So I recommend you drop the idea of just saving the script content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM