Invoke a JUnit test case

I am using Junit 4.


I have many JUnit test cases. In GUI, of course, I know how to run it. And see the result. The trace information is written into a log file. Then I collect data in the excel.

Now I want above process totally automated. I want to write a main function, in this main function, I invoke selected test case, and trace information is recorded into log and I collect data and write to excel. I know how to collect data from log and then write to excel. But I am wondering how to invoke selected test cases in my main class. Does JUnit provide some API so that I could run test case easily instead of using reflection.


Who is Participating?
objectsConnect With a Mentor Commented:
then you would just run it with org.junit.runner.JUnitCore
you can also use org.junit.runner.JUnitCore
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

JianJunShenAuthor Commented:
Sorry, What about I am using Maven. Are there some Maven plugin allowing me just test one, or selected test cases?
JianJunShenAuthor Commented:
What about I just want to test one java file. For example, In which, there are a couple of test I want and I only want to run this java file for one particular purpose.
JianJunShenAuthor Commented:
I need more time to check...
Kevin CrossChief Technology OfficerCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.