Introduction to cell testing technology of j2-unit (1)

Source: Internet
Author: User

Here, we will briefly introduce the concept of cell testing for j2ecunit. Many Reflection-based functions cannot be used because the j2ecs-based environment does not provide Reflection APIs, for example, the function of automatically creating and running testsuite in JUnit.

Introduction to cell testing for j2-unit:

Using unit testing frameworks such as JUnit for unit testing is no stranger to Java Programmers. Using these very effective tools, the quality of code can be effectively monitored and maintained. However, it seems that everything is slightly different on the j2's platform. Because the j2-based environment does not provide Reflection) API, many Reflection-based functions cannot be used, such as automatically creating and running the testsuite function in JUnit. The majority of j2s programmers cannot use JUNIT for unit testing on the j2s platform, but everyone knows how fragile a program without unit testing is!

The j2-unit Unit test is a Unit test framework designed and developed by KentBeck and ErichGamma to imitate JUnit, with a size of 17 kb. Its application provides basic support for compiling well-secured Java program code. Several new mechanisms have been introduced in the j2ecunit Unit test to solve the reflection dependency of the original JUnit. In use, it may be obvious that the j2unit Unit test is not as convenient as JUnit, but we can only use it at this stage, and we are eager to support reflection in the j2s environment. The current version of the j2unit Unit test is 1.1.1. Like JUnit, it is also open-source. You can find its download on sf.net. Compared with JUnit, The j2unit Unit test has not been upgraded for a while. On the one hand, the investment is relatively small, and it may be due to the particularity of the j2it environment, make sure that the LIB to be tested is small enough.

Set up a j2_unit Test Platform:

We use Eclipse with EclipseME as an example to illustrate how to use the j2-unit Unit test.

First download the latest version of the j2ecunit test from sf: http: // j2ecunit test .sourceforge.net and decompress it to your frequently used directory.

Create a MidletSuite and select Project...> Properties...> JavaBuildPath...> Libraries...> AddExternalJARs... Select the j2_unit Unit test. jar file in the download path.

 
In this way, you can use it.


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.