I'm having trouble using my testNG suite in the Jenkins of my company. Here is the set up :
-Jenkins is installed on a Linux machine so I have to create a .sh which launch my tests.
-I code my tests under Windows, on Eclipse in Java.
-I have to use relative path in my project.
-I use my file blex_test_v1.xml to launch my tests.
I did write a batch script, it works fine without problem :
I now try to "convert" it into a .sh so this is what I have for the moment :
The problem is that I always get this error :
"Error Could not find or load main class org.testng.TestNG"
There is about 6 or 7 posts on StackOverflow about this problem, I've read all of them, trying to change my code, rewrite it, I even uninstall all .jar files and reinstall them in my lib ... Can't see where is the problem coming from.
It can't be from the plug-in, jar files, main Class (I don't have any), my different paths or org.testng.TestNG because my .bat is working with the same meta or maybe it is different in bash script ?
For the moment I don't use Jenkins, I first try to make a runnable script and I'm reeeeally stuck here ... What am I doing wrong ?
PS : Here is the architecture of my project (admire my artist skills) :
EDIT: I don't use maven nor ant nor gradle, just Java in eclipse with testNG and reportNG plug-in
EDIT 2 : I used this answer to make my bash this guy says it is working fine, but it is not for me, even if I code it with ./ (still the same error as above):
java -cp ./blex_test_v1/lib/*:./blex_test_v1/bin org.testng.TestNG ./blex_test_v1/blex_test_v1.xml
java org.testng.TestNG blex_test_v1/blex_test_v1.xml
After a couple of days I finally solved the problem by making a main class in my Java project calling the XML file, then create an executable jar of my project and in the end create a bash script calling this jar.
The code of my .sh is here (quite simple) :
java -jar Exec.jar