Score:0

how to use testng directly from bash?

mx flag

I'm not seeing why java cannot find App as it's explicitly added to the classpath:

nicholas@mordor:~$ 
nicholas@mordor:~$ java -cp /usr/share/maven-repo/org/testng/testng/debian/testng-debian.jar:/home/nicholas/NetbeansProjects/testng_gradle/src/main/java/testng_gradle/App /home/nicholas/NetBeansProjects/testng_gradle/app/src/test/java/testng_gradle/AppTest.java /home/Nicholas/NetbeansProjects/testng_gradle/test.xml
/home/nicholas/NetBeansProjects/testng_gradle/app/src/test/java/testng_gradle/AppTest.java:11: error: cannot find symbol
        App classUnderTest = new App();
        ^
  symbol:   class App
  location: class AppTest
/home/nicholas/NetBeansProjects/testng_gradle/app/src/test/java/testng_gradle/AppTest.java:11: error: cannot find symbol
        App classUnderTest = new App();
                                 ^
  symbol:   class App
  location: class AppTest
2 errors
error: compilation failed
nicholas@mordor:~$ 
nicholas@mordor:~$ tree NetBeansProjects/testng_gradle/
NetBeansProjects/testng_gradle/
├── app
│   ├── build.0
│   ├── build.gradle
│   ├── src
│   │   ├── main
│   │   │   ├── java
│   │   │   │   └── testng_gradle
│   │   │   │       └── App.java
│   │   │   └── resources
│   │   └── test
│   │       ├── java
│   │       │   └── testng_gradle
│   │       │       └── AppTest.java
│   │       └── resources
│   └── test.xml
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── test.xml

12 directories, 11 files
nicholas@mordor:~$ 
nicholas@mordor:~$ uname -a
Linux mordor 5.11.0-25-generic #27-Ubuntu SMP Fri Jul 9 23:06:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nicholas@mordor:~$ 

Ideally, would like to use bash as:

java -Dtestng.test.classpath="c:/build;c:/java/classes;" org.testng.TestNG testng.xml

but in using linux perhaps have gotten the command mixed up.

This is about the simplest testng example possible.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.