If you are looking for software to use, go to Huajun Software Park! software release

Hello, if there is a need for software inclusion, please package the software and attach the software name, software introduction, software-related screenshots, software icon, soft copy, and business license (if you do not have a business license, please provide the front and back of the corresponding developer ID card) and a photo of yourself holding your ID card) and send it to your email http://softwaredownload4.com/sbdm/user/login

Close >>

Send to email:news@onlinedown.net

Close >>

Junit4

Junit4 official version

QR code
  • Software licensing: free software
  • Software size: 1.2MB
  • Software rating:
  • Software type: Domestic software
  • Update time: 2024-11-01
  • Application platform: winall
  • Software language: Simplified Chinese
  • Version: Official version

Download the service agreement at the bottom of the page

Software introduction Related topics FAQ Other versions Download address

Basic introduction
Junit4 segment first LOGO
JUnit is a unit testing framework in the Java language. It has a wide range of functions in programming languages ​​such as Java, C++, and C. Using JUnit can greatly increase your programming efficiency. If you have friends who need Junit, download it and use it immediately.

Junit4 screenshot

Basic introduction

JUnit is a unit testing framework for the Java language. It was founded by Kent Beck and Erich Gamma and gradually became the most successful of the xUnit family derived from Kent Beck's sUnit. JUnit has its own JUnit extension ecosystem. Most Java development environments have integrated JUnit as a unit testing tool. JUnit is a regression testing framework written by Erich Gamma and Kent Beck. Junit testing is programmer testing, the so-called white-box testing, because programmers know how (How) the software being tested completes its functions and what (What) functions it completes. Junit is a set of frameworks. If you inherit the TestCase class, you can use Junit for automatic testing.

Content screenshot

Junit4 screenshot

Import method

  Introduce the method of configuring practical JUnit4 in Eclipse (the same is true for MyEclipse).

1. Right-click on your project and select Properties at the bottom, select Java Build Path in the navigation bar on the left side of the pop-up window, and select Libraries on the upper tab;

Junit4 screenshot

2. Then click Add Library... on the right, select JUnit in the pop-up window and click Next>;

Junit4 screenshot

3. JUnit 4 is selected by default, and then Finish;

Junit4 screenshot

In this way, the JUnit 4 test toolkit is added.

Test method

First, right-click on the class file we want to test->New->Junit Test Case, and a dialog box for creating a new JUnit test case will pop up. You can select the JUnit version, path name and a series of information here, or you can use By default, we select the setUp() and tearDown() functions to perform initialization and garbage collection based on the default configuration;

Junit4 screenshot

Then click Next> to select the functions that need to be tested in the class. We select the four functions plus, minus, times, and divide that we wrote before;

Junit4 screenshot

Click Finish, and a test class named TestCalculate will automatically be created, which contains empty test cases for the corresponding functions. Now you only need to fill in the code of the test content you want to perform.

Junit4 screenshot

After that, we right-click Run As->JUnit Test on the test class to run the test and the results pop up on the left.

Junit4 screenshot

FAQ