Ask a Question

Count the number of instances

SOLVED
BrianSmart
Occasional Contributor

Count the number of instances

Hey,

 

I'm trying to find a way to count the number of instances of an application without throwing an error. Part of my check is to launch a second instance, and verify that the application detects another instance running, and alerts the user. I don't want to stop testing when using Sys.Process("name", 2).Exists(). Is there a place where I can safely (without an error) count the number of instances for manual validation? Do I need to do this externally?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ebarbera
Staff

Re: Count the number of instances

@BrianSmart - 

 

For this I would suggest the following. 

Create a second object in the NameMapping which is mapped using the index number:

ebarbera_0-1638819272739.png

In your test build an If...Then statement:

ebarbera_1-1638819320866.png

The statements themselves can be customized and of course if you did not want to log a warning you do not have too - just used that as an example. 

 

Let me know if this helps or if you have other questions. 


Emma

 

View solution in original post

4 REPLIES 4
ebarbera
Staff

Re: Count the number of instances

hi @BrianSmart - 

 

Are you looking to validate this internally or externally? Either can be done. 

 

Thanks, 

Emma

BrianSmart
Occasional Contributor

Re: Count the number of instances

I want to validate it internally without turning off "stop on error" and without running external scripts.

ebarbera
Staff

Re: Count the number of instances

@BrianSmart - 

 

For this I would suggest the following. 

Create a second object in the NameMapping which is mapped using the index number:

ebarbera_0-1638819272739.png

In your test build an If...Then statement:

ebarbera_1-1638819320866.png

The statements themselves can be customized and of course if you did not want to log a warning you do not have too - just used that as an example. 

 

Let me know if this helps or if you have other questions. 


Emma

 

View solution in original post

mattb
Staff

Re: Count the number of instances

Hi,

To manually count this, you can see what processes are running via the object browser: https://support.smartbear.com/testcomplete/docs/testing-with/exploring-apps/object-browser/about.htm... 

cancel
Showing results for 
Search instead for 
Did you mean: