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 6697171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:25:41+00:00 2026-05-26T06:25:41+00:00

I have a custom runner that ships Junit tests over a socket connection to

  • 0

I have a custom runner that ships Junit tests over a socket connection to a Junit server running on other hardware. The tests run as intended with the following target:

    <target name="run">
        <mkdir dir="reports" />
        <junit fork="yes" haltonfailure="no">
            <test name="${CurrentTest}" />
            <formatter type="xml" />
            <classpath refid="mastersuite.classpath" />
        </junit>

        <junitreport todir="${JunitReport.dir}">
            <fileset dir=".">
                <include name="TEST-*.xml" />           
            </fileset>
            <report todir="${JunitReport.dir}" />
        </junitreport>
    </target>

However, when I add in the following <batchtest> element…

<target name="run">
    <delete dir="reports" failonerror="false" />        
    <!-- Make the reports directory -->
    <mkdir dir="reports" />

    <!-- Execute the tests and saves the results to XML -->
    <junit fork="yes" printsummary="no" haltonfailure="no">
        <batchtest fork="yes" todir="${JunitReport.dir}">
            <fileset dir="${APITesting.classes}">
                <include name="test/api/**/*Test.class" />
            </fileset>
        </batchtest>
        <formatter type="xml" />
        <classpath refid="mastersuite.classpath" />
    </junit>

    <!-- Compile the resulting XML file into an HTML based report. -->
    <junitreport todir="${JunitReport.dir}">
        <fileset dir="${JunitReport.dir}">
            <include name="TEST-*.xml" />
        </fileset>
        <report todir="${JunitReport.dir}" />
    </junitreport>
</target>

nothing gets shipped over to the hardware, which leads me to believe that my @RunWith(com.company.name.RemoteTestCaseRunner.class) annotation is not being honored within the context of <batchtest>. Is there something I am forgetting to do, or perhaps that must be done additionally for my @RunWith annotation to be called?

The tests are still being run and the reports are created, and certain tests that are not platform dependent do run and pass, just not the ones that require communication with services on the target hardware.

UPDATE I have determined that this works fine when using @RunWith(Suite.class) paired with @SuiteClasses({}), just not if I explicitly give it a test case. So now I’m really not sure where the problem lies.

UPDATE While I haven’t found anything solid on this, the behavior of my tests seem to imply the following: based on the way my tests are formatted (they extend TestCase) I think Ant is executing my test cases as Junit3 tests. As stated above, when I run a test suite formatted for Junit4 (using only annotations) my tests run and are executed as intended. It seems that when I pass the Junit3 formatted test case directly is when my annotations are not honored, which implies that the Junit3 runner is being used.

My new question is this: is there a way to explicitly tell ant to use the Junit 4 runner?

  • 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-26T06:25:42+00:00Added an answer on May 26, 2026 at 6:25 am

    It seems that Ant automatically resolves which runner to use based on if your test case uses the Junit4TestAdapter. I ended up having to add the following method to all of my test cases:

    public class MyTestCase extends TestCase
        public static junit.framework.Test suite() {
            return new JUnit4TestAdapter(MyTestCase.class);
        }
        ...
    }
    

    Most of you will probably not need to extend TestCase, but in my case this is required because Junit4 is acting as a client to a Junit3 server.

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

Sidebar

Related Questions

I have custom radar tiles that I am trying to overlay over Google Maps
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a few models that need to have custom find conditions placed on
I have custom drupal module. I receive result from a webservice that I need
I have custom SiteMapProvider and RoleProvider that works together properly: IsAccessibleToUser returns false if
I have custom code inside of a SSRS report that needs to get the
I have custom slider that I use the following touch event to respond to:
I have an httpModule that allows me to have custom urls, but direct the
I have custom groupViews that need to change state when they are expanded and
I have custom SPlist with some fields that I'd like to bind to a

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.