Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:43:31+00:00 2026-05-29T21:43:31+00:00

We have test classes which are built on Spring 2.0.8’s AbstractTransactionalDataSourceSpringContextTests. There are a

  • 0

We have test classes which are built on Spring 2.0.8’s AbstractTransactionalDataSourceSpringContextTests. There are a huge number of these, all of which are written in JUnit3 style.

In order to use JUnit 4 filtering, we have concocted a replacement JUnit38Runner which allows us to match these tests to a specific application environment, and filter them out accordingly.

The whole test suite runs fine outside of Ant, by using the @RunWith annotation on our custom JUnit38Runner.

When we try to run in Ant, however, it forces individual tests to run either as junit.framework.TestSuite or wrapped in a JUnit4TestAdapter, both of which ignore @RunWith annotations under JUnit4. To make matters worse, our existing suites are explicitly overridden by Ant, which calls the suite() methods directly, rather than delegating to JUnit.

I have attempted to extend from the Ant JUnitTestRunner, and simply override the run() method, however the class is simply not written for extension.

Aside from copying the whole of the JUnitTestRunner and hacking it (which will open us up to brittle code issues), has anyone had any luck with other approaches to solving this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:43:34+00:00Added an answer on May 29, 2026 at 9:43 pm

    We had a similar problem, and although it’s not as clean as running the junit task, it’s not terribly difficult to solve. We created a class with a main() that simply invokes the Junit4Runner. It adds a RunListener that attempts to write out the junit report output in XML. The idea was that the dataformat is much less likely to change than the runner, so it’s less brittle.

    I’ve stripped out a fair amount of environment-specific code, but this is the basic idea. Our test target in ant looks like this:

        <java failonerror="yes"
              fork="true"
              classname="com.mycompany.test.Junit4Runner">
            <classpath>
                <pathelement location="${basedir}/bin" />
                <pathelement path="${ProjectTest.classpath}" />
                <!-- above classpath includes junit-4.8.1.jar -->
            </classpath>
            <arg value="${test.class}" />
        </java>
    

    You can view the code for the runner class here. It doesn’t depend on anything outside Java 6 SE and Junit 4.8, and it may be compatible with Java 5 SE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some test classes that are making use of spring-batch, and hibernate. My
I am new to testing.I have to test some C# classes.Kindly let me know
If I have some php classes inside a namespace com\test and want to import
I have a test generator written in Perl. It generates tests that connect to
I have a class test which isn't standard constructable nor assignable due to certain
I have an array which I store different classes which again hold different arrays.
I have built a simple rails app with three classes that inherit from ActiveRecord
I have a question concerning visual studios built in test suite. Is VS studio
In our project, we have a class KnowledgeBaseManager, which gets used by other classes
I have a test solution (TestSolutionA) which contains a test project (TestProjectA: containing system

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.