How do I execute my test with an environment specific URL?

Posted 4 months ago by Clark

Post a topic
Answered
Clark Bent
Clark

We have several different environments that we want to run tests against.  I want to run the same Alchemy tests on all the environments or deployments of the app.  Is there a way I can configure my tests to do that?  Also, in my Devops pipeline how would I design the command-line to execute against each specific environment?

0 Votes

Mason Lopez

Mason posted 4 months ago Best Answer

In the Alchemy Desktop client where you develop your test, go to the "Configurations" tab.  There you'll see a single environment variable called "url".  The variable can have different values based on the environment names to the right.  The user can add or delete environments there, and give them different values.  Addtionally, the user can also add other environment specific varibles other than "url", if desired.  The url given during suite creation will be in the "Default" environment.  That's the one that will be used for recording, developing,executing the script from the Alchemy Desktop Client.


Now, for using the specific Environment Names during command-line executions use the "-e" command-line option.  For example:

java -jar MyTestSuite.jar -e Staging


This will run the test suite using the "url" environment variable value that the user placed in the "Staging" environment slot prior to building the suite executable jar.

Configurations tab

2 Votes


2 Comments

Sorted by
T

TheBugScout posted 2 months ago


If you want to execute your test with an environment-specific URL, the first thing you need to do is ensure that your test does not have a hardcoded URL value in the navigate action. Instead, you need to replace that URL value with a URL variable from the configuration section.


What is the configuration section.   

In the configuration section, you can create different environments as needed and define properties for each environment. Your environments could include a testing environment, development environment, production environment, staging environment, etc. You can create as many environments as needed and set the required properties for each one.


For example, if you have created different environments with different URLs and you want to configure your test with an environment-specific URL, you need to remove the hardcoded URL value from the navigate action and replace it with the URL variable.


To do this:

  1. Open the test and remove the hardcoded URL value from the navigate action.
  2. Open the data toolbox for that test by clicking the data toolbox toggle.
  3. Drag the URL variable from the Environment Variables section and drop it into the "navigate" action. Alternatively, you can copy the pointer for that URL variable and paste it directly into the "navigate" action.

Once you have done this, half of your work is complete. Now, you can run your test on the required environment by simply selecting the desired configuration in the "Current Configuration" dropdown. However, note that setting the environment value in the "Current Configuration" dropdown will only execute the test in that environment within the Alchemy UI itself. This does not mean that if you generate the executable and run it through the command prompt using the java -jar "suitename.jar" command, it will execute your suite on that environment.


If you want your suite to execute on a specific environment during command-line execution, you need to switch the environment using the command java -jar "suitename.jar" -e Staging. This will execute your suite in the staging environment during command-line execution. Otherwise, simply executing the suite with the command java -jar "suitename.jar" will run your suite on the default URL specified during recording.

 



Thanks!

0 Votes

Mason Lopez

Mason posted 4 months ago Answer

In the Alchemy Desktop client where you develop your test, go to the "Configurations" tab.  There you'll see a single environment variable called "url".  The variable can have different values based on the environment names to the right.  The user can add or delete environments there, and give them different values.  Addtionally, the user can also add other environment specific varibles other than "url", if desired.  The url given during suite creation will be in the "Default" environment.  That's the one that will be used for recording, developing,executing the script from the Alchemy Desktop Client.


Now, for using the specific Environment Names during command-line executions use the "-e" command-line option.  For example:

java -jar MyTestSuite.jar -e Staging


This will run the test suite using the "url" environment variable value that the user placed in the "Staging" environment slot prior to building the suite executable jar.

Configurations tab

2 Votes

Login or Sign up to post a comment

© Orasi Software, Inc. | All Rights Reserved.