An open API service indexing awesome lists of open source software.

https://github.com/helmethair-co/scalatest-junit-runner

JUnit 5 runner for Scalatest
https://github.com/helmethair-co/scalatest-junit-runner

gradle gradle-plugin junit junit-5 junit-platform junit-runner junit-test junit-tests scala scalatest scalatest-junit-runner scalatesting test testing testing-library testing-tool testing-tools

Last synced: 9 months ago
JSON representation

JUnit 5 runner for Scalatest

Awesome Lists containing this project

README

          

# ScalaTest Junit 5 runner
[![Tests](https://github.com/helmethair-co/scalatest-junit-runner/workflows/Test/badge.svg)](https://github.com/helmethair-co/scalatest-junit-runner/actions?query=workflow%3A%22Test%22+branch%3Amain+event%3Apush)
[![codecov](https://codecov.io/gh/helmethair-co/scalatest-junit-runner/branch/main/graph/badge.svg)](https://codecov.io/gh/helmethair-co/scalatest-junit-runner)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/co.helmethair/scalatest-junit-runner/badge.svg)](https://maven-badges.herokuapp.com/maven-central/co.helmethair/scalatest-junit-runner)

[JUnit 5](https://junit.org/junit5/docs/current/user-guide/) runner library for [ScalaTest](http://www.scalatest.org/) tests. It can be used to fully [integrate ScalaTest into Gradle](https://www.baeldung.com/junit-5-gradle) (version >= 4.5) and to Maven.

There is an open [issue](https://github.com/scalatest/scalatest/issues/1454) to natively support JUnit 5 in ScalaTest without this library.

## Getting Started

## Features
* Running ScalaTest test on the Junit 5 platform
* Fully integrate ScalaTest into gradle
* Report individual test runs
* Report errors to JUnit 5 with stack traces
* Support ScalaTest tags
* Optional early stopping after the first test fail

## How to use

### Gradle
version >= 4.5
This library allows to run ScalaTest on the new JUnit Platform (JUnit 5)
To run ScalaTest on the old JUnit Vintage (JUnit 4) platform use the [gradle-scalatest](https://plugins.gradle.org/plugin/com.github.maiflai.scalatest) Gradle plugin.

#### Groovy
gradle.properties
```properties
scala_lib_version=2.12
scala_version=2.12.10
junit_platform_version=1.6.0
```

build.gradle
```groovy
plugins {
id 'scala'
}

repositories {
jcenter()
}

dependencies {
implementation "org.scala-lang:scala-library:$scala_version"

testImplementation "org.scalatest:scalatest_$scala_lib_version:3.2.0-M3"
testRuntime "org.junit.platform:junit-platform-engine:$junit_platform_version"
testRuntime "org.junit.platform:junit-platform-launcher:$junit_platform_version"
testRuntime "co.helmethair:scalatest-junit-runner:0.1.11"
}

test {
useJUnitPlatform {
includeEngines 'scalatest'
testLogging {
events("passed", "skipped", "failed")
}
}
}
```

See [example Groovy Gradle project](https://github.com/helmethair-co/scalatest-junit-runner/tree/master/gradle-example)

#### Kotlin DSL
build.gradle.kts
```kotlin
...
tasks {
test{
useJUnitPlatform {
includeEngines("scalatest")
testLogging {
events("passed", "skipped", "failed")
}
}
}
}
```

See [example Kotlin DSL Gradle project](https://github.com/helmethair-co/scalatest-junit-runner/tree/master/gradle-kotlin-dsl-example)

### Maven

Surefire plugin version >= 2.22.0

pom.xml
```xml


org.scala-lang
scala-library
${scala.version}
compile



org.junit.platform
junit-platform-engine
${junit.version}
test



org.scalatest
scalatest_${scala.compat.version}
${scalatest.version}
test



co.helmethair
scalatest-junit-runner
${scalatest.runner.version}
test



src/main/scala
src/test/scala

...

org.apache.maven.plugins
maven-surefire-plugin
${maven.surefire.version}

...

```

See [example maven project](https://github.com/helmethair-co/scalatest-junit-runner/tree/main/maven-example)

### JUnit console

Add the library to the classpath and run your test

## Built With

* [ScalaTest](http://www.scalatest.org)
* [Kotlin](http://kotlinlang.org/) - Kotlin DSL for Gradle
* [Gradle](http://gradle.org/) - Build tool
* [Gradle Test Logger Plugin](https://plugins.gradle.org/plugin/com.adarshr.test-logger)
* [semver-git-plugin](https://github.com/ilovemilk/semver-git-plugin)

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

We use [semantic versioning](http://semver.org/).

This project is licensed under the MIT License - see the [LICENSE](LICENSE) for details