Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

TestRails Integration With Jenkins - Can't Run TestRail APIClient java file because no main method


#1

I wrote a TestRails.java class with a main method that uses TestRails JAVA API Binding classes to create a TestRails testrun and populate the test results after my Appium automation test finish running on Jenkins. I’m trying to compile and run it in the Jenkins build shell section. Is this not the way I’m suppose to integrate Jenkins with TestRails? I’m new to coding and this is first time writing code to interact with an api. I appreciate advice from other more experienced coders and testers.

I’m getting main method not found when running TestRails java file with a main method in command line that depends on TestRails Java API Binding classes without a main method. How do I fix this? I can’t change APIClient.java and APIException.java since those are not suppose to have a main methods.

java -cp ../../../ com.gurock.testrail.APIClient -cp ../../../ com.gurock.testrail.APIException -cp ../../../ com.gurock.testrail.TestRails BeforeRun /Users/abc/.jenkins/workspace/IOSPredeploy/AppiumTest/src/test/java/com/gurock/testrail/input_test_rail.xml 20190314

Error: Main method not found in class com.gurock.testrail.APIClient, please define the main method as: public static void main(String args) or a JavaFX application class must extend javafx.application.Application


#2

I think you will have more luck asking on stackoverflow’s java section than here seeing that you need help debugging you code. :slightly_smiling_face:

Also, I think you can see what’s wrong with your class from the error.

Main method not found in class


#3

Hi Angee,

Thanks for the post! Based on your more recent post here, I assume you got this one figured out and are able to make some API requests.

Thanks,
Jon


#4

Thanks. I was able to figured out how to proceed, but facing a new error now that I posted in a new question.