Add the Java package junit unit test in the IDEA

1.junit Download

  1. I used here is IDEA2018.2.8 version, junit-4.10.jar use.
  2. junit-4.10.jar download link
    link: https: //pan.baidu.com/s/1LN18YKLSd1UxB0ihZO6sAw
    extraction code: umio

How to add a package junit in 2.IDEA

  1. Select File-Project Structure in the IDEA (directly or use the shortcut ctrl + alt + shift + s open), click on the far right of the + sign, select jars or directories.
    Here Insert Picture Description
  2. Here find their own path Click OK to jar package.
    Here Insert Picture Description

3. Basic use code

  1. Import junit test class package, class name generally based Test beginning. Add the code in the class to run "@Test" can, IDEA in this method before writing.
import org.junit.Test;
public class TestJunit {
@Test
    public void test(){
        System.out.println("junit test");//输出:unit test
    }
}
Released seven original articles · won praise 16 · views 2905

Guess you like

Origin blog.csdn.net/qq_45920729/article/details/104403165