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

Add a list of all Skipped tests to the Test Result report #106

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

nirgilboa
Copy link

@nirgilboa nirgilboa commented Jun 26, 2018

In a large test suite, it is useful to easily see a list of all skipped tests, as well as their age, i.e. for how many builds they've been skipped.
Previously it was only possible to view all tests in a given class, then sort by result to view the Skipped tests in it.

Note that I've left the "Duration" column, as tests may sometimes be skipped during execution, but it might be better to remove it to reduce clutter - I could use some feedback on that.

image

@nirgilboa
Copy link
Author

@rsandell @uhafner I'd appreciate your feedback, thanks 😃

Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance for an integration test? Is there an existing one that could be adapted?

*/
@Exported(visibility=9)
public int getSkippedSince() {
// If we haven't calculated failedSince yet, and we should,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skippedSince

if (skippedSince==0 && getSkipCount()==1) {
CaseResult prev = getPreviousResult();
if(prev!=null && !prev.isPassed())
this.skippedSince = prev.getSkippedSince();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if in previous the test failed and therefore it has been disabled now? Then previous.isPassed is false, too. Might be a good setup for an integration test.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right - when a test becomes skipped, its skippedSince counter is set to the current build number.
In a subsequent build:

  • If the test passes or fails, the skippedSince counter will be reset to 0.
  • If the test is skipped again, the skippedSince is carried over from the previous build.

// do it now.
if (skippedSince==0 && getSkipCount()==1) {
CaseResult prev = getPreviousResult();
if(prev!=null && !prev.isPassed())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make sense to always use {} for ifs.

2. Comments typo, fit on one line
3. if brackets included
2. Avoid NPE possibility in getFailedSince() test
@nirgilboa
Copy link
Author

Added an integration test which indeed helped to fix a logical error in getSkippedSince().
Thanks for your feedback!!

@jglick jglick requested review from rsandell and uhafner July 9, 2018 21:18
Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

*
* If {@link #isPassed() passing}, this field is left unused to 0.
*/
private /*final*/ int skippedSince;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't /*final*/ be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - removing

* If this test was skipped, then return the build number
* when this test was first skipped.
*/
@Exported(visibility=9)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the visibility of the skipped tests be higher than the visibility of failed tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought I think the visibility for getFailedSince and getSkippedSince should be identical.

@nirgilboa
Copy link
Author

@jglick ping

@nirgilboa
Copy link
Author

@jglick @abayer
Could you please review and decide on this?

@olivergondza
Copy link
Member

I like the change in general. One small thing I would like to see improved is making the list of skipped tests less significant in the UI. Collapsed by default? Moved to the very bottom? It is useful for sure but probably distracting most of the time...

if (skippedSince==0 && getSkipCount()==1) {
CaseResult prev = getPreviousResult();
if(prev!=null && prev.isSkipped()){
this.skippedSince = prev.getSkippedSince();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike failedSince, skippedSince is not available in XML, so this could recursively load all the skipped builds leading to StackOverflowError like JENKINS-31660 . IMHO it would be safer to save skippedSince in XML too and assume current build is the first skipped one if no information is found in XML, avoiding recursion. (Related to #117.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I will review this and suggest a fix

Copy link
Author

@nirgilboa nirgilboa May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zbynek I've given this some thought.. as I understand we only parse the XML and have no control over its contents. Do you see any other way to protect against a StackOverflowError ?

@nirgilboa
Copy link
Author

nirgilboa commented May 31, 2019

@olivergondza
Skipped tests table collapsed by default, accessible using a link placed at the bottom of the page.
I've tried to stay consistent with the style on the summary page.
Screenshots below:

Screenshot_ubuntu17 10_2019-05-31_16:48:42

Link is hidden and table is shown:
Screenshot_ubuntu17 10_2019-05-31_16:49:08

@zbynek
Copy link
Contributor

zbynek commented Jun 1, 2019

The skippedSince value is saved to XML (automatic saving of all fields, IIUC implemented by XStream2), but in most cases it's not computed before saving. See SuiteResultTest::testSuiteResultPersistence for implementation of saving test. For failedSince the freeze method makes sure that the field is computed before saving. If you add recomputeSkippedSinceIfNeeded() to CaseResult::freeze, saving will work, but it may lead to loading all the previous results from the disk. So recomputeSkippedSinceIfNeeded should fall back to previous build number if previous build failed but we don't know since when it's failing.

Also fixing the freeze method will cause a failure of the test testPreviousBuildNotLoaded from #117. Other way of testing for deep recursion is needed (maybe include 2 builds and make sure that we don't call getPreviousBuild on the older one?)

@hodnajit
Copy link

Is it possible, that this feature will be merged? :) I would like to use this feature as well :)

@SebastianSolidwork
Copy link

I'd love to see this feature available. What is lacking for a release?
Basically lack of engagement? :-|

@timja
Copy link
Member

timja commented Feb 14, 2023

I'd love to see this feature available. What is lacking for a release? Basically lack of engagement? :-|

reviewing if #106 (comment) needs fixing and then resolving conflicts and testing it end 2 end. Basically needs someone (anyone) to pick it up and get it over the finish line.

@nirgilboa
Copy link
Author

I'll be happy to revive this and push it if there's demand :)

@SebastianSolidwork
Copy link

SebastianSolidwork commented Feb 15, 2023

Nice! There is demand :-) How could you have waited for so long !?!?12 ;-)

I would interested in the All Tests the least.
How about making All Skipped Tests as second table, like in the original comment?
At least configurable?
If this is too much for here, I would create another issue.

@olivergondza
Copy link
Member

@nirgilboa, please resolve the conflicts. Thanks!

@SebastianSolidwork
Copy link

@nirgilboa Any news on this one?

@nirgilboa
Copy link
Author

Still here :) Sorry switched into a new role at work

Promise promise promise to complete it soon

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

Successfully merging this pull request may close these issues.

8 participants