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
adds filter for showing only slow tests #207
Conversation
…lish Upgrade plugin publish plugin
Hey @radarsh, any news on this? Kind regards |
Hi @grimmjo, only feedback I have is to rename Oh and while you're there, could you also document this new property in the README? Thanks. |
Hi @radarsh, |
src/main/groovy/com/adarshr/gradle/testlogger/TestLoggerExtensionProperties.groovy
Outdated
Show resolved
Hide resolved
Hi @grimmjo there seems to be a problem. I'm running the tests with
|
README.md
Outdated
} | ||
``` | ||
|
||
By default all the above three flags are turned on. If you have chosen to display standard streams by setting | ||
By default all the above four flags are turned on. If you have chosen to display standard streams by setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
showOnlySlow
is will be off by default. So this goes back to being
By default the flags
showPassed
,showSkipped
andshowFailed
are turned on whileshowOnlySlow
will be off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done ;) just inserted your quote.
@@ -21,7 +21,8 @@ class TestResultWrapper { | |||
boolean isLoggable() { | |||
testLoggerExtension.showPassed && testResult.successfulTestCount || | |||
testLoggerExtension.showSkipped && (testResult.resultType == SKIPPED || testResult.skippedTestCount) || | |||
testLoggerExtension.showFailed && testResult.failedTestCount | |||
testLoggerExtension.showFailed && testResult.failedTestCount || | |||
testLoggerExtension.showOnlySlow && (isTooSlow() || isMediumSlow()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong with this expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get it to work by changing the method body to be as below. If you can do it in a more readable manner, please do so.
if (testLoggerExtension.showOnlySlow && (!isTooSlow() || !isMediumSlow())) {
return false
}
testLoggerExtension.showPassed && testResult.successfulTestCount ||
testLoggerExtension.showSkipped && (testResult.resultType == SKIPPED || testResult.skippedTestCount) ||
testLoggerExtension.showFailed && testResult.failedTestCount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored this method a little bit to make it more readable
My understanding of this flag is: Given and Given |
@@ -227,6 +229,15 @@ class TestLoggerExtension extends TestLoggerExtensionProperties { | |||
.getOrElse(false) | |||
} | |||
|
|||
Boolean getshowOnlySlow() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the method name :) This is why the command line argument wasn't working. It should be getShowOnlySlow
(capitalised).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. Done ;)
@@ -127,6 +127,29 @@ class TestResultWrapperSpec extends Specification { | |||
10001 | false | |||
} | |||
|
|||
@Unroll | |||
def "loggable returns false if showOnlySlow is turned #showOnlySlow"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests will need fixing too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
My understanding of the flag is a little bit different as you may see in the What we should think about is, that we only should filter the passed test as the consumer may wants to see always the skipped and failed tests. |
You make a very good point here.
We shouldn't hide failing tests because they failed fast :) But your PR seems to be already doing this. |
Hi @radarsh 😃 belated happy new year ;) Do you have any plans on merging this pr and releasing a new version? |
@grimmjo Happy New Year. Yeah, let me get this done this week. |
closes #158