Skip to main content

SeeTestAutomation- Java JUnit4

info

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 .

tip

You can download the Maven dependency from the Maven Repository

To export a code to Junit, you need to:

1. Get the test code in Java language

2. Integrate SeeTestAutomation and Junit

Following is a step-by-step description of how to do it.

Step 1: Export test code in Java (Junit):

Step 2: Once created a script, select ‘Code’ tab in the main window

Step 3: Then choose "Java (junit4)".

Step 4: Then click on ‘Copy to Clipboard’ icon  

The generated code has been copied to the clipboard of your system.

Step 5: Now paste the code to the JUnit testing environment you are using.

Following is an example of such an exported code:

//package <set your test package>;
import com.experitest.client.*;
import org.junit.*;

public class MyTest {
privateString host = "localhost";
private int port = 8889;
protectedClient client = null;

@Before

public void setUp(){
client = new Client(host, port);
client.setReporter("xml", "reports");
}
@Test

public void testUntitled(){
client.waitForDevice("@os='android', 30000);
}
@After

public void tearDown(){
client.generateReport(true);
}
}

Step 6: Integrate of scripts into JUnit Testing environment:

To integrate the scripts to your Java environment, you can use the built-in Java client of SeeTestAutomation. The client is composed of several jars under the client folder in your installation directory (..../Client/Java)

Following is the list of the jars which are required for the integration:

  • imageClient.jar
  • xmlrpc-client-3.1.2.jar
  • xmlrpc-common-3.1.2.jar
  • ws-common-util-1.0.2.jar
  • junit.jar (optional for junit users)

 If you are using eclipse your Java build path should look as follows: