File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes Skipping Test Cases in Test Suites. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Skipping Test Cases in Test Suites." Watch "Skipping Test Cases in Test Suites." New topic

Skipping Test Cases in Test Suites.

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hello Everyone,

I have run into a problem while writing JUnit test cases for an automation project i have been handed over for a few weeks. Will try to give you as much details as possible, if i miss anything let me know. Here goes:

1. The testing involves 6 test suites each test suite has around 8 test cases.
2. The test suites are executed via ant.

The Junit test cases mostly include Selenium to automate web browser validations.

The issue i am facing is:

When one of the major validations in one of the test case fails, lets say in the 4th test case, it should stop executing the remaining of the test suite and skip over to the next test suite. Is there any way of achieving this?

Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30116

Not easily. JUnit is designed to run all your tests. I think you would need to write a custom runner to do what you want.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hmmm... Seems i have some more reading to do! Thanks Jeanne.
I agree. Here's the link:
subject: Skipping Test Cases in Test Suites.
Similar Threads
JUnit 4 sampler for JMeter
Test Case generation tools required
using Test suite
How does surefire work
JUnit - List of test methods through TestRunner