zoukankan      html  css  js  c++  java
  • SpringBoot Test集成测试

    1.pom,文件添加相关依赖

    如何测试SpringBoot的请求?使用spring-boot-starter-test这个包即可完成测试,SpringBoot项目为什么需要测试本章不作过多说明,重点放在测试代码上。

     <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.12</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>4.3.6.RELEASE</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <version> 1.5.1.RELEASE</version>


    使用说明

    @RunWith(SpringRunner.class)
    @SpringBootTest(classes = MposApplication.class)
    public class TestClass {
        @Autowired
        private TerminalTypeMapper terminalTypeMapper;//注入dao接口
    
        @Test
        public void testFind() {
            System.out.println("测试开始");
            //简单验证结果集是否正确
            TerminalTypeDO type = terminalTypeMapper.getTemrminalNameById(1L);
            System.out.println(type);
    
        }
    相关博客地址:https://www.cnblogs.com/liweipower2015/p/6765137.html
    http://www.jianshu.com/p/5defb8d8e83a
    http://blog.csdn.net/dounine/article/details/72953463







  • 相关阅读:
    Java从入门到实战之(22)数组之练习
    LeetCode343. 整数拆分
    LeetCode64. 最小路径和
    LeetCode120. 三角形最小路径和
    LeetCode37. 解数独
    实验:通过Telnet访问路由器
    telnet 命令使用方法详解,telnet命令怎么用?
    COBIT、ITIL
    500 internal privoxy error错误怎么解决?
    iPhone12有充电器和耳机吗
  • 原文地址:https://www.cnblogs.com/a8457013/p/7815292.html
Copyright © 2011-2022 走看看