Invoke a JUnit test case

I am using Junit 4.

Target:

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.

Problem:
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.

Juhani

 
JianJunShenAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
then you would just run it with org.junit.runner.JUnitCore
0
 
objectsCommented:
you can also use org.junit.runner.JUnitCore
http://junit.sourceforge.net/doc/cookbook/cookbook.htm
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
JianJunShenAuthor Commented:
Sorry, What about I am using Maven. Are there some Maven plugin allowing me just test one, or selected test cases?
0
 
JianJunShenAuthor Commented:
What about I just want to test one java file. For example, performTest.java. In which, there are a couple of test I want and I only want to run this java file for one particular purpose.
0
 
JianJunShenAuthor Commented:
I need more time to check...
0
 
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.
0
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.