• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

TestNG skips tests - even with no test failures.  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the following testNG xml file, I notice that not only the first test of each class is executed AND the @AfterClass method is not executed. After the first test finishes execution, the @BeoreClass of the next test-class is executed.

The execution fails because the @AfterClass method is supposed to clean-up after all tests in the class are executed.  Also, in the test code, I am using @Test(priority=<number>, alwaysRun = true)

Here's the xml file.

 
Sammy Patel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone???
 
author & internet detective
Posts: 38917
686
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sammy,
More people use JUnit than TestNG. And this is a really specific question. I wouldn't be surprised if nobody knows.
 
Sammy Patel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, this is a basic question - why @AfterClass method is not getting executed.  I am not sure about no TestNG user having run into this situation
 
Jeanne Boyarsky
author & internet detective
Posts: 38917
686
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought you were saying that @AfterClass wasn't getting executed in a specific circumstance. If that isn't the case, can you be more specific.

Can you narrow the scenario down so it only has two test classes and post them here?
 
Sammy Patel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

Sorry, if my comments are confusing.  At this point, even I am confused!

Here's the situation:
- The tests are launched
- First test of the first class is executed
- The rest of the tests are skipped
- Control goes on to run the tests of the next class - but in between, the @AfterClass of the previous test class is not executed

So, as I see, there are two issues:
  1.  Why is only the first test of each test class is executed (i.e. the rest of the tests are skipped - not even attempted to be executed)
  2.  Why is @AfterClass method of each test class is not exevuted

Hope this helps....

Regards.
 
Jeanne Boyarsky
author & internet detective
Posts: 38917
686
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sammy,
A general troubleshooting approach is to make the problem smaller. Can you reproduce it with a project that only has two simple tests and no dependencies? And post them here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!