bingx1 opened a new pull request, #790:
URL: https://github.com/apache/maven-surefire/pull/790

   This PR fixes the bug described in 
https://issues.apache.org/jira/browse/SUREFIRE-2277
   
   **Problem**
   
   There is a bug in `RunResult.testAppendSerialization`. 
   
   This test creates a `RunResult` object in-memory, serialises it, writes it 
to disk and then again deserialises the same file into a `RunResult` in-memory. 
I have run the test with the debugger and found that the final in-memory 
`RunResult` object is not the same as the initial one.
   
   It shouldn't be passing on master, but is due to a bug in the 
`RunResult.equals` method which is used in an assertion in the test. The source 
of the bug is that the value of `RunResult.flakes` isn't preserved during 
serialisation to and from `failsafe-summary.xml`. The bug is slipping through 
and the test passes because the `RunResult.equals` method doesn't consider the 
`RunResult.flakes` field. 
   
   
   
   **Fix**
   
   I have modified the `failsafe-summary.xsd` to include an _optional_  
`<flakes>` element,  which will allow `RunResult.flakes` to be persisted in the 
`failsafe-summary.xml` during serialisation. I have also changed the 
serialisation and deserialisation methods for `RunResult` to account for 
`flakes`. 
   
   I have also added a test, `RunResultTest.testLegacyDeserialization` for 
backwards compatibility. It tests that deserialising a legacy 
`failsafe-summary.xml` still works. The behaviour is that when the `flakes` XML 
element is not present in the `failsafe-summary.xml`, the in-memory `RunResult` 
will have `RunResult.flakes` set to 0 after deserialisation.
   
   -----
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SUREFIRE) filed 
          for the change (usually before you start working on it).  Trivial 
changes like typos do not 
          require a JIRA issue.  Your pull request should address just this 
issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line 
and body.
    - [ ] Format the pull request title like `[SUREFIRE-XXX] - Fixes bug in 
ApproximateQuantiles`,
          where you replace `SUREFIRE-XXX` with the appropriate JIRA issue. 
Best practice
          is to use the JIRA issue title in the pull request title and in the 
first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the integration tests successfully (`mvn -Prun-its clean 
install`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 
2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
    
    Our company, Atlassian, has a corporate CLA signed, and we added our team 
to it.
   Contributors: Alex Courtis, Bing Xu and Hubert Grzeskowiak
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to