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

Fixed two non deterministic tests #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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