Skip to content

Conversation

@yugvajani
Copy link

Fixed 2 non deterministic tests

  • ma.glasnost.orika.test.generator.BeanToArrayGenerationTestCase.testBeanToStringArrayGeneration
  • ma.glasnost.orika.test.metadata.ScoringClassMapBuilderTest.testClassMapBuilderExtension

Steps to reproduce

To reproduce the problem, first build the module core:

mvn install -pl core -am -DskipTests

To identify the flaky test, execute the following nondex command:

  • For testBeanToStringArrayGeneration

mvn -pl core edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=ma.glasnost.orika.test.generator.BeanToArrayGenerationTestCase#testBeanToStringArrayGeneration

The test failure occurred due to random attribute ordering produced by factory.classMap(Clazz, Clazz). When field(fromClassField, toClassField) is not called for all hierarchical attributes, any attributes left unassigned will appear in a random order.
image

The fix involves adding lexographical ordering for all unmapped attributes ( email and id in this case ).

  • For testClassMapBuilderExtension

mvn -pl core edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=ma.glasnost.orika.test.metadata.ScoringClassMapBuilderTest#testClassMapBuilderExtension

The test failure occurred because the fields are not being mapped correctly by default.
image
image

The fix involves specifying explicit mappings for these fields.


For more information : https://github.com/TestingResearchIllinois/NonDex

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