Skip to content

No tests were found when trying to run JUnit tests with Scala 2 or WIP Scala 3 extension #18373

Description

@GavinRay97

Zulip thread: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/.22No.20Tests.20Found.22.2C.20last.20issue.20for.20Scala.203.20support

Describe the bug

  • Go to https://code.quarkus.io/ and create a new Maven application with just the Scala extension

  • Try to run mvn test or mvn quarkus:test

  • The maven-scala-plugin will detect the presence of the Scala test files and compile them, but Quarkus/JUnit 5 will report there being no tests.

  • image

  • image

  • image


I believe this may be something specific to the way Quarkus deals with tests. I thought it might be a JUnit bug, and was going to file an issue there, but I downloaded their junit5-jupiter-maven starter, and tried to reproduce this, but had no issues:

The pom.xml being used here is:

<?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>

	<groupId>com.example</groupId>
	<artifactId>junit5-jupiter-starter-maven</artifactId>
	<version>1.0-SNAPSHOT</version>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>

		<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>

		<scala-maven-plugin.version>4.5.3</scala-maven-plugin.version>
		<scala.compat.version>3</scala.compat.version>
		<scala.version>3.0.0</scala.version>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>5.7.2</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.scala-lang</groupId>
			<artifactId>scala3-library_${scala.compat.version}</artifactId>
			<version>${scala.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scala-lang</groupId>
			<artifactId>scala-library</artifactId>
			<version>2.13.5</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
			</plugin>
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${surefire-plugin.version}</version>
			</plugin>
			<plugin>
				<groupId>net.alchim31.maven</groupId>
				<artifactId>scala-maven-plugin</artifactId>
				<version>${scala-maven-plugin.version}</version>
				<executions>
					<execution>
						<id>scala-compile-first</id>
						<phase>process-resources</phase>
						<goals>
							<goal>add-source</goal>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>scala-test-compile</id>
						<phase>process-test-resources</phase>
						<goals>
							<goal>add-source</goal>
							<goal>testCompile</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<scalaVersion>${scala.version}</scalaVersion>
					<args></args>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

Output of uname -a or ver

MSYS_NT-10.0-21382 DESKTOP-88A51E5 3.1.7-340.x86_64 2020-10-23 13:08 UTC x86_64 Msys

Output of java -version

JDK 11 and JDK 16

GraalVM version (if different from Java)

GraalVM 21.2.0-dev

Quarkus version or git rev

2.0.0-FINAL

Build tool (ie. output of mvnw --version or gradlew --version)

rayga@DESKTOP-88A51E5 MSYS ~
$ mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\Program Files\apache-maven-3.8.1
Java version: 11.0.11, vendor: GraalVM Community, runtime: C:\GraalVM\graalvm-ce-java11-21.2.0-dev
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Metadata

Metadata

Assignees

No one assigned

    Labels

    env/windowsImpacts Windows machineskind/bugSomething isn't workingtriage/invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions