Unit test for ABAP and Java

Source: Internet
Author: User

Abap

The execution entry for the ABAP CLASS Unit test, Class_setup, is hard-coded in the Unit Test framework implementation Cl_aunit_test_class.


The unit test method to be executed is returned to an inner table by Cl_aunit_test_class~get_test_methods, then loop the inner sheet and execute sequentially.

Java

The most commonly used maven plugin is maven-surefire-plugin, which can easily trigger unit tests individually or integrate the execution of unit tests into a sub-step of maven build.


Indicates that the following two test case (Srv/test/java/com/sap/testcase) was executed when MVN clean install was performed:

So how does Maven-surefire-plugin know which. The test methods in the Java file need to be executed?
To this directory, open the Maven-surefire-plugin implementation file Surefireplugin.class:
. M2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.20\maven-surefire-plugin-2.20\org\apache\maven \plugin\surefire

Decompile, the answer is found in getdefaultincludes: All Java files that meet the suffix Test*.java, Tests.java, and Testcase.java end are candidates for performing unit tests.

The flexibility of unit testing in Java is that you can assign different category types to different methods in the same class:

Then use the command line MVN install plus parameter-P slowtests to perform only those methods of category slowtests:


For more advanced usage of @category annotations, refer to my SAP Community blog: Run only given sets of your unit test via @Category.

To get more original Jerry's technical articles, please follow the public number "Wang Zixi" or scan the QR code below:

Unit test for ABAP and Java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.