Two software testing frameworks--junit and NUnit

Source: Internet
Author: User

Today, we present two software testing frameworks--junit and NUnit.

First, JUnit:

Before introducing JUnit, let's take a brief look at the Java class test. Java class testing is an important step in Java application development. Java class tests are divided into basic class tests, combined class tests, and distributed component tests. The JUnit tools are primarily for Java basic class testing and combinatorial class testing.

The Java base class is characterized by the type of the member variable of the class, the type of the parameter of the class method, and the Java base type. The characteristic of a composition class is that a class's member variable type can be a non-Java base type, and the parameter type of a class method can be a non-Java base type. Java Basic class testing is the basis for Java Composite class testing. JUnit has a regression testing framework that facilitates the testing of basic classes and combinatorial classes by Java software Testers.

Junit is mainly composed of the framework, runner, Textui, Swingui, AwtUI packages. The framework package contains all the base classes required by the JUnit test class, which is the underlying framework for the entire junit. The runner package is divided into two parts, defining the interaction form of the Junit test framework and completing the loading of the test class. The Textui, Swingui, and Awtui packages are 3 of JUnit's operating system. The Textui test is the fastest and is the JUnit recommended test execution mode.

Second, NUnit:

The NUnit was transformed by JUnit. There are 5 main object classes in the NUnit framework: The test class, the Testm Ethod class, the TestSuite class, the TestResult class, and the Assert class. The instance object of the test class refers to a test case. The TestMethod class inherits from the test class, and the Run method of all test instances is eventually implemented in the class. An instance object of the Testsuit class refers to a set of test cases. An instance of the TestResult class refers to the result of the TestCase run, which is an abstract class in which two classes inherit from the TestResult class: Testcaseresult and Test-suiteresult.

The basic principles of the NUnit framework are as follows: Place all classes and methods with test properties in a Testsuitetreeview, when a node is selected, create a new instance of the class with the [Testfixture] property of the currently selected node, and then in the Run method, the test method represented by the current node in the instance is called, and the test results are stored in a TestCase result object after running, and then displayed accordingly in the progress bar of the interface.

Two software testing frameworks--junit and NUnit

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.