aqa-tests
aqa-tests copied to clipboard
Add a Mockito Testcase
There are two OpenJ9 user issues where a crash with Mockito is reported:
- https://github.com/eclipse-openj9/openj9/issues/18750
- https://github.com/eclipse-openj9/openj9/issues/18781
The Mockito test case will help us identify the above crashes in our builds.
Test case variant 1: https://github.com/eclipse-openj9/openj9/files/13920987/reproApp.tar.gz
Test case variant 2: https://github.com/eclipse-openj9/openj9/files/13989201/segmentationerror.zip
Dependencies:
Not all dependencies might be needed; and test case variant 2 is simpler and relies on fewer dependencies.
Guidance based on the discussions with the test team:
- The test should be added in https://github.com/adoptium/aqa-tests/tree/master/functional since it can be run with both OpenJ9 and OpenJDK.
- We can create an folder
MockitoTests. - We do not need
testngin this case. - We need
build.xml,playlist.xml, and the test case. - Sample example: https://github.com/eclipse-openj9/openj9/tree/master/test/functional/TestExample.
- 3rd party jars should to be added in adoptium/TKG/scripts/getDependencies.pl#L66-L176.
- Licences of 3rd party jars should be verified before including them into TKG:
- Mockito: https://github.com/mockito/mockito/blob/main/LICENSE
- Byte-buddy: https://github.com/raphw/byte-buddy/blob/master/LICENSE
fyi @llxia
@sophiaxu0424 Please take a look. Thanks
The test should be added under https://github.com/adoptium/aqa-tests/tree/master/functional The example can also be found at https://github.com/adoptium/aqa-tests/tree/master/functional/OpenJcePlusTests You will need to modify both aqa-tests repo and TKG repo.
Hi @babsingh @llxia , having one question for me that how shall I update the command in the playlist.xml, for this Test case variant 1 and 2? My guessing was to dig into the two zip files to get the command details and as my next step, but I am not that too sure... I am seeing an example here from openJCEPlus test command, which has applied a text.xml:
<command>ant -f ${BUILD_ROOT}/functional/OpenJcePlusTests/test.xml -DTEST_JAVA=$(Q)$(JAVA_COMMAND)$(Q) launch_test; \
$(TEST_STATUS)</command>
test.xml
testcase: launch_test
<echo message="Command: ${TEST_JAVA} -cp junit4.jar:hamcrest-core.jar:bcprov-jdk18on.jar:openjceplus-tests.jar --add-exports=java.base/sun.security.util=ALL-UNNAMED --add-exports=openjceplus/com.ibm.crypto.plus.provider.ock=ALL-UNNAMED ibm.jceplus.junit.TestAll" />
Would you please kindly advice some hints on how should I add it for mockito test case next? TIA!
mockito test case is attached in the above issue description.
@sophiaxu0424 any progress on this issue?
https://github.com/eclipse-openj9/openj9/issues/18781 is a dup of https://github.com/eclipse-openj9/openj9/issues/18750. The two test case variant are almost the same. The only difference is that one is directly invoke Mockito.mock(ArrayList.class); in main; and the other using junit to call Mockito.mock(Some.class);.
@babsingh is it necessary to add both cases?
is it necessary to add both cases?
No. Adding one should provide the required coverage.
@babsingh Thanks for clarifying.
Test case variant 1 is added. We can close this issue. Thanks @sophiaxu0424