1.启动类先构建测试类
构建测试代码如下:
package com.imooc.order;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderApplicationTests {
@Test
public void contextLoads() {
}
}
2.需要测试的类的构建测试类
构建好的测试类如下:
package com.aimall.cloud.business.controller.wechat.c.controller.login;
import com.aimall.cloud.business.BusinessApplicationTest;
import com.aimall.cloud.core.wechat.api.dto.vo.login.request.CLoginVo;
import com.aimall.cloud.core.wechat.service.constant.MallConstant;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
imp