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

JENKINS-42438 Correctly calculate test class duration. #66

Merged
merged 1 commit into from Jan 29, 2019

Conversation

mfuchs
Copy link
Contributor

@mfuchs mfuchs commented Mar 22, 2017

When running Android tests the in the generated xml file
can contain multiple classes.
Thus setting the test class duration to the value of the test-suite is wrong.

@ryncsn
Copy link

ryncsn commented Apr 3, 2017

This reverts some changes by #35 , maybe it's better to set the duration to re-sum of test cases only when there are multiple classes in a test suite? or add a configure option?

@mfuchs
Copy link
Contributor Author

mfuchs commented Apr 3, 2017

Thanks for your input! :)

In my opinion #35 introduced a bug and the person reporting JENKINS-42438 apparently has the same issue.
So I don't think I want to keep that specific behaviour of #35, especially as no reason other than "it's in the spec" was given in #35, while no spec was linked.
Also a spec is only as useful as their implementations.

I am afraid of adding even more complexity, like deciding whether a test suite has multiple classes and dynamically having different behaviours in ClassResult.tally() as a result.
Especially when I can't see the benefit.
It would make this PR even harder to get in.

Of course, if those changes of #35 also fixed a bug themselves when that would be different.

@jmarnold1021 could you please chime in on the class duration changes you introduced with #35?

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

I am not convinced this is a right fix. It just reverts the breaking change (though it could be a proper hotfix). IMHO it would be better to have a proper parsing of floats instead

@mfuchs
Copy link
Contributor Author

mfuchs commented Apr 25, 2017

In what way is the issue related to parsing floats so that I could look into that?

Btw. do you have a link to the JUnit XML specification? I am probably just too darn blind to find it.

When running Android tests the <testsuite> in the generated xml file
can contain multiple classes.
Thus setting the test class duration to the value of the test-suite is wrong.

Instead the class duration is now calculated as sum its test cases.
This is the same way it was done before jenkinsci#35 was merged.
Reverting parts of both jenkinsci#35 and jenkinsci#54 did not break any existing tests.
@oleg-nenashev
Copy link
Member

Here is a good thread about processing thousand separators via DecimalFormat in Java: https://stackoverflow.com/questions/4323599/best-way-to-parsedouble-with-comma-as-decimal-separator

The discussion is not so motivating though. The format depends on the locale of the input file, and I am not sure how to extract it reliably from XML.

@mfuchs
Copy link
Contributor Author

mfuchs commented Aug 25, 2017

I am not sure how this PR is related to parsing floats.
The only difference is what floats are summed: In my case I sum the time (floats) of the testcases belonging to a class, while the existing code sums the time (floats) of the whole testsuites.

The existing code assumes that one testsuite always represents one class.
This is not the case when running tests on android devices, e.g. the android emulator.

@abayer
Copy link
Member

abayer commented Nov 9, 2017

@mfuchs I wonder if it might make sense to use the SuiteResult durations if and only if every CaseResult in those SuiteResults is in this ClassResult, and otherwise use the CaseResult durations?

@mfuchs
Copy link
Contributor Author

mfuchs commented Nov 19, 2018

@oleg-nenashev can you please re-review this PR? I don't think that your review comment applies here as I never parse floats.

@mfuchs
Copy link
Contributor Author

mfuchs commented Nov 19, 2018

@abayer I am not sure what the benefit of the added complexity would be.

@mfuchs
Copy link
Contributor Author

mfuchs commented Nov 19, 2018

@olivergondza Can you please also review this PR?

@olivergondza
Copy link
Member

The way I understand it is the ClassResult and SuiteResult are orthogonal views of a set of CaseResults - one grouped per declaration class, the other per report file. Hence it appears correct to me to iterate over the nested CaseResults in both cases instead of depending on the fact that specific relationship exists between ClassResult and SuiteResult.

And this appears what the fix is trying to achieve.


@abayer, I do not see why that would not work but it is more elaborate compared to ignoring SuiteResult for computing ClassResult's duration time entirely. Does it provide more accurate results or why would we want to do that?


@oleg-nenashev, please elaborate on how float parsing is related. We suspect that it is not...

@oleg-nenashev oleg-nenashev dismissed their stale review January 21, 2019 14:18

I have no memory of this place

@olivergondza
Copy link
Member

@abayer, any comments? I am tempted to merge this...

Copy link
Member

@abayer abayer left a comment

Choose a reason for hiding this comment

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

Fine by me!

@olivergondza olivergondza merged commit 3985983 into jenkinsci:master Jan 29, 2019
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.

None yet

5 participants