Introduction
One of the obvious problems when testing some product is to be able to do something on some remote host.
You run your test from your Test Executor host, but you need to do something on another host.
The ATS Agent can be used to achieve this.
Test code example
Lets first look at the following test code:
import org.apache.log4j.Logger; import org.testng.annotations.Test; import com.axway.myproduct.actions.clients.SimpleAction; public class SimpleRemoteTests { private static final Logger log = Logger.getLogger( SimpleRemoteTests.class ); @Test public void remoteCall() throws Exception { // create an instance of your action class by providing the remote Agent address SimpleAction simpleAction = new SimpleAction( AGENT_ADDRESS ); // run your action on the remote host, this one returns some result String result = simpleAction.sayHi( "Professional Tester", 20 ); log.info( "The remote ATS agent answered with: " + result ); } }
This is a regular test which runs some action(called sayHi ) on a remote ATS Agent(located at AGENT_ADDRESS ).
The action can accept input data and return result - just as every regular java method. The big deal is that you can run it remotely.
Test explorer result
Here are some logs seen on Test Explorer:
You can see there are messages logged on Test Executor side as well as on Agent side.
Session data
ATS Agent actions are simple java classes. The Agent will maintain same instance for you all the time. This means if you have some private data members, you can use them as in regular java classes.
This way you can call many times one or more actions from same class and they can save/use those private data members.
Example: In order to make some configuration on the remote host you need to pass many parameters. Instead of using just one huge action with many parameters, you can create a few, each one of them will make some changes to the private data members, and finally you will call the last action(maybe called finish or commit) which will benefit from the ready to use data and complete the work.
Back to parent page
Go to Table of Contents