• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Junit 4

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a web application using:

Spring 2.0
Hibernate 3
And JUnit 3

Some of the existing Unit tests extend the Spring helper class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests to assit.

I want to update to JUnit 4, Its pretty simple to update most basic test classes, but when I try to update the ones which extend AbstractTransactionalDataSourceSpringContextTests I get the exception:



I don't see why this should be a problem so long as I called the setUp() and tearDown() methods from my annotated @Before and @After methods to complete the configuration of the parent class.

Can anyone tell me why this might be happening, or if I'm barking up the wrong tree in trying to update to JUnit 4 without relevent support being added to the class I am trying to extend.

Thank you
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rich,
Is AbstractTransactionalDataSourceSpringContextTests a JUnit 3.8 test case? In other words, does it extend Testcase? If so, you need to use the JUnit 3.8 style test for this test. (setUp vs @Before etc)

You can still write other test classes using JUnit 4. If you use a test runner that supports it, like cpsuite, both your JUnit 3.8 and 4 tests will be run in one shot.
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic