TestNG Suites

I'm trying to define a suite of TestNG suites, but IDEA's integration doesn't seem to be able to resolve referenced suite files from the parent suite XML file, unless you use absolute paths.

For example, I was trying to use the following:

<suite-files>
<suite-file path="suite1_testng.xml"/>
<suite-file path="suite2_testng.xml"/>
<suite-file path="suite3_testng.xml"/>
<suite-file path="suite4_testng.xml"/>
<suite-file path="suite5_testng.xml"/>
</suite-files>

However, IDEA errored out saying it could find any of the suite files in the IDEA bin directory. Is there any way to reference the associated suite files with a relative path?

6 comments
Comment actions Permalink

We should be able to set the working directory before starting the new
VM whichs runs TestNG - I'll take a look.

Simon Knott wrote:

I'm trying to define a suite of TestNG suites, but IDEA's integration doesn't seem to be able to resolve referenced suite files from the parent suite XML file, unless you use absolute paths.

>

For example, I was trying to use the following:

>

<suite-files>
<suite-file path="suite1_testng.xml"/>
<suite-file path="suite2_testng.xml"/>
<suite-file path="suite3_testng.xml"/>
<suite-file path="suite4_testng.xml"/>
<suite-file path="suite5_testng.xml"/>
</suite-files>

>

However, IDEA errored out saying it could find any of the suite files in the IDEA bin directory. Is there any way to reference the associated suite files with a relative path?


0
Comment actions Permalink

Ah, that would be great!

Also, I've just tried running a suite file via Ant in IDEA and I'm getting the following error in the EAP 7675, for a suite which runs fine via the command line and using version 7.0.2:

TESTNG PASSED @ WHICH CONTAINS:
IO exception reading command line file
java.io.FileNotFoundException:
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106) at java.io.FileInputStream.(FileInputStream.java:66) at java.io.FileReader.]]>(FileReader.java:41)
at org.testng.TestNGCommandLineArgs.readFile(TestNGCommandLineArgs.java:544)
at org.testng.TestNGAntTask.dumpCommand(TestNGAntTask.java:990)
at org.testng.TestNGAntTask.printDebugInfo(TestNGAntTask.java:631)
at org.testng.TestNGAntTask.execute(TestNGAntTask.java:593)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:17)


I did try and find out exactly what file it was looking for, so I tried going to line 544 of the TestNG source code and it appeared to point to a comment. I then tried replacing all of IDEA's TestNG libraries with one built from the TestNG sources, but the builds for TestNG appear to break when running the unit tests!

0
Comment actions Permalink

I just about to go an add this functionality when I noticed theres
already a 'working directory' option under the JDK settings dialog.

At least the latest EAP 7.0.3 builds...

Simon Knott wrote:

I'm trying to define a suite of TestNG suites, but IDEA's integration doesn't seem to be able to resolve referenced suite files from the parent suite XML file, unless you use absolute paths.

>

For example, I was trying to use the following:

>

<suite-files>
<suite-file path="suite1_testng.xml"/>
<suite-file path="suite2_testng.xml"/>
<suite-file path="suite3_testng.xml"/>
<suite-file path="suite4_testng.xml"/>
<suite-file path="suite5_testng.xml"/>
</suite-files>

>

However, IDEA errored out saying it could find any of the suite files in the IDEA bin directory. Is there any way to reference the associated suite files with a relative path?


0
Comment actions Permalink

It's ignoring this unfortunately, no matter what the JDK working directory is set to it's looking in the IDEA/bin directory for the referenced suite files. I'll double-check tomorrow, but I'm 99% sure I checked this before posting.

Should I raise the problem with running TestNG suites through Ant as a JIRA, or is this forum the best place to raise the issues?

0
Comment actions Permalink

Simon Knott wrote:

It's ignoring this unfortunately, no matter what the JDK working
directory is set to it's looking in the IDEA/bin directory for the
referenced suite files. I'll double-check tomorrow, but I'm 99% sure
I checked this before posting.

>

Should I raise the problem with running TestNG suites through Ant as
a JIRA, or is this forum the best place to raise the issues?


Either is fine - I can see where the problem is, even thou the JDK
settings now includes the working directory, the plugin's not updated to
actually use it.

I'll update the plugin and make it available for the next EAP - and will
push it directly to you to give a bash of as well..

0
Comment actions Permalink

Simon Knott wrote:

It's ignoring this unfortunately, no matter what the JDK working
directory is set to it's looking in the IDEA/bin directory for the
referenced suite files. I'll double-check tomorrow, but I'm 99% sure
I checked this before posting.


This seems to work now - if you email me off list to mark at talios.com
I'll forward you a build of the plugin to confirm.

My simple test here just printed out 'new File(".").getCannonicalPath()'
and I saw the path change.

This should appear in the next EAP build..

0

Please sign in to leave a comment.