# Is Selenium, Appium code preventing TestNG from running the test methods?

**URL:** <https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545>\
**Category:** Issues/Bugs\
**Created:** [March 2, 2025, 3:39am UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545 "2025-03-02T03:39:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pnutalapati](https://discuss.appium.io/user_avatar/discuss.appium.io/pnutalapati/32/13541_2.png) [@pnutalapati](https://discuss.appium.io/u/pnutalapati)\
**Post date:** [March 2, 2025, 3:39am UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/1 "2025-03-02T03:39:43Z")

</div>

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**

1. My test class has **no main method**
2. My test method has **public qualifier**
3. My test method has **no return parameter.**
4. Test annotation is from **TestNG** framework, **not JUnit**.
5. test tag in xml config file has **enabled=“true”**
6. Using TestNG version 7.11.0
7. 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):_ _ **xcuitest@7.35.1** _

_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.**

```auto
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**

```auto
<?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`

```auto

```

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [March 3, 2025, 9:12am UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/2 "2025-03-03T09:12:05Z")

</div>

1 try add `(alwaysRun = true)`

```auto
@Parameters({"platform","browser","device","udid"})
@BeforeClass(alwaysRun = true)
public void setUp( String platform,String browser,String device,String udid) {
  super.setUp(platform, browser, device, udid);
}

```

2 add logs right after all your `beforeX` and `afterX` so you can see if they actually started

```auto
@Parameters({"platform","browser","device","udid"})
@BeforeClass(alwaysRun = true)
public void setUp( String platform,String browser,String device,String udid) {
  Systme.out.println("BeforeClass: setUp")
  super.setUp(platform, browser, device, udid);
}

```

---

<div class="post-metadata">

**Author:** ![pnutalapati](https://discuss.appium.io/user_avatar/discuss.appium.io/pnutalapati/32/13541_2.png) [@pnutalapati](https://discuss.appium.io/u/pnutalapati)\
**Post date:** [March 3, 2025, 3:02pm UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/3 "2025-03-03T15:02:12Z")

</div>

> [@Aleksei](#):
>
> (alwaysRun = true)

Thanks @Aleksei for your kind response.  
After inserting `System.out.println("<Some console msg...>")` and `(alwaysRun = true)` next to **@BeforeClass** and **@AfterClass annotations** , running the script class as Maven Verify or test, I got none of the console output messages but just the usual output like…

 ![image_2025-03-03_090206095](https://discuss.appium.io/uploads/default/original/2X/0/0ca048095da64f8735c01523fa06bb811f3aa5ea.png)

I tried debugging by inserting the breakpoints, but none were hit and program simply flowed with out hitting them.

Bottom line, no **System.out.println(“msg”)** or **breakpoints** were effective ! Meaning TestNG is silently exiting the code ???

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [March 3, 2025, 8:27pm UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/4 "2025-03-03T20:27:33Z")

</div>

How you run the project or xml file? Try with command line also…

---

<div class="post-metadata">

**Author:** ![sbabcoc](https://discuss.appium.io/user_avatar/discuss.appium.io/sbabcoc/32/8437_2.png) [@sbabcoc](https://discuss.appium.io/u/sbabcoc)\
**Post date:** [March 3, 2025, 11:06pm UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/5 "2025-03-03T23:06:26Z")

</div>

What is the name of the test class? Depending on how you run your tests, the class name may be tripping you up.

[https://chatgpt.com/c/67c63580-8fd8-8011-acf3-ca65b7ab0e37](https://chatgpt.com/c/67c63580-8fd8-8011-acf3-ca65b7ab0e37)

---

<div class="post-metadata">

**Author:** ![pnutalapati](https://discuss.appium.io/user_avatar/discuss.appium.io/pnutalapati/32/13541_2.png) [@pnutalapati](https://discuss.appium.io/u/pnutalapati)\
**Post date:** [March 4, 2025, 2:56am UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/6 "2025-03-04T02:56:23Z")

</div>

@Aleksei  
I ran the test class with testSuite xml file(supplying the TestNG parameters) from the command prompt and attached is the output on the terminal. Essentially the same status.

[maven\_command\_run\_console\_output.txt](https://discuss.appium.io/uploads/short-url/72CGxVgjlL5gdape0yyEbpLXnza.txt) (7.6 KB)

If I believe mismatch in terms of selenium dependencies is causing this issue, I matched Selenium-java client v.4.28 with Appium-java client v9.4.0 as mentioned in the [compatibility](https://github.com/appium/java-client?tab=readme-ov-file#compatibility-matrix) matrix.

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [March 4, 2025, 8:51am UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/7 "2025-03-04T08:51:25Z")

</div>

Maybe you can share your project? Just remove any sensitive part so everyone can see a bit more and suggest solution…

---

<div class="post-metadata">

**Author:** ![pnutalapati](https://discuss.appium.io/user_avatar/discuss.appium.io/pnutalapati/32/13541_2.png) [@pnutalapati](https://discuss.appium.io/u/pnutalapati)\
**Post date:** [March 4, 2025, 2:43pm UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/8 "2025-03-04T14:43:31Z")

</div>

@Aleksei and @sbabcoc  
Following the suggestion that `Selenium dependency is no more required because Appium java client already has it added as a transitive dependency and it will always be compatible.`

After removing the dependency to **selenium-java v.4.28,** the program flow is recognizing the TestNG annotations and running OK.

Wow ! What a roller coaster ride on. this issue … for one week.  
Thanks all for your kind help !

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [March 4, 2025, 5:16pm UTC](https://discuss.appium.io/t/is-selenium-appium-code-preventing-testng-from-running-the-test-methods/45545/9 "2025-03-04T17:16:55Z")

</div>

W.o.w i.n.d.e.e.d. - need to try also!

Checked mine **selenium-java v.4.28** →

```auto
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.9.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <!-- need java-client increase
            https://github.com/appium/java-client?tab=readme-ov-file#compatibility-matrix
            -->
            <version>4.28.0</version>
        </dependency>

        <!-- https://github.com/appium/java-client/issues/2247#issuecomment-2523527428 -->
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>1.16.1</version>
        </dependency>

        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>9.4.0</version>
        </dependency>

```

zero issues…
