It's all about the answers!

Ask a question

Got an error message "Error: Could not find or load main class -test" when running test script by Junit Selenium

Huyen Tran (1111) | asked Sep 12 '18, 10:48 p.m.

 I got an error message when running my script from RQM by JUnit Selenium type

"Error: Could not find or load main class -test

And Adapter.log file displayed error message like this:
"09:19:58,701 [main]  INFO                    - "Created JUnit Selenium Adapter"
09:20:37,538 [Thread-1] ERROR                    - Failed to read serialized JUnit report object: null  Execution result will not contain step results for individual JUnit tests."

Does anyone have experience with this error? Pls help?

2 answers

permanent link
Paul Slauenwhite (8.4k12) | answered Sep 13 '18, 7:00 a.m.

 We have seen something similar before in the past (see Error executing junit through adapter (133539)).  However, we could not reproduce the symptom.  I would suggest to open a Case ( for IBM Support to investigate this symptom in your environment.

permanent link
gerald warp (11) | answered Sep 16 '20, 2:02 a.m.

 While executing, when JVM does not find a .class file with the specified name then a run time error occurs saying “Could not found or load main class”. The reason why this happens is mostly due to:

  • Wrong Class Name
  • Invalid Classpath
Main class could not be found when there is typo or wrong syntax in the fully qualified java class name or it does not exist in the provided classpath. You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder, add . to your classpath. Note that the Windows classpath separator is a semi-colon( ;) .  If you want to execute the main() method in MainClass, you must use the full class name, including package name, in the java command.

Ralph Schoon commented Sep 16 '20, 7:46 a.m. | edited Sep 16 '20, 7:46 a.m.

In the case above it is interesting that the class name should be " -test" note the -test at the end. I think this is outdated.

Your answer

Register or to post your answer.