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

  • Home
  • SEARCH
  • 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 6380125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:13:37+00:00 2026-05-25T02:13:37+00:00

I was running Selenium unit tests in TestNG with the Ant Java task like

  • 0

I was running Selenium unit tests in TestNG with the Ant Java task like so:

<java classpathref="runtime.classpath"
    classname="org.testng.TestNG"
    failonerror="false">
    <arg value="-d" />
    <arg value="${grid.location}/target/reports" />
    <arg value="${lib.location}/testng.xml"/>   
</java>

runtime.classpath is a pathlike structure that included <pathelement path="${basedir}/target/classes/" />, which I thought was needed to let TestNG know which classes to run.

<path id="runtime.classpath">
        ...
        <!-- Target classes -->
        <pathelement path="${basedir}/target/classes/" />
</path>

However, I kept seeing in the log that TestNG found 0 applicable classes.

I eventually got some help from a colleague and it appears this was the key change:

<path id="runtime.classpath">
        ...
        <!-- path attribute changed to location -->
        <pathelement location="${basedir}/target/classes/" />
</path>

This also pulls in the test classes correctly:

   <java classpathref="runtime.classpath"
       classname="org.testng.TestNG"
       failonerror="false">
       <arg value="-d" />
       <arg value="${grid.location}/target/reports" />
       <arg value="${lib.location}/testng.xml"/>
       <classpath>
           <pathelement location="${basedir}/target/classes/" />
       </classpath> 
   </java>

What is the difference between the path and location attributes? I’ve looked at Writing a Simple Buildfile (specifically the Path-like Structures section), but in that manual it looks to me like location is more specific than path. That doesn’t appear to be the case empirically, but I can’t quite figure out why.

  • 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-25T02:13:38+00:00Added an answer on May 25, 2026 at 2:13 am

    It looks like the difference between path and location is many entries vs one. A location is a file or directory, a path can be a list.

    From the manual

    The location attribute specifies a single file or directory relative
    to the project’s base directory (or an absolute filename), while the
    path attribute accepts colon- or semicolon-separated lists of
    locations. The path attribute is intended to be used with predefined
    paths – in any other case, multiple elements with location attributes
    should be preferred.

    Note that the JVM used by ant has just about no relation to the JVM used by the java task. By default the environment of ant isn’t the same as that of things started with the java task via ant. This is actually helpful when you want to use a different JVM from the one ant wants to use and makes things explicit, helping avoid surprises later on.

    Check out the docs for the java task, particularly clonevm

    clonevm: If set to true, then all system properties and the
    bootclasspath of the forked Java Virtual Machine will be the same as
    those of the Java VM running Ant. Default is “false” (ignored if fork
    is disabled). since Ant 1.7

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

Sidebar

Related Questions

I am running some tests on Selenium Web Driver. But looks like that I
We are running Selenium regression tests against our existing code base, and certain screens
I'm running Selenium tests from within Eclipse, but I can't load a custom Firefox
I'm working on a project using Scala running Selenium tests as part of a
I am am running some selenium tests(ruby) on my web page and as i
I am using PHPUnit 3.4.12 to drive my selenium tests. I'd like to be
I've got several unit tests written with NUnit that are calling selenium commands. I've
I'm running Selenium with TestNG using Eclipse and Selenium RC. I used the command:
I've been running my selenium tests using selenium rc for about 6 months and
I am running regression tests with Selenium and am automatically launching instances of Firefox.

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.