fix: flakiness in org.json.junit.JSONMLTest#testToJSONObject_reversibility#1
fix: flakiness in org.json.junit.JSONMLTest#testToJSONObject_reversibility#1
Conversation
|
Hi, Cause: Describe the underlying issue or bug that this pull request aims to solve. And include some code snaps in your PR description can make it easier for others to know the root cause of the flaky test and how to fix it. |
|
hey @Einsteinnnnn , I just updated the format of my Pull Request, thanks for the feedback, I appreciate it! |
|
Is this test close to the test fixed here? #2 You can consider fix them in one PR so that the added dependency looks more worth it. Also you used some other dependency here #3 Maybe you want to open one real PR first to kinda see if the developers are okay with the dependency or not. But anyway, it's all your call. Feel free to do anything. Once you open a real PR, please mark this tentative PR as |
Problem:
The string in the assertion can change, because the Map which is used to store the data in the JSONObject returns the data in non-deterministic order.
The flaky test was found by using the NonDex tool.
Solution:
Change the assertion is to a JSONAssertion (e.g. the order of child elements in an element do not matter)
Result:
The test is deterministic and not flaky. This improves the quality of the test and reduces the time to search for the bug during future development.
Reproduce: