SeeTestAutomation- Parallel Execution
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
The SeeTestAutomation Executor Add-on enables SeeTestAutomation to run simultaneously on more than one device (each parallel execution requires a SeeTestAutomation license).
Notes:
- Using the Executor Add-On is possible only from a testing framework (not from SeeTestAutomation itself).
- For the Executor Add-on to work, the testing framework must support multi-threading. RFT, JUnit, C#, Python and Perl all support multi-threading. UFT (QTP) and Test Complete do not.
- Commands that are designed specifically for the Executor Add-On are:
- WaitForDevice (gives the ability to pick devices dynamically based on the device's properties).
- SeeTestAutomation- ReleaseDevice (releases the device and port and allows it to be used again in later tests).
- All possible properties which are available for a specific device can be located using the GetDeviceInformation command.
- User should have multiple ports enabled on Agent to run tests in parallel. The number of ports available will be the number of devices to run in parallel. Without it, it will not possible.
Example code snippet in Java:
Step 1: Connect 2 android devices to SeeTestAutomation.
Step 2: Create a new Java project. Create a package by the name PackageParallel.
Step 3: Integrate the Project using instructions in Exporting Code to Java (JUnit). The jars should be located on a folder by the name lib
Step 4: Duplicate this code into 2 separate tests.
//package <set your test package>;
import com.experitest.client.*;
import org.junit.*;
/**
*
*
*/
public class Test01 {
private String host = "localhost";
private int port = 8889;
protected Client client = null;
@Before
public void setUp(){
client = new Client(host, port, true);
client.setReporter("xml", "reports", "Untitled");
client.waitForDevice("@os='android'", 30000);
}
@Test
public void testUntitled(){
client.openDevice();
client.launch("com.experitest.ExperiBank/.LoginActivity", true, false);
client.elementSendText("NATIVE", "hint=Username", 0, "company");
client.elementSendText("NATIVE", "hint=Password", 0, "company");
client.verifyElementFound("NATIVE", "text=Login", 0);
if(client.waitForElement("NATIVE", "text=Login", 0, 30000)){
// If statement
}
client.click("NATIVE", "text=Login", 0, 1);
client.verifyElementFound("NATIVE", "text=Make Payment", 0);
client.click("NATIVE", "text=Logout", 0, 1);
if(client.applicationClose("")){
// If statement
}
client.closeDevice();
}
@After
public void tearDown(){
client.releaseClient("default", true, false, true);
client.generateReport(true);
}
}
Step 5: On the project create an build.xml which will enable you to run the junits in parallel.
You can use the following template of an ant file to this.
<project name="Project" default="Parallel exec">
<!-- - - - - - - - - - - - - - - - - - target: compile - - - - - - - - -
- - - - - - - - -->
<target name="compile">
<delete dir="classes" failonerror="false">
</delete>
<mkdir dir="classes" />
<path id="lib.path.ref">
<fileset dir="lib" includes="*.jar" />
</path>
<javac srcdir="src" destdir="classes" classpathref="lib.path.ref">
</javac>
<copy todir="classes">
<fileset dir="src" excludes="**/*.java" />
</copy>
</target>
<path id="tests.classpath">
<pathelement location="classes" />
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<target name="Test01">
<junit>
<formatter type="xml" usefile="true" />
<classpath refid="tests.classpath" />
<test name="PackageParallel.Test01" />
</junit>
</target>
<target name="Test02">
<junit>
<formatter type="xml" usefile="true" />
<classpath refid="tests.classpath" />
<test name="PackageParallel.Test02" />
</junit>
</target>
<target name="Parallel exec" depends="compile">
<parallel>
<antcall target="Test01">
</antcall>
<antcall target="Test02">
</antcall>
</parallel>
</target>
</project>
The part that enables you to execute the junit files in parallel is the target name 'Parallel exec'.
Step 6: Run the ant file.