Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions allure-scalatest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ description = "Allure ScalaTest Integration"

apply(plugin = "scala")

val availableScalaVersions = listOf("2.11", "2.12")
val availableScalaVersions = listOf("2.11", "2.12", "2.13")
val defaultScala211Version = "2.11.12"
val defaultScala212Version = "2.12.8"
val defaultScala213Version = "2.13.1"

var selectedScalaVersion = defaultScala212Version
var selectedScalaVersion = defaultScala213Version

if (hasProperty("scalaVersion")) {
val scalaVersion: String by project
selectedScalaVersion = when (scalaVersion) {
"2.11" -> defaultScala211Version
"2.12" -> defaultScala212Version
"2.13" -> defaultScala213Version
else -> scalaVersion
}
}
Expand Down Expand Up @@ -81,7 +83,8 @@ val agent: Configuration by configurations.creating
dependencies {
agent("org.aspectj:aspectjweaver")
api(project(":allure-java-commons"))
implementation("org.scalatest:scalatest_$baseScalaVersion:3.0.5")
implementation("org.scalatest:scalatest_$baseScalaVersion:3.1.1")
implementation("org.scala-lang.modules:scala-collection-compat_$baseScalaVersion:2.1.4")
testAnnotationProcessor(project(":allure-descriptions-javadoc"))
testImplementation("io.github.glytching:junit-extensions")
testImplementation("org.assertj:assertj-core")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.scalatest.Reporter
import org.scalatest.events._
import org.scalatest.exceptions.TestFailedException

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.mutable

/**
Expand Down Expand Up @@ -185,7 +185,7 @@ class AllureScalatest(val lifecycle: AllureLifecycle) extends Reporter {
createLanguageLabel("scala"),
createFrameworkLabel("scalatest")
)
labels ++= asScalaSet(getProvidedLabels)
labels ++= getProvidedLabels.asScala

var links = mutable.ListBuffer[io.qameta.allure.model.Link]()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import io.qameta.allure.scalatest.testdata._
import io.qameta.allure.test.{AllureResults, AllureResultsWriterStub}
import io.qameta.allure.{Allure, AllureLifecycle}
import org.junit.jupiter.api.Test
import org.scalatest.Matchers._
import org.scalatest.matchers.should.Matchers._
import org.scalatest.tools.Runner

import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
import scala.jdk.CollectionConverters._

/**
* @author charlie (Dmitry Baev).
Expand All @@ -35,15 +35,15 @@ class AllureScalatestTest {
@Test
def shouldSetName(): Unit = {
val results = run(classOf[SimpleSpec])
asScalaBuffer(results.getTestResults)
results.getTestResults.asScala
.map(item => item.getName) should contain("test should be passed")
}

@Test
def shouldSetStart(): Unit = {
val results = run(classOf[SimpleSpec])

val starts = asScalaBuffer(results.getTestResults)
val starts = results.getTestResults.asScala
.map(item => item.getStart).toList

every(starts) should not be null
Expand All @@ -53,7 +53,7 @@ class AllureScalatestTest {
def shouldSetStop(): Unit = {
val results = run(classOf[SimpleSpec])

val stops = asScalaBuffer(results.getTestResults)
val stops = results.getTestResults.asScala
.map(item => item.getStop)

every(stops) should not be null
Expand All @@ -63,7 +63,7 @@ class AllureScalatestTest {
def shouldSetStage(): Unit = {
val results = run(classOf[SimpleSpec])

val stages = asScalaBuffer(results.getTestResults)
val stages = results.getTestResults.asScala
.map(item => item.getStage)

every(stages) shouldBe FINISHED
Expand All @@ -73,7 +73,7 @@ class AllureScalatestTest {
def shouldSetStatus(): Unit = {
val results = run(classOf[SimpleSpec])

val statuses = asScalaBuffer(results.getTestResults)
val statuses = results.getTestResults.asScala
.map(item => item.getStatus)

every(statuses) shouldBe Status.PASSED
Expand All @@ -85,7 +85,7 @@ class AllureScalatestTest {

results.getTestResults should have length 1

val statuses = asScalaBuffer(results.getTestResults)
val statuses = results.getTestResults.asScala
.map(item => item.getStatus)

every(statuses) shouldBe Status.FAILED
Expand All @@ -97,7 +97,7 @@ class AllureScalatestTest {

results.getTestResults should have length 1

val statuses = asScalaBuffer(results.getTestResults)
val statuses = results.getTestResults.asScala
.map(item => item.getStatus).toList

every(statuses) should be(Status.BROKEN)
Expand All @@ -109,7 +109,7 @@ class AllureScalatestTest {

results.getTestResults should have length 1

val statuses = asScalaBuffer(results.getTestResults)
val statuses = results.getTestResults.asScala
.map(item => item.getStatus).toList

every(statuses) should be(Status.SKIPPED)
Expand All @@ -121,8 +121,8 @@ class AllureScalatestTest {

results.getTestResults should have length 1

val labels = asScalaBuffer(results.getTestResults)
.flatMap(item => asScalaBuffer(item.getLabels))
val labels = results.getTestResults.asScala
.flatMap(item => item.getLabels.asScala)
.map(label => (label.getName, label.getValue))
.toList

Expand All @@ -138,8 +138,8 @@ class AllureScalatestTest {

results.getTestResults should have length 1

val labels = asScalaBuffer(results.getTestResults)
.flatMap(item => asScalaBuffer(item.getLabels))
val labels = results.getTestResults.asScala
.flatMap(item => item.getLabels.asScala)
.map(label => (label.getName, label.getValue))
.toList

Expand All @@ -152,15 +152,15 @@ class AllureScalatestTest {

results.getTestResults should have length 1

asScalaBuffer(results.getTestResults)
results.getTestResults.asScala
.map(item => item.getName) should contain("test should be ignored")

val statuses = asScalaBuffer(results.getTestResults)
val statuses = results.getTestResults.asScala
.map(item => item.getStatus).toList

every(statuses) should be(null)

val stages = asScalaBuffer(results.getTestResults)
val stages = results.getTestResults.asScala
.map(item => item.getStage).toList

every(stages) should be(Stage.FINISHED)
Expand All @@ -169,14 +169,14 @@ class AllureScalatestTest {
@Test
def shouldSupportJavaApi(): Unit = {
val results = run(classOf[AllureApiSpec])
val steps = asScalaBuffer(results.getTestResults)
.flatMap(item => asScalaBuffer(item.getSteps))
val steps = results.getTestResults.asScala
.flatMap(item => item.getSteps.asScala)

steps
.map(step => step.getName) should contain inOrder("first", "second", "third")

steps.filter(step => step.getName == "second")
.flatMap(step => asScalaBuffer(step.getSteps))
.flatMap(step => step.getSteps.asScala)
.map(step => step.getName) should contain inOrder("child1", "child2", "child3")

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ package io.qameta.allure.scalatest.testdata

import io.qameta.allure.Allure.{StepContext, step}
import io.qameta.allure.scalatest.AllureScalatestContext
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec

/**
* @author charlie (Dmitry Baev).
*/
class AllureApiSpec extends FlatSpec {
class AllureApiSpec extends AnyFlatSpec {

"test" should "be passed" in new AllureScalatestContext {
step("first")
step("second", () => {
step("child1")
step("child2")
step("child3")
Unit
() =>
})
step("third", (context: StepContext) => {
val a = context.parameter("a", 123L)
val b = context.parameter("b", "hello")
Unit
() =>
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.qameta.allure.scalatest.testdata

import io.qameta.allure._
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

/**
* @author charlie (Dmitry Baev).
Expand All @@ -28,7 +28,7 @@ import org.scalatest.FunSuite
@Link("https://example.org")
@Issue("https://example.org/issue/1")
@TmsLink("https://example.org/tms/1")
class AnnotationsOnClassSpec extends FunSuite {
class AnnotationsOnClassSpec extends AnyFunSuite {

test("demo test") {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package io.qameta.allure.scalatest.testdata

import org.scalatest.FlatSpec
import org.scalatest.Matchers._
import org.scalatest.matchers.should.Matchers._
import org.scalatest.flatspec.AnyFlatSpec

/**
* @author charlie (Dmitry Baev).
*/
class BrokenSpec extends FlatSpec {
class BrokenSpec extends AnyFlatSpec {

"test" should "be failed" in {
throw new RuntimeException("hell no")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package io.qameta.allure.scalatest.testdata

import org.scalatest.FlatSpec
import org.scalatest.Matchers._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers._

/**
* @author charlie (Dmitry Baev).
*/
class CancelledSpec extends FlatSpec {
class CancelledSpec extends AnyFlatSpec {

"test" should "be cancelled" in {
cancel("hell yes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package io.qameta.allure.scalatest.testdata

import org.scalatest.FlatSpec
import org.scalatest.Matchers._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers._

/**
* @author charlie (Dmitry Baev).
*/
class FailedSpec extends FlatSpec {
class FailedSpec extends AnyFlatSpec {

"test" should "be failed" in {
"hello" shouldBe "hell no"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
*/
package io.qameta.allure.scalatest.testdata

import org.scalatest.{FlatSpec, Ignore}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.Ignore

/**
* @author charlie (Dmitry Baev).
*/
@Ignore
class IgnoredSpec extends FlatSpec {
class IgnoredSpec extends AnyFlatSpec {

"test" should "be ignored" in {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
package io.qameta.allure.scalatest.testdata

import io.qameta.allure.{Severity, SeverityLevel}
import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec

/**
* @author charlie (Dmitry Baev).
*/
@Severity(SeverityLevel.BLOCKER)
class SeveritySpec extends FlatSpec {
class SeveritySpec extends AnyFlatSpec {

"test" should "be passed" in {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
package io.qameta.allure.scalatest.testdata

import org.scalatest.FlatSpec
import org.scalatest.flatspec.AnyFlatSpec

/**
* @author charlie (Dmitry Baev).
*/
class SimpleSpec extends FlatSpec {
class SimpleSpec extends AnyFlatSpec {

"test" should "be passed" in {
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ val qualityConfigsDir by extra("$gradleScriptDir/quality-configs")
val spotlessDtr by extra("$qualityConfigsDir/spotless")

tasks.withType(Wrapper::class) {
gradleVersion = "6.0.1"
gradleVersion = "6.3"
}

plugins {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists