Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cases should have their tags appended to the test name if so configured #1804

Closed
jschneidereit opened this issue Oct 26, 2020 · 1 comment · Fixed by #1922
Closed

Test cases should have their tags appended to the test name if so configured #1804

jschneidereit opened this issue Oct 26, 2020 · 1 comment · Fixed by #1922
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Milestone

Comments

@jschneidereit
Copy link
Member

A test should append a list of its tags to its name when logging the test name.

object TestConfiguration : AbstractProjectConfig() {
    override val includeTagInDisplayName: Boolean = true
}

object Foo : Tag()

class SlackTag(override val name: String, private val channel: String) : Tag() {
    override fun toString(): String = "Test owner contact: $channel"
}

val teamB = SlackTag("teamB", "#team-b-channel")

class BTests : ShouldSpec({
    should("do b thing").config(tags = setOf(Foo, teamB)) {
        1 shouldBe 2
    }
})

When run, the above test should log the following:

BTests > should do b thing [tags=Foo, Test owner contact: #team-b-channel] FAILED
    org.opentest4j.AssertionFailedError at Owners.kt:25
@LeoColman LeoColman added the enhancement ✨ Suggestions for adding new features or improving existing ones. label Oct 27, 2020
@sksamuel sksamuel added the framework 🏗️ Pertains to the core structure and components of the Kotest framework. label Oct 29, 2020
@sksamuel sksamuel added this to the 4.4 milestone Oct 29, 2020
@sksamuel
Copy link
Member

Should be configurable and disabled by default.

@sksamuel sksamuel mentioned this issue Dec 13, 2020
43 tasks
@sksamuel sksamuel modified the milestones: 4.4, 4.5 Dec 15, 2020
@sksamuel sksamuel mentioned this issue Dec 15, 2020
26 tasks
sksamuel pushed a commit that referenced this issue Dec 19, 2020
* #1804 Appends tag names in test class

* #1804 Adds option to append tags in test name from configuration

* #1804 Appends tags in test name only when enable through configuration
@sksamuel sksamuel modified the milestones: 4.5, 4.4 Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants