-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
102 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
allure-plugin/src/test/kotlin/io/qameta/allure/gradle/report/TestAndAllureReportTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package io.qameta.allure.gradle.report | ||
|
||
import io.qameta.allure.gradle.rule.GradleRunnerRule | ||
import org.assertj.core.api.Assertions | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
|
||
@RunWith(Parameterized::class) | ||
class TestAndAllureReportTest { | ||
@Rule | ||
@JvmField | ||
val gradleRunner = GradleRunnerRule() | ||
.version { version } | ||
.project { project } | ||
.tasks { | ||
if (dependsOnTests) { | ||
arrayOf("allureReport", "--depends-on-tests") | ||
} else { | ||
arrayOf("allureReport") | ||
} | ||
} | ||
|
||
@Parameterized.Parameter(0) | ||
lateinit var version: String | ||
|
||
@Parameterized.Parameter(1) | ||
lateinit var project: String | ||
|
||
@JvmField | ||
@Parameterized.Parameter(2) | ||
var dependsOnTests: Boolean = false | ||
|
||
companion object { | ||
@JvmStatic | ||
@Parameterized.Parameters(name = "{1}, [{0}]") | ||
fun getFrameworks(): Array<Any> { | ||
val res = mutableListOf<Array<Any>>() | ||
for (gradleVersion in listOf("7.2", "7.0", "6.8.3")) { | ||
for (project in listOf("src/it/junit5-5.8.1")) { | ||
for (dependOnTests in listOf(true, false)) { | ||
res.add(arrayOf(gradleVersion, project, dependOnTests)) | ||
} | ||
} | ||
} | ||
return res.toTypedArray() | ||
} | ||
} | ||
|
||
@Test | ||
fun `check allureReport outcome`() { | ||
if (dependsOnTests) { | ||
Assertions.assertThat(gradleRunner.buildResult.tasks) | ||
.`as`("allureReport --depends-on-tests should trigger test execution") | ||
.filteredOn { task -> task.path == ":test" } | ||
.extracting("outcome") | ||
.containsExactly(TaskOutcome.SUCCESS) | ||
|
||
Assertions.assertThat(gradleRunner.buildResult.tasks) | ||
.`as`("allureReport --depends-on-tests should result in SUCCESS for :allureReport") | ||
.filteredOn { task -> task.path == ":allureReport" } | ||
.extracting("outcome") | ||
.containsExactly(TaskOutcome.SUCCESS) | ||
} else { | ||
Assertions.assertThat(gradleRunner.buildResult.tasks) | ||
.`as`("allureReport without --depends-on-tests should not trigger test execution") | ||
.filteredOn { task -> task.path == ":test" } | ||
.isEmpty() | ||
|
||
Assertions.assertThat(gradleRunner.buildResult.tasks) | ||
.`as`("allureReport without --depends-on-tests should result in NO-SOURCE for :allureReport") | ||
.filteredOn { task -> task.path == ":allureReport" } | ||
.extracting("outcome") | ||
.containsExactly(TaskOutcome.NO_SOURCE) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters