Check which TestedApp is currently running
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check which TestedApp is currently running
Hi all,
at the beginning I had only one TestedApps entry "App1", of type "Generic Windows Application" with the path to java.exe as application parameter and some command line parameters to start my Java application with a specific user.
Within a 'Given "App1" is started' I started my app via scripting, using the following:
TestedApps.App1.Run();
If I wanted to check, if my application is already running, I just used the following:
Aliases.java.<App1>.Exists
Now I have two TestedApps entries "App1" and "App2", both of type "Generic Windows Application" with the path to java.exe as application parameter, but differing command line parameters to start the Java application with different users.
As both applications start java.exe I cannot use the process properties to distinguish between them.
I want to handle the following scenarios executed after another:
Scenario 1: 'Given "App1" is started' 'When xxx' 'Then yyy' => App1 should be started as described above
Scenario 2: 'Given "App1" is started' 'When aaa' 'Then bbb' => As App1 is already running, I don't want to do anything
Scenario 3: 'Given "App2" is started' 'Whey mmm Then nnn' => As App1 is already running, I want to stop App1 and start App2 instead
So I would need something like the following in my 'Given "<App>" is started' step:
if (nameOfRunningApplication != nameOfApplicationToStart){
stop "nameOfRunningApplication";
start "nameOfApplicationToStart";
}
I already played around with global variables, etc. to store the name of the application, which was started last time (and is currently running), but I cannot find a way to define this variable so its value is not lost, when reusing my test step in another scenario with a different parameter for the other application.
Hope my problem was stated clearly and you can help me 🙂
Kind regards,
M-Th.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try having a separate project variable for each app that's boolean? You could check that state when you think you need to start it again. Make it a project suite variable so it carries between projects.
You might also put that as a suggestion for an "Is running" property and see if the devs can come up with a way to add it to the object properties.
Here's the link: https://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests
Marsha_R
[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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for your quick reply.
I now use
Project.Variables.appRunning = app;
to store the application I just started and to check, if later on I should do nothing or close the current application and start another one.
Kind regards,
M-Th.
