Skip to content

fix flaky tests in DataFieldConverterTest.java#1

Open
FanYuliang wants to merge 5 commits into
masterfrom
fix_flaky
Open

fix flaky tests in DataFieldConverterTest.java#1
FanYuliang wants to merge 5 commits into
masterfrom
fix_flaky

Conversation

@FanYuliang
Copy link
Copy Markdown
Owner

@FanYuliang FanYuliang commented Oct 18, 2021

Hi,

Since there was no response to hneemann#866, I'm also opening this PR but can revise it if you want.
Also, this PR is related to hneemann#870, but fixed more flaky tests in DataFieldConverterTest.java

By running the following command:
mvn install -DskipTests,
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=de.neemann.digital.core.memory.DataFieldConverterTest

Three tests testMarshalObj, testMarshalObj2, testMarshalObj3 in de.neemann.digital.core.memory.DataFieldConverterTest will fail sometimes.

The reason is that method xStream.toXML() in com.thoughtworks.xstream.XStream is not deterministic: Xstreamer.toXML(object) method first serializes the object using HashMap and then convert the XML object to string in the order of keys in the HashMap. I fixed the flakiness by checking whether the actual output is in the expected list, which contains all the possible XML combination orders.

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.

1 participant