This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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: 482
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
author & internet detective

Joined: May 26, 2003
Posts: 32319

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.

[OCA 8 book] [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: 482
Hmmm... Seems i have some more reading to do! Thanks Jeanne.
Consider Paul's rocket mass heater.
subject: Skipping Test Cases in Test Suites.
jQuery in Action, 3rd edition