lundi 8 mai 2017

Appium Parallel Execution + TestNG Framework issue

I Just started creating a framework for appium. I am facing challenges when i am trying to create driver.

It starts as follows

Step 1: Based on the thread count and devices i will be creating appium servers at runtime in TestNG's @Beforesuite.

    cap.setCapability("noReset", "false");
    cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Dev1");
    cap.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
    cap.setCapability(MobileCapabilityType.UDID, udid);
    //Build the Appium service
    builder = new AppiumServiceBuilder();
    builder.withIPAddress("127.0.0.1");
    builder.usingAnyFreePort();
    builder.withCapabilities(cap);
    builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
    builder.withArgument(GeneralServerFlag.LOG_LEVEL, "error");

    appiumservice = AppiumDriverLocalService.buildService(builder);
    appiumservice.start();

Step 2: I will get the appium server url's for all devices connected using

appiumservice.getUrl().toString()

Now i have all server url's and Capabilities.

The question is now in TestNG.xml if i give Parallel and thread-count to 3 how can i set create a AndroidDriver object in @BeforeMethod in such a way each time it should take different appium server url and execute the tests ? How should my @Beforemethod and @Aftermethod ?

Thanks

Aucun commentaire:

Enregistrer un commentaire