TestNG is like a blackbox. BUILD SUCCESS But no Tests were picked up to run. All the TestNG annotations were ignored. Sounds like TestNG problem, right ??
Probably not !
When I removed the Selenium, Appium code and leave just the empty methods and TestNG annotations, the tests are picked up just as we expected and run just fine!!
This is strange ! And makes me think that
> Selenium, Appium code preventing TestNG from running the test methods
Obviously, this could not be real.
Please help with your suggestions.
Here are the details…
I made sure and checked that
- My test class has no main method
- My test method has public qualifier
- My test method has no return parameter.
- Test annotation is from TestNG framework, not JUnit.
- test tag in xml config file has enabled=“true”
- Using TestNG version 7.11.0
- Whenever I try to give a wrong Java file path, TestNG complains that it is
not able to find it, meaning currently, it is having classpath correctly specified.
My software components are:
Operating system: Mac Sequoia 15.3.1
Appium server version: 2.15.0
Appium driver(s) and their version(s): [email protected]
Appium plugin(s) and their version(s): No plugins activated
Node.js version: v20.16.0
npm version: 10.8.1
Platform and version under test: iOS 18.3.1
Real device: Apple iPhone 11
JDK: 11.0.26
appium-java-client: 9.4.0
selenium-java client: 4.28.0
TestNG: 7.11.0
Here is the skeletal outline of my script.
package com.zq.mobile.browser.agent;
import org.testng.annotations.Test;
public class StockQuoteCreation extends Util {
@Parameters({"platform","browser","device","udid"})
@BeforeClass //>>-->TestNG annotation
public void setUp( String platform,String browser,String device,String udid) {
super.setUp(platform, browser, device, udid);
}
* @Test //>>-->TestNG annotation
public void quoteCreationAndApprovalValidations() {
createStockQuoteInfoStep();// <----
addCustomer();// <----
}
* private void createStockQuoteInfoStep(){// <----
// Create Quote menu....
}
* private void addCustomer() {// <----
// 'Add Customers'...
}
* @AfterClass //>>-->TestNG annotation
public void tearDown(){
//.....
}
}
Here is the outline of my suite configuration xml file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="zCommerce_Test_Suite" preserve-order="true" parallel="none" thread-count="1">
<test name="StockQuoteCreation_RealLocalDeviceAndroidTesting" enabled="true">
<classes>
<class name="com.zq.mobile.browser.agent.StockQuoteCreation">
<parameter name="platform" value="Android"/>
<parameter name="browser" value="Chrome"/>
<parameter name="device" value="Galaxy S21 FE 5G"/>
<parameter name="udid" value="R5CW71PYTHE"/>
<parameter name="platformVersion" value="14"/>
</class>
</classes>
</test>
</suite>
Here is my run time console output
e[1m--- e[0;32msurefire:3.5.2:teste[m e[1m(default-test)e[m @ e[36mZklmn-zCommerceQAe[0;1m ---e[m [INFO] Using auto detected provider org.apache.maven.surefire.testng.TestNGProvider [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running e[1mTestSuitee[m [INFO] e[1mTests run: e[0;1m0e[m, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.472 s -- in e[1mTestSuitee[m [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] e[1m------------------------------------------------------------------------e[m [INFO] e[1;32mBUILD SUCCESSe[m [INFO] e[1m------------------------------------------------------------------------e[m [INFO] Total time: 1.805 s [INFO] Finished at: 2025-03-01T20:40:26-06:00 [INFO] e[1m------------------------------------------------------------------------e[m