This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

TestNG skips tests - even with no test failures.

 
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: 39392
761
Eclipse IDE VI Editor Java
  • 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: 39392
761
Eclipse IDE VI Editor Java
  • 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: 39392
761
Eclipse IDE VI Editor Java
  • 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!