5 Ways to call an external file in QTP

Posted on Sep 30 2009 - 5:10pm by Raj

[Method 1]: the use of “SystemUtil.Run” command to support any file format called For example: SystemUtil.Run “C: testfile.txt”
[Method 2]: Use “InvokeApplication” command (invoke the executable program) Call executable applications such as: InvokeApplication “C: Program Files Plus! Microsoft Internet IEXPLORE.EXE”
[Method 3]: The “Excutefile” function calls the external file has three kinds of file formats can be called, and they are *. sql; *. vbs; *. txt suffix three kinds of documents such as: ExecuteFile “C: TEST.VBS”
Note: ExecuteFile function Although it can be used to import an external file into the QTP script, but can not be shared between the various ACTION. If you want it to be shared between the various ACTION external file, please refer to the following cases
[Method 4]: in [resources] option is called an external file in the “resource” option, there are three kinds of file formats which can be called, and they are *. sql; *. vbs; *. txt files of three suffix . Test → Settings → Resources → + Resources by adding an external file, you can in a QTP script to be shared between all of the external file ACTION

Note: This method can be directly implemented in different ACTION shared by an external file called

[Methods 5]: Dim WshShell set WshShell = CreateObject ( “Wscript.Shell”) WshShell.Exec “calc.exe”

About the Author

Leave A Response