[ant] Problem with space in directory name

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[ant] Problem with space in directory name

Didier BRETIN

Hello,

I'm testing TestNg with Eclipse 3.1 under XP.

Here is my ant file:
<project default="test">

   <path id="cp">
     <pathelement location="lib/testng-5.3-jdk15.jar"/>
     <pathelement location="bin"/>
   </path>

   <taskdef name="testng" classpathref="cp"
            classname="org.testng.TestNGAntTask" />

   <target name="test">
     <testng classpathref="cp" groups="fast">
       <classfileset dir="bin" includes="example1/*.class"/>
     </testng>
   </target>

</project>

And here is the error when I launch ant:
Buildfile: C:\Documents and Settings\utilisateur1\Mes documents\Projets
Eclipse\TestNg\build.xml
test:
    [testng] Exception in thread "main" org.testng.TestNGException:
    [testng] Cannot load class from file: C:\Documents
    [testng] at
org.testng.TestNGCommandLineArgs.fileToClass(TestNGCommandLineArgs.java:595)
    [testng] at
org.testng.TestNGCommandLineArgs.parseCommandLine(TestNGCommandLineArgs.java:206)
    [testng] at org.testng.TestNG.privateMain(TestNG.java:1012)
    [testng] at org.testng.TestNG.main(TestNG.java:999)
BUILD SUCCESSFUL
Total time: 1 second


Apparently there is a problem with a space in the name of the directory.
I use ant for other projects in the same configuration and I have no
problem with space in directories names.

How can I solve this issue ?

Regards.
--
Didier BRETIN
http://www.bretin.net/

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Steve Loughran-7

On 07/12/06, Didier BRETIN <[hidden email]> wrote:

>
> Hello,
>
> I'm testing TestNg with Eclipse 3.1 under XP.
>
> Here is my ant file:
> <project default="test">
>
>    <path id="cp">
>      <pathelement location="lib/testng-5.3-jdk15.jar"/>
>      <pathelement location="bin"/>
>    </path>
>
>    <taskdef name="testng" classpathref="cp"
>             classname="org.testng.TestNGAntTask" />
>
>    <target name="test">
>      <testng classpathref="cp" groups="fast">
>        <classfileset dir="bin" includes="example1/*.class"/>
>      </testng>
>    </target>
>
> </project>
>
> And here is the error when I launch ant:
> Buildfile: C:\Documents and Settings\utilisateur1\Mes documents\Projets
> Eclipse\TestNg\build.xml
> test:
>     [testng] Exception in thread "main" org.testng.TestNGException:
>     [testng] Cannot load class from file: C:\Documents
>     [testng] at
> org.testng.TestNGCommandLineArgs.fileToClass(TestNGCommandLineArgs.java:595)
>     [testng] at
> org.testng.TestNGCommandLineArgs.parseCommandLine(TestNGCommandLineArgs.java:206)
>     [testng] at org.testng.TestNG.privateMain(TestNG.java:1012)
>     [testng] at org.testng.TestNG.main(TestNG.java:999)
> BUILD SUCCESSFUL
> Total time: 1 second
>
>
> Apparently there is a problem with a space in the name of the directory.
> I use ant for other projects in the same configuration and I have no
> problem with space in directories names.

It sounds suspiciously like TestNG is filling in the command line args
for java through java.createArg().setLine(), rather than filling in
each argument one by one through a series of
java.createArg().setValue() calls. Ant cracks up the command line by
the spaces and hands the wrong thing down to the executable. It doesnt
show up normally because most people dont put spaces in their paths,
having learned that some tools hate it.

There's probably not a lot you can do except file a bugrep, ideally
with patch and possibly an <antunit> test case.

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Alexandru Popescu ☀

Didier can you please use the dumpCommand Ant attribute set to true
and send us the output?

TIA,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/7/06, Steve Loughran <[hidden email]> wrote:

>
> On 07/12/06, Didier BRETIN <[hidden email]> wrote:
> >
> > Hello,
> >
> > I'm testing TestNg with Eclipse 3.1 under XP.
> >
> > Here is my ant file:
> > <project default="test">
> >
> >    <path id="cp">
> >      <pathelement location="lib/testng-5.3-jdk15.jar"/>
> >      <pathelement location="bin"/>
> >    </path>
> >
> >    <taskdef name="testng" classpathref="cp"
> >             classname="org.testng.TestNGAntTask" />
> >
> >    <target name="test">
> >      <testng classpathref="cp" groups="fast">
> >        <classfileset dir="bin" includes="example1/*.class"/>
> >      </testng>
> >    </target>
> >
> > </project>
> >
> > And here is the error when I launch ant:
> > Buildfile: C:\Documents and Settings\utilisateur1\Mes documents\Projets
> > Eclipse\TestNg\build.xml
> > test:
> >     [testng] Exception in thread "main" org.testng.TestNGException:
> >     [testng] Cannot load class from file: C:\Documents
> >     [testng] at
> > org.testng.TestNGCommandLineArgs.fileToClass(TestNGCommandLineArgs.java:595)
> >     [testng] at
> > org.testng.TestNGCommandLineArgs.parseCommandLine(TestNGCommandLineArgs.java:206)
> >     [testng] at org.testng.TestNG.privateMain(TestNG.java:1012)
> >     [testng] at org.testng.TestNG.main(TestNG.java:999)
> > BUILD SUCCESSFUL
> > Total time: 1 second
> >
> >
> > Apparently there is a problem with a space in the name of the directory.
> > I use ant for other projects in the same configuration and I have no
> > problem with space in directories names.
>
> It sounds suspiciously like TestNG is filling in the command line args
> for java through java.createArg().setLine(), rather than filling in
> each argument one by one through a series of
> java.createArg().setValue() calls. Ant cracks up the command line by
> the spaces and hands the wrong thing down to the executable. It doesnt
> show up normally because most people dont put spaces in their paths,
> having learned that some tools hate it.
>
> There's probably not a lot you can do except file a bugrep, ideally
> with patch and possibly an <antunit> test case.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Didier BRETIN

Alexandru Popescu wrote :
> Didier can you please use the dumpCommand Ant attribute set to true
> and send us the output?

Sure, here it is:
Buildfile: C:\Documents and Settings\utilisateur1\Mes documents\Projets
Eclipse\TestNg\build.xml
test:
    [testng] [TestNGAntTask] TESTNG PASSED
@C:\DOCUME~1\dbretin\LOCALS~1\Temp\testng671 WHICH CONTAINS:
    [testng] [TestNGAntTask] -groups fast -testclass ""C:\Documents and
Settings\utilisateur1\Mes documents\Projets
Eclipse\TestNg\bin\example1\SimpleTest.class"" -suitename "Ant suite"
-testname "Ant test"
    [testng] Exception in thread "main" org.testng.TestNGException:
    [testng] Cannot load class from file: C:\Documents
    [testng] at
org.testng.TestNGCommandLineArgs.fileToClass(TestNGCommandLineArgs.java:595)
    [testng] at
org.testng.TestNGCommandLineArgs.parseCommandLine(TestNGCommandLineArgs.java:206)
    [testng] at org.testng.TestNG.privateMain(TestNG.java:1012)
    [testng] at org.testng.TestNG.main(TestNG.java:999)
BUILD SUCCESSFUL
Total time: 1 second

For continue my tests with TestNg, I move my eclipse and my projects to
directories with no space and there it works. But if we can find a
solution to this issue it will be great too.

Regards.
--
Didier BRETIN
http://www.bretin.net/

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Alexandru Popescu ☀

Seems there is some double double quoting there that breaks it. I will
try to reproduce the problem, but I would really appreciate if you can
send out the relevant pieces from your Ant build.xml.

TIA,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/8/06, Didier BRETIN <[hidden email]> wrote:

>
> Alexandru Popescu wrote :
> > Didier can you please use the dumpCommand Ant attribute set to true
> > and send us the output?
>
> Sure, here it is:
> Buildfile: C:\Documents and Settings\utilisateur1\Mes documents\Projets
> Eclipse\TestNg\build.xml
> test:
>     [testng] [TestNGAntTask] TESTNG PASSED
> @C:\DOCUME~1\dbretin\LOCALS~1\Temp\testng671 WHICH CONTAINS:
>     [testng] [TestNGAntTask] -groups fast -testclass ""C:\Documents and
> Settings\utilisateur1\Mes documents\Projets
> Eclipse\TestNg\bin\example1\SimpleTest.class"" -suitename "Ant suite"
> -testname "Ant test"
>     [testng] Exception in thread "main" org.testng.TestNGException:
>     [testng] Cannot load class from file: C:\Documents
>     [testng] at
> org.testng.TestNGCommandLineArgs.fileToClass(TestNGCommandLineArgs.java:595)
>     [testng] at
> org.testng.TestNGCommandLineArgs.parseCommandLine(TestNGCommandLineArgs.java:206)
>     [testng] at org.testng.TestNG.privateMain(TestNG.java:1012)
>     [testng] at org.testng.TestNG.main(TestNG.java:999)
> BUILD SUCCESSFUL
> Total time: 1 second
>
> For continue my tests with TestNg, I move my eclipse and my projects to
> directories with no space and there it works. But if we can find a
> solution to this issue it will be great too.
>
> Regards.
> --
> Didier BRETIN
> http://www.bretin.net/
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

tarun3kumar

This is a major issue. Any path with spaces in it in any nested (file)set of the <testng> tasks reproduces it.

I need a bugfix release for the Hibernate examples, this affects hundreds of users.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=52671&messageID=106326#106326


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Alexandru Popescu ☀

Christian I will look into it this night, but unfortunately till
tomorrow morning I will not have internet access.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/10/06, Christian Bauer <[hidden email]> wrote:

>
> This is a major issue. Any path with spaces in it in any nested (file)set of the <testng> tasks reproduces it.
>
> I need a bugfix release for the Hibernate examples, this affects hundreds of users.
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=52671&messageID=106326#106326
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Alexandru Popescu ☀

Fixed in SVN trunk v.272.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/10/06, Alexandru Popescu <[hidden email]> wrote:

> Christian I will look into it this night, but unfortunately till
> tomorrow morning I will not have internet access.
>
> ./alex
> --
> .w( the_mindstorm )p.
>   TestNG co-founder
> EclipseTestNG Creator
>
>
> On 12/10/06, Christian Bauer <[hidden email]> wrote:
> >
> > This is a major issue. Any path with spaces in it in any nested (file)set of the <testng> tasks reproduces it.
> >
> > I need a bugfix release for the Hibernate examples, this affects hundreds of users.
> > ---------------------------------------------------------------------
> > Posted via Jive Forums
> > http://forums.opensymphony.com/thread.jspa?threadID=52671&messageID=106326#106326
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

tarun3kumar

TestNG 5.4 fixes this issue.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=52671&messageID=106597#106597


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Steve Loughran-7
In reply to this post by Alexandru Popescu ☀

On 10/12/06, Alexandru Popescu <[hidden email]> wrote:
>
> Fixed in SVN trunk v.272.
>
> ./alex

Have you tried testing w/ antunit yet:
http://ant.apache.org/antlibs/antunit/

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Alexandru Popescu ☀

On 12/11/06, Steve Loughran <[hidden email]> wrote:

>
> On 10/12/06, Alexandru Popescu <[hidden email]> wrote:
> >
> > Fixed in SVN trunk v.272.
> >
> > ./alex
>
> Have you tried testing w/ antunit yet:
> http://ant.apache.org/antlibs/antunit/
>

Nope.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: [ant] Problem with space in directory name

Steve Loughran-7

On 11/12/06, Alexandru Popescu <[hidden email]> wrote:

>
> On 12/11/06, Steve Loughran <[hidden email]> wrote:
> >
> > On 10/12/06, Alexandru Popescu <[hidden email]> wrote:
> > >
> > > Fixed in SVN trunk v.272.
> > >
> > > ./alex
> >
> > Have you tried testing w/ antunit yet:
> > http://ant.apache.org/antlibs/antunit/
> >
>
> Nope.


Its ant1.7+ only, and will exit beta when ant1.7 does, which will be
in the next week or two.

You run the task against a fileset of build files, and it runs every
target whose name matches the pattern test?* in the file, and all its
dependencies, after running the "setUp" and before running "tearDown".

  <target name="antunit" depends="ready-to-run">
    <au:antunit>
      <fileset file="${ant.file}"/>
      <au:plainlistener/>
    </au:antunit>
  </target>

Targets contain assertions and can even expect bits of a built to fail

  <target name="testGoodEnum" depends="define">
    <book:enum day="fri"/>
    <au:assertLogContains text="the day is fri" />
    <au:assertLogContains text="the day index is 5"/>
  </target>

  <target name="testInvalidEnum" depends="define">
    <au:expectfailure
      expectedMessage="not a legal value for this attribute">
      <book:enum day="april"/>
    </au:expectfailure>
  </target>

  <target name="testTypedefSelector" depends="define">
    <copy todir="${temp.dir}"
        xmlns:sel="antlib:org.antbook.selectors">
      <fileset dir="${data.dir}">
        <sel:readonly />
      </fileset>
    </copy>
    <au:assertFalse>
      <available file="${temp.dir}/writeable.dat" />
    </au:assertFalse>
  </target>

any ant condition can be used in an assertion, so if there is a built
in way to test the stateof your task/types, or some way to write a new
condition, you can automate the testing.

When it ships, antunit will be officially supported, meaning we won't
ignore complaints that it doesnt work. The biggest limitation is it
runs tests in the same JVM as the invoking build, which limits your
isolation. If you are doing games with singletons (as ivy does), the
test runs can contaminate each other.

-steve

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---