JianJunShen
asked on
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
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
ASKER
Sorry, What about I am using Maven. Are there some Maven plugin allowing me just test one, or selected test cases?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I need more time to check...
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
http://ideoplex.com/id/25/ant-and-junit
http://pub.admc.com/howtos/junit4x/ant-chapt.html
http://ant.apache.org/manual/Tasks/junit.html