maven-scalatest-plugin - Not executing tests if spaces in project path

611 views
Skip to first unread message

Mike Allen

unread,
Dec 16, 2011, 12:45:42 PM12/16/11
to scalate...@googlegroups.com
Hi!

Firstly, Bill, thanks for all of your excellent work on ScalaTest and the maven-scalatest-plugin!  I find them both invaluable tools!

I'm using ScalaTest with Maven (using your maven-scalatest-plugin) from within Eclipse.  Up until now, I've been doing all of my development on a Linux machine.  However, recently I checked out a copy of one project on my Windows laptop - and discovered that ScalaTest wasn't finding any tests to execute.  After a good deal of head scratching, it appears that spaces in the runpath(s) are causing the problem.

Here's some relevant output from the Eclipse console with Maven debug enabled:

[DEBUG] [-p, C:\Users\mallen\My Documents\workspace\MyProject\libmyproject\target\development\classes C:\Users\mallen\My Documents\workspace\MyProject\libmyproject\target\development\test-classes, -o]
[36mRun starting. Expected test count is: 0 [0m
[32mDiscoverySuite: [0m
[36mRun completed in 242 milliseconds. [0m
[36mTotal number of tests run: 0 [0m
[36mSuites: completed 1, aborted 0 [0m
[36mTests: succeeded 0, failed 0, ignored 0, pending 0 [0m
[32mAll tests passed. [0m

(Incidentally, is there any command line option to remove the cursor escape sequences from the ScalaTest text output?)

The space in "My Documents" appears to be the problem.  If I add an explicit runpath (shown in bold) to my POM file, the tests are discovered and executed just fine, but not in a particularly portable way:

  <build>
    <plugins>
      <!-- ... -->
      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>maven-scalatest-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <executions>
          <execution>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <!-- ... -->
              <runpath>
                c:\Users\mallen\MYDOCU~1\workspace\MyProject\libmyproject\target\development\test-classes
              </runpath>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

This may affect other paths passed to ScalaTest as well.  Would it be possible to quote the paths, or escape any spaces within the paths, passed to ScalaTest?

Best Regards,

Mike
--
Hindsight Logo Mike Allen, President
Hindsight Consulting, Inc.
P.O. Box 2010, Dearborn, MI 48123
P: +1 (313) 451-4001
mi...@hindsight-consulting.com
hindsight-consulting.com

Gain from the Experience of Hindsight 

Bill Venners

unread,
Dec 16, 2011, 3:13:43 PM12/16/11
to scalate...@googlegroups.com
Hi Mike,

Yes, spaces are the delimiters in a runpath specification, to enable URLs. What we put in for spaces was to precede the space with backslash. I'm now wondering, though, if there's a file pathname on Windows that we can't express. I will make a note to make sure you can express any possible runpath on Windows.

As far as turning off the color, you can put a W configuration parameter (W for "Without color") for any of the standard out, standard error, or file reporters. On the command line, that's -oW. Sorry I haven't found time to do much documentation for the Maven plugin yet. I had to look at the Scaladoc comments in the source, and I don't see a way to configure the standard out reporter mentioned in the scaladoc. However in the source it adds the stdout value to -o, so I think this should work:

<stdout>W</stdout>

Can you try adding that to your pom.xml and see if that turns off the color?

Thanks.

Bill

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest



--
Bill Venners
Artima, Inc.
http://www.artima.com

Mike Allen

unread,
Dec 16, 2011, 8:15:14 PM12/16/11
to scalate...@googlegroups.com
Hi Bill,

Thanks for your assistance!

I added <stdout>W</stdout> to the POM file, and now get nice clean test output, without the "color".  Thanks!

As for spaces in paths, as luck would have it, I set-up a Linux-hosted Jenkins continuous integration server today - for a project called "MyProject Trunk" - and discovered that tests aren't being found during builds there either; the name of the project forms part of the absolute path to the test output directory.  If I rename the project "MyProjectTrunk" then it works fine.  So, it looks like spaces in paths are a problem on both Windows and Linux.

From looking at the maven-scalatest-plugin source, the run-paths are obtained as follows:

    private List<String> runpath() {

        return compoundArg("-p",
                outputDirectory.getAbsolutePath(),
                testOutputDirectory.getAbsolutePath(),
                runpath);
    }

The strings then seem to be passed straight to the command line without quoting or escaping of any kind.

Best Regards,

Mike

Bill Venners

unread,
Dec 16, 2011, 8:47:36 PM12/16/11
to scalate...@googlegroups.com
Hi Mike,

On Fri, Dec 16, 2011 at 5:15 PM, Mike Allen <mi...@hindsight-consulting.com> wrote:
Hi Bill,

Thanks for your assistance!

I added <stdout>W</stdout> to the POM file, and now get nice clean test output, without the "color".  Thanks!

As for spaces in paths, as luck would have it, I set-up a Linux-hosted Jenkins continuous integration server today - for a project called "MyProject Trunk" - and discovered that tests aren't being found during builds there either; the name of the project forms part of the absolute path to the test output directory.  If I rename the project "MyProjectTrunk" then it works fine.  So, it looks like spaces in paths are a problem on both Windows and Linux.

From looking at the maven-scalatest-plugin source, the run-paths are obtained as follows:

    private List<String> runpath() {

        return compoundArg("-p",
                outputDirectory.getAbsolutePath(),
                testOutputDirectory.getAbsolutePath(),
                runpath);
    }

The strings then seem to be passed straight to the command line without quoting or escaping of any kind.

Ah. That does look like a bug. I'll work on a fix. Thanks for finding it!

Bill
 
Reply all
Reply to author
Forward
0 new messages