How to run a TestComplete test between mutiple instance of Chrome using different user profile
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to run a TestComplete test between mutiple instance of Chrome using different user profile
Hello.
In Test Complete, Is it possible to open two instances of Chrome at the same time using different user profile, and executing the tests between both profiles?
The reason of my question is that I have the following manual test case I would like to automate using 2 chrome sessions running at the same time. It is important for both Chromes not to use the same user profile.
1) Launch Chrome (1) using profile(1)
- 2) On Chrome (1) - Log on as user1 onto the web app.
- 3) On Chrome (1) - Create a patient and assign patient to user 2.
- 4) On Chrome (1) - Make the call for user2 to accept the patient.
- 5) Start another session of Chrome, but with profile (2) and keeping the other session of Chrome(1) opened.
- 6) On Chrome (2) - Log on as user2
- 7) On Chrome (2) - Check patient is in user 2 list.
- 8. On Chrome (2) - Accept user 1 call and perform a few actions.
- 9) On Chrome (2) - user 2 return patient to user1
- 10) Return to Chrome (1)
- 11) On Chrome (1) - User 1 ends the patient visit after a few actions
- 12) Both users logs out.
- I hope someone can help explain how it can be done by example.
Thank you.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To @nedbacan :
@rraghvani wrote: "I've defined two alias name mappings for each of the two browsers."
Actually, you are not required to create two aliases because this will duplicate child objects hierarchy with seems to be identical otherwise.
The task that you must solve is: you must configure alias for the browser and/or for the displayed page so that it becomes possible to distinguish between them during runtime.
As an example, you may use process index to distinguish between two browsers.
To do this:
-- Create, for example, temporary project variable called iBrowserIndex;
-- Edit identification parameters for the browser object in NameMapping so that they (parameters) include process index property and set iBrowserIndex variable as a value for this property;
-- Now, during runtime, start first browser, get a reference to its process (using
Browsers.CurrentBrowser call, for example) and store somewhere the value of its process index;
-- Start second browser and also store the value of its process index;
-- Now, depending on with what browser your test code needs to work, assign the value of the stored process index to the iBrowserIndex variable.
/Alex [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
@AlexKaras, Can you provide an example I can follow, is there any other method like what @rraghvani suggested, his seems much easier to do but according to your comments it will give problems.
Any other alternatives ?. This will be a big plus for our team if we can make our scripts work with two browsers simultaneously.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AlexKaras the example that I had shown is not an actual solution, but a way of trying to explain and show using TC, how to distinguish between browsers, without being too technical.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The problem that you must solve is to make it possible for your test code to distinguish between two browser instances. Exact implementation depends on whether or not you are going to use two same browsers or not, whether or not the address of the tested page is the same in both browsers, etc.
Remember, that while looking for an object, TestComplete does not evaluate all possible options, but follows the already matched sub-path.
Taking your case as an example, the above statement means that if you have two Chrome browsers with first one displaying page A and second one displaying page B and your test code looks like this:
var aBrowser = Sys.Browser();
var aPage = aBrowser.Page("B");
then you can easily get an 'Object not found' error if the first line will resolve to the browser instance that displays page A. Just because the first line looks for any browser in the system and the second line looks for page B in the found browser. If the found browser displays page A, TestComplete will not try to re-evaluate reference to the browser and will not search through all browses in the system to find the one that displays page B.
In order to cope with this problem, you must search for the parent objects as precisely as possible. (In the example I provided in my previous reply I made a clear distinction between two browser processes using their process index property.)
There are two options to make your code to be able to distinguish between two browsers:
a) With the use of Aliases; and
b) With the use of only .FindXXX() methods.
(The third option is to use a combination of the above options.)
What was suggested by @rraghvani was to create separate alias for each browser. (Using, for example, command line to distinguish between them.) The advantage of this approach is that it will work during test runtime and design time. The disadvantage is the necessity to maintain two identical Aliases sub-trees.
My suggestion was to use one alias but adjust it dynamically to match either first or second browser depending on what browser your test code must work with at the moment. The advantage of this approach is that you will need to maintain only one Aliases tree. The disadvantage is that you will need to assign the required value to the project variable during both runtime and design time in order to make your Aliasing work.
The steps I provided in my previous reply describe everything you need to do to implement the approach with one alias. The only thing that is left for you is to make a decision how to distinguish between two browsers/pages using your knowledge of the tested system and planned test scenarios.
/Alex [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
================================

- « Previous
- Next »
- « Previous
- Next »