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 output is shown twice for every test #252

Open
christian-draeger opened this issue Jan 3, 2022 · 7 comments
Open

Test output is shown twice for every test #252

christian-draeger opened this issue Jan 3, 2022 · 7 comments
Assignees
Labels

Comments

@christian-draeger
Copy link

Description

Every test is displayed twice in the gradle output but in different styles.

Versions

  • Test logger version: 3.1.0
  • Gradle version: 7.3.2
  • Java version: 16

Type of test being run

Junit5 tests

Test logger configuration

testlogger {
    theme = ThemeType.MOCHA_PARALLEL
    showSimpleNames = true
    slowThreshold = 1000
}

Screenshots

image

@radarsh
Copy link
Owner

radarsh commented Jan 11, 2022

I think one set of outputs is from Gradle. Do you have Gradle's testLogging configured as well?

@christian-draeger
Copy link
Author

No, not knowingly.
Here is the build file of one of the projects where I am using your test logger: https://github.com/skrapeit/skrape.it/blob/master/build.gradle.kts

It started logging all tests twice after I bumped the dependencies including this testlogger as well as the gradle version

@radarsh
Copy link
Owner

radarsh commented Jan 16, 2022

Can you try setting this in your build script and let me know if that fixes things?

test {
    testLogging {
+       showStandardStreams = false
    }
}

Up until 3.0.0, I used to reset any logging events set on the testLogging closure but doing so seems to be discouraged in Gradle 7. So I've removed the resetting logic. I am wondering if that has caused the issue you're seeing.

@christian-draeger
Copy link
Author

christian-draeger commented Jan 18, 2022

Setting the showStandardStreams option to false unfortunately didn't change the result.
Here is the commit deactivating the Standard streams with corresponding log output (hope you can see it) https://github.com/skrapeit/skrape.it/runs/4850664855?check_suite_focus=true

@radarsh
Copy link
Owner

radarsh commented Jan 18, 2022

Thanks, that was useful. Can I ask you to try setting this as well please?

test {
    testLogging {
+       lifecycle.events = []
    }
}

If this setting manages to hide the undesirable output, I will have to think of another way to revert the functionality which was previously present.

@christian-draeger
Copy link
Author

this will throw an exception (i am using gradle kotlin dsl)
image

@christian-draeger
Copy link
Author

christian-draeger commented Jan 27, 2022

i turns out that configuring testLogging events as part of the test task e.g.

test {
    testLogging {
        events(TestLogEvent.PASSED, TestLogEvent. SKIPPED, TestLogEvent.FAILED)
    }
}

will lead to the described behavior. everything is working as expected when the events are removed.
Not sure if thats intended or a bug.

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

No branches or pull requests

2 participants