Site Loader
Auckland, New Zealand
In this post we will discuss about TestNG in general and we will try to manually create a Testng.xml file with multiple test methods to execute in appium.

TestNG

TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use
  • Annotations
  • Flexible to configure
  • Use parameters
  • Multithread support
  • Support data driven etc
We talked more about TestNG in Part 9 and Part 10 of Selenium framework design and development video series as shown You can find the complete discussion in the below video Here is the code for the above video
@BeforeClass
	public void Setup() throws MalformedURLException {

		DesiredCapabilities cap = new DesiredCapabilities();
		cap.setCapability(MobileCapabilityType.DEVICE_NAME, "donatello");
		cap.setCapability(MobileCapabilityType.APP_PACKAGE,
				"com.example.calculator");
		cap.setCapability(MobileCapabilityType.APP_ACTIVITY, "MainActivity");

		driver = new AndroidDriver(new URL(
				"http://127.0.0.1:4723/wd/hub"), cap);

	}

	@Test
	public void SimpleTest() throws BiffException, IOException {

		ExcelSheetLibrary excel = new ExcelSheetLibrary("f:\\data.xls");

		CalcAppPage calPage = new CalcAppPage(driver);

		calPage.Add(excel.ReadCell(excel.GetCell("Number1"), 1),
				excel.ReadCell(excel.GetCell("Number2"), 1));

		if (calPage.VerifyResult(excel.ReadCell(excel.GetCell("Result"), 1)))
			System.out.println("PASSED Test");
		else
			System.out.println("FAILED Test");

	}

	@Test
	public void SimpleTest2() {
		System.out.println("Im in SimpleTest2");
	}

}
Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

Leave a Reply

Your email address will not be published. Required fields are marked *