Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30905

Failures when executing JUnit tests with the Maven Surefire plugin on projects that have white spaces in its names

XMLWordPrintable

      When executing JUnit tests using the Maven Surefire plugin on projects containing white spaces in its name, the white spaces get escaped as "%20".

      This causes any file loading of resources from the file system to fail, as folder "/test one/", is not "/test%20one/".

      Sample steps to reproduce:

      • Package a configuration in src/test/resources named "config.xml".
      • Load it in the Test Case with File configFile = new File(Thread.currentThread().getContextClassLoader().getResource("config.xml").getFile());
      • 'mvn test' the project in Jenkins.

      Upon execution, the following is thrown at the console log,

      [INFO] Surefire report directory: /opt/jenkins/workspace/Dixons Carphone SAP PI Framework XML Schema Generator/target/surefire-reports

      -------------------------------------------------------
      T E S T S
      -------------------------------------------------------
      Running com.dixonscarphone.integrationservices.sap.pi.framework.generator.xml.schema.test.XMLConverterTest
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.006 sec <<< FAILURE!

      Results :

      Tests in error:
      testXMLtoXSD(com.dixonscarphone.integrationservices.sap.pi.framework.generator.xml.schema.test.XMLConverterTest): /opt/jenkins/workspace/Framework%20XML%20Schema%20Generator/target/test-classes/config.xml (No such file or directory)

      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

      [ERROR] There are test failures.

      Please refer to /opt/jenkins/workspace/Framework XML Schema Generator/target/surefire-reports for the individual test results.
      [JENKINS] Recording test results

            kohsuke Kohsuke Kawaguchi
            monteuxrove Rove Monteux
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: