cancel
Showing results for 
Search instead for 
Did you mean: 

pass executable name to test script

SOLVED
Highlighted
Contributor

pass executable name to test script

Currently we use a "TestedApps" executable for use in our test scripts; ie. TestedApps.[Executable Name].Run();

 

We would like to be able to pass the executable name to TestExecute as an input parameter that is based on the build number in the directory. Is there a way to do this? Or is there a way to modify the "TestedApps" file location via command line?  This is for testing a nightly build.

 

Thanks.

 

-Ron

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: pass executable name to test script

Could you add it at the beginning of your test with this?

 

https://support.smartbear.com/viewarticle/69060/#ID0ESCAC

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: pass executable name to test script

I don't think you can change it from the TestExecute command line, but what you could do is put that build name in a file or an Excel sheet and just let the test script read it from there every time.

Highlighted
Contributor

Re: pass executable name to test script

Not a bad idea, but it only solves part of the problem. Even if I were to load the name from a file, I still cannot figure out how to "run" the file.

 

The only way I can see to startup a desktop application is to add it to "TestedApps" and use the .Run() method as stated above: TestedApps.[Executable Name].Run();

 

I cannot find an Execute(filename) command, or a RunFile(filename) or something like this. I even tried to simply load a variable with the filename to see if there was a "Run" method in desperation, but this obviously was not going to work and it didn't. Ex. var fileToRun = "C:\\[directory]\\[filename.exe]";  fileToRun.Run();

 

Am I missing something really obvious here?  Is there another way to startup your app without adding it to TestedApps?

 

Thanks again.

 

-Ron

Highlighted
Community Hero

Re: pass executable name to test script

Could you add it at the beginning of your test with this?

 

https://support.smartbear.com/viewarticle/69060/#ID0ESCAC

View solution in original post

Highlighted
Contributor

Re: pass executable name to test script

Sometimes you have to work 'outside' the test tool to do certain things.

This is how you would do it in VBscript. You would have to modify the syntax for other test languages....

 

Dim objShell

Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute svPathAndFile, svArguments, svStartInDir, "runas", 1

 

 

'****************************************************************************************************
' Syntax of Shell.Application
' .ShellExecute "application", "parameters", "dir", "verb", window
'
' .ShellExecute 'some program.exe', '"some parameters with spaces"', , "runas", 1Key
'
' application The file to execute (required)
' parameters Arguments for the executable
' dir Working directory. The Working directory may be different that the directory that the application is in.
' verb The operation to execute (runas/open/edit/print)
' window View mode application window (normal=1, hide=0)
'****************************************************************************************************

 

Contributor

Re: pass executable name to test script

This is just what I was looking for and just tested it. Works great. Thanks very much for this.

 

-Ron

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors