Tests are ignored for linked-list exercise by the test runner

When testing the reference solution of the linked-list exercise with ./bin/run-in-docker.sh, I see the following output:

linked-list: testing...
cp: cannot stat '/solution/src/test/groovy/LinkedListSpec.groovy': No such file or directory
sed: can't read /solution/src/test/groovy/LinkedListSpec.groovy: No such file or directory
sed: can't read /solution/src/test/groovy/LinkedListSpec.groovy: No such file or directory
mv: cannot stat '/solution/src/test/groovy/LinkedListSpec.groovy.original': No such file or directory
linked-list: done

Here’s the relevant surefire report:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="DoubleLinkedListSpec" time="0.072" tests="5" errors="0" skipped="4" failures="0">
  <properties>
      ...
  </properties>
  <testcase name="Can push and pop" classname="DoubleLinkedListSpec" time="0.069"/>
  <testcase name="Can push and shift" classname="DoubleLinkedListSpec" time="0">
    <skipped message="Ignored via @Ignore"/>
  </testcase>
  <testcase name="Can unshift an shift" classname="DoubleLinkedListSpec" time="0">
    <skipped message="Ignored via @Ignore"/>
  </testcase>
  <testcase name="Can unshift and pop" classname="DoubleLinkedListSpec" time="0">
    <skipped message="Ignored via @Ignore"/>
  </testcase>
  <testcase name="Complete example" classname="DoubleLinkedListSpec" time="0">
    <skipped message="Ignored via @Ignore"/>
  </testcase>
</testsuite>

(all but one test are ignored).

The problem is with the test script, specifically groovy-test-runner/bin/run.sh at main · artamonovkirill/groovy-test-runner · GitHub.
The script assumes the exercise slug to match the test class name, which is not the case here (linked-list vs. DoubleLinkedListSpec.groovy).

We could either align the slug name with the test class name or take a similar approach as we did for the Scala test runner (Extract test name from metadata by artamonovkirill · Pull Request #38 · exercism/scala-test-runner · GitHub).

Pull request Allow for custom test class names by artamonovkirill · Pull Request #41 · exercism/groovy-test-runner · GitHub :pray:

1 Like