Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

[Feature Request] Test name prefix argument for test runner #2708

Closed
benasher44 opened this issue Feb 23, 2019 · 4 comments
Closed

[Feature Request] Test name prefix argument for test runner #2708

benasher44 opened this issue Feb 23, 2019 · 4 comments

Comments

@benasher44
Copy link
Contributor

We want to run the unit tests once per platform we support. In a CI environment, to separate test failures of one platform from another, we could prefix the names of the test suites with the platform name that we're running the tests on. One way to accomplish this would be allow passing a flag like --ktest_suite_prefix=<platform>.

Thanks!

@ilmat192
Copy link
Contributor

Thank you for the request. Such a request is already filed at YouTrack (https://youtrack.jetbrains.com/issue/KT-25057) and we are going to implement it in the near future. Closing this issue as a duplicate of the YouTrack one.

As a workaround you can pass the prefix using project properties (Kotlin DSL):

kotlin {
    // Replace with the platform you use.
    linuxX64("linux") {
        binaries.getExecutable("test", DEBUG).runTask?.apply {
            project.findProperty("testFilter")?.let {
                setArgs(listOf("--ktest_filter=$it"))
            }
        }
    }
}

After that you can pass the prefix using the testFilter project property:

./gradlew linuxTest -PtestFilter=foo.bar.*

@benasher44
Copy link
Contributor Author

@ilmat192 thanks for the reply! I think I might not have explained this clearly. What I'd like is, in the test report that's logged, to have each test class prepended with some string. For example, if you had a test class called SampleTest, and you ran this with this potential new flag --ktext_prefix="ios", the test report would render this class as ios.SampleTest. Does that make sense? I'm not looking for a way to apply a filter to logged output. I'd like to be able to log the output from running the test for 3 different platforms and be able to tell by looking at the ouput, which output is from which platform.

@ilmat192
Copy link
Contributor

I see, thank you for the clarification. I think this may make sense not only for native but also for other platforms. We'll discuss this point.

@ilmat192 ilmat192 reopened this Feb 26, 2019
@ilmat192
Copy link
Contributor

According to migrating issue tracking to YouTrack, closing this issue in favour of KT-43365.

The use case with different platforms is already supported by the Gradle plugin out of the box (see the YouTrack issue). But there are other possible cases when this feature can be useful, so I think that it's better to keep this feature request open and just move it to YouTrack.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants