Junit in java

How to use Junit in Java

First, Junit refers to unit testing, which is used to test java programs. Can be used to test the code later

Second, how to use Junit

Naming convention: public void method name(){}

Third, the specific realization of the pace

  1. create java class

 

  1. Create a source folder file at the same level as src and create the same package name

 

        2. Create another java class and write it on the method

@Test

 

 

 

      3.    Select the method name and there is a run as---JUnit Test in the right-click menu

The result is as follows:

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325169662&siteId=291194637