Solved

Invoke a JUnit test case

Posted on 2011-02-16
9
497 Views
Last Modified: 2012-08-14
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

 
0
Comment
Question by:JianJunShen
  • 4
  • 3
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34913834
0
 
LVL 92

Expert Comment

by:objects
ID: 34913839
you can also use org.junit.runner.JUnitCore
http://junit.sourceforge.net/doc/cookbook/cookbook.htm
0
 

Author Comment

by:JianJunShen
ID: 34938566
Sorry, What about I am using Maven. Are there some Maven plugin allowing me just test one, or selected test cases?
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 34938808
0
 

Author Comment

by:JianJunShen
ID: 35059904
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
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 35061740
then you would just run it with org.junit.runner.JUnitCore
0
 

Author Comment

by:JianJunShen
ID: 35112413
I need more time to check...
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 37514372
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
even odd program using while loop 3 60
Opening PDF on button click and fill new document 2 47
check java version using powershell 13 184
What browser will run Java? 7 72
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question