I now set up a POM-less Tycho build, and have a fragment that contains some tests.
I set up the ScalaTests to run with the JUnitRunner like this:
@RunWith(classOf[JUnitRunner])
class MyTest extends FlatSpec with Matchers {
// Test code
}
I added the respective inclusions into my pom.xml (despite it's pom-less, for tests to run, a pom.xml is needed):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.mycompany.myapp.project.model_test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>com.mycompany.myapp</groupId>
<artifactId>com.mycompany.myapp.tests</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>0.26.0</version>
<configuration>
<includes>**/Test*.java,**/*Test.java,**/*TestCase.java,**/Test*.scala,**/*Test.scala,**/*TestCase.scala</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I run the build, I get:
Root exception:
java.lang.RuntimeException: Unable to create test class 'com.mycompany.myapp.tests.MyTest.scala'
...
Caused by: java.lang.ClassNotFoundException: com.mycompany.myapp.tests.MyTest.scala
I can run the test from Eclipse just fine by right-clicking the test and using the appropriate option in the "Run As" menu.
When removing the Scala inclusions and adding a simple Java-based test:
import org.junit.Test;
public class FooTest {
@Test
public void foo() {
}
}
this works.
However, when I try to access anything written in Scala, it cannot resolve the references.
What am I missing?