cancel
Showing results for 
Search instead for 
Did you mean: 

How I can run same test case into different test environments?

SOLVED
Highlighted
Occasional Contributor

How I can run same test case into different test environments?

For example I want to automate login and logout function for user. I want to run same automated keyword test into Test environment A and Test environment B.  Somehow for username and password fields, the object is not recognize in Test environment B because I have recorded test into Test environment A. Please help. How I can use only one environment to automate all my test cases and run them successfully into all other test environments.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How I can run same test case into different test environments?

We do the same... we have multiple environments for testing our one application.  What we've done is the following:

1) All NameMapping for pages "wildcard" the portion of the URL that changes between environments.  For example, environment A may have http://myServerA/FolderA/page.aspx and Environment B may have http://myServerB/FolderA/page.aspx.  So, in our name mapping, when we map the page, we map the URL as */page.aspx.

2) We have a project level variable called environment which we set at the start of our test run based upon the data we pass in via our automation framework (SQL backend contains data to indicate environment).  We set that variable to our base URL for the environment. 

3) When we have our code launch the application, we use the Browser.Run() command and pass to "Run" a code expression that concatenates the environment base URL with the primary landing page of the application.

 

The over all effect is that, by configuring our SQL properly, we can say, "Run test cases against Environment A" or "Run test cases against Environment B" and the combination of the variable, the mapping, our launch code and the data from SQL and we have a dynamic set of tests that we can run against any environment we wish.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: How I can run same test case into different test environments?

You didn't say what the difference was in your test environments, so it's hard to be specific, but here are some things that might help:

 

How to do cross-browser testing:

https://support.smartbear.com/testcomplete/docs/app-testing/web/general/cross-browser/index.html

 

How to use wildcards in testing:

https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

Highlighted
Community Hero

Re: How I can run same test case into different test environments?

We do the same... we have multiple environments for testing our one application.  What we've done is the following:

1) All NameMapping for pages "wildcard" the portion of the URL that changes between environments.  For example, environment A may have http://myServerA/FolderA/page.aspx and Environment B may have http://myServerB/FolderA/page.aspx.  So, in our name mapping, when we map the page, we map the URL as */page.aspx.

2) We have a project level variable called environment which we set at the start of our test run based upon the data we pass in via our automation framework (SQL backend contains data to indicate environment).  We set that variable to our base URL for the environment. 

3) When we have our code launch the application, we use the Browser.Run() command and pass to "Run" a code expression that concatenates the environment base URL with the primary landing page of the application.

 

The over all effect is that, by configuring our SQL properly, we can say, "Run test cases against Environment A" or "Run test cases against Environment B" and the combination of the variable, the mapping, our launch code and the data from SQL and we have a dynamic set of tests that we can run against any environment we wish.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Occasional Contributor

Re: How I can run same test case into different test environments?

Thanks a lot for your reply Robert. Does that means all pages in the application we have to name map to make them work into different environments?

For example I have below four urls

home page:https://myServerA/FolderA/page.aspx 

login page:https://myServerA/FolderA.lginaction.do

after login: https://myServerA/FolderA.profile.ftl

shopping cart: https://myServerA/FolderA.shoppingcart.do

 

From all above urls only the last part is changing after wording FolderA. The beginning stays same for all. So do I need to name map all these pages using wildcard for different environments? Again. Thanks so much for your reply.

Highlighted
Community Hero

Re: How I can run same test case into different test environments?

You only need to map them once, just make sure you wildcard the portion that changes in the URL property.  Then everything should still find what you need easily

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: How I can run same test case into different test environments?

Thanks Robert for your help. I tried it and it worked.

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors