TestProject Forum
Powered by leading experts in the test automation community

How to integrate existing Appium(Java, TestNG) project with TestProject?

I want to integrate existing Appium(Java, TestNG, Maven) project with TestProject, how can i do it? I have found a way for Selenium(Java, TestNg)here: https://blog.testproject.io/2020/07/14/announcing-testproject-new-opensdk/ but I didn’t found any way for Appium project.

For example have a project like below, So where I have to put the the access token or other necessary things?

public class DemoTest{
    WebDriver driver;

    @BeforeTest
    public void setUpForAndroid() throws Exception{
        DesiredCapabilities dc = new DesiredCapabilities();
        dc.setCapability("platformName", "android");
        dc.setCapability("deviceName", "OnePlusOne");
        dc.setCapability("noReset", "true");
        dc.setCapability("appPackage", "com.SiemensAG.IQView");
        dc.setCapability("appActivity", "com.unity3d.player.UnityPlayerActivity");

        driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), dc);
    }

    @Test
    public void iQView() throws Exception {
        System.out.println("Script started");
    }

    @AfterTest
    public void endTest(){
        System.out.println("Script completed");
    }

Any kind of help appreciated.

Hello @al.imran, thanks for reaching out.

for integrating your Java projects with TestProject, you can use TestProject openSDK v2, which is available as a Maven dependency.

Refer to the instructions in Maven Central on how to include it in your project.
https://search.maven.org/artifact/io.testproject/java-sdk

Using a TestProject driver is exactly identical to using an Appium driver.
Changing the import statement is enough in most cases, so you can replace the driver import statement:

// import io.appium.java_client.android.AndroidDriver; <-- Replaced
import io.testproject.sdk.drivers.android.AndroidDriver;

in addition, your TestProject developer token should be initialized as the first argument in the driver’s constructor:

AndroidDriver driiver = new AndroidDriver("{TP_DEV_TOKEN}", new DesiredCapabilities());

here is where you can get your developer token from https://app.testproject.io/#/integrations/sdk

you can find more information and code examples here:
https://github.com/testproject-io/java-sdk