- Views: 4
- Report Article
- Articles
- Computers
- Software
Integration of TestNG project with pCloudy platform
Posted: Aug 10, 2017
TestNG is a testing framework inspired from JUnit and NUnit but introducing new functionalities that make it more powerful and easier to use. It is an open source automated testing framework; where NG of TestNG means Next Generation. TestNG is similar to JUnit, especially when testing integrated classes.
TestNG eliminates most of the limitations of the older framework and gives the developer the ability to write more flexible and powerful tests with help of easy annotations, grouping, sequencing & parameterizing.
Benefits of TestNGThere are number of benefits but from Selenium perspective, major advantages of TestNG are:
- 1. It gives the ability to produce HTML Reports of execution
- 2. Annotations made testers life easy
- 3. Test cases can be Grouped & Prioritized more easily
- 4. Parallel testing is possible
- 5. Generates Logs
- 6. Data Parameterization is possible
pCloudy
pCloudy platform provides single click access to real Android and IOS devices directly from your browser. Use these real Mobile Devices to click-and-perform Manual Testing and execution of Automation Testing for your App. Integrate our platform with CI for continuous Automation Testing and test your App on multiple real Mobile Devices with every change of your App.
Now it’s very much simple to integrate your existing TestNG project with pCloudy.
Architecture of the TestNG framework with pCloudy
Prerequisite to integrate framework:
- TestNG Project or Download sample framework code Steps to integrate:
- Add pCloudy connector jar in your existing project
- Add Controller class in existing project
- Add DeviceContext class in existing project
- Add a list, which contains the classes that you want to run, pCloudy username, pCloudy API key & application path in Controller class.
- contains public static void main methods.
- helps to create dynamic testng.xml file with selected device test.
- runs testing.xml as testng target.
Controller class
5. In TestNg class, add code to launch appium under @BeforeClass, @BeforeMethod annotation according to your project:
@Parameters({ "myDeviceContext" })
@BeforeClass
public void beforeClass(String myDeviceContext) throwsConnectError, IOException, InterruptedException {
DeviceContext myContext = Controller.allDeviceContexts.get(myDeviceContext);
try {
myContext.driver = newAndroidDriver(myContext.endpoint, myContext.capabilities);
} catch (Exception ex) {
ex.printStackTrace();
}
}
6. In TestNG class, add code to quit driver under @AfterClass, @AfterMethod annotation according to your project:
@Parameters({ "myDeviceContext" })
@AfterClass
public void afterClass(String myDeviceContext) throws ConnectError, IOException {
DeviceContext myContext = Controller.allDeviceContexts.get(myDeviceContext);
myContext.driver.quit();
}
7. In TestNG class, add code to close pCloudy appium under @AfterTest annotation according to your project:
@Parameters({ "myDeviceContext" })
@AfterTest
public void afterTest(String myDeviceContext) {
DeviceContext myContext = Controller.allDeviceContexts.get(myDeviceContext);
try {
myContext.pCloudySession.releaseSessionNow();
} catch (ConnectError | IOException e) {
e.printStackTrace();
}
}
Sign Up for Free Trial to test your apps on Real Android and iOS Devices Click Here.
PCloudy is the most powerful cloud based App Testing Platform. It has the the most comprehensive set of Mobile Devices and Tools to Improve Quality of your App.