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/
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.
TIA,
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
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.
TIA,
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
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
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
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