美文网首页
Junit学习笔记

Junit学习笔记

作者: KlingelModerat | 来源:发表于2019-04-12 17:02 被阅读0次

1.JUnit - 基本用法

使用原因:测试就是检验实际输出是否符合预期。只有经过验证的代码才能上生产。通过单元测试,可以极大的减少人工黑盒测试的劳动量。

Junit是一个单元测试框架。主要就用来完成单元测试的基本功能。各个IDE也都提供了很好的支撑。在Maven中也有对应的流程体现。

基本上已经是事实的标准了。

2.SpringBoot使用Juint

依赖:

<dependency>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-test</artifactId>

    <scope>test</scope>

</dependency>



测试类:

import lombok.extern.slf4j.Slf4j;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.boot.test.context.SpringBootTest;

import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)

@SpringBootTest//(classes = WebBootApplication.class)

@Slf4j

public class WebBootApplicationTests {

@Autowired

    IntervieweeServiceintervieweeService;

@Test

    public void queryIntervieweeInfoTest(){

Account account =new Account();

account.setTel("");

account.setMail("1328912651@qq.com");

Interviewee interviewee =intervieweeService.queryIntervieweeInfo(account);

log.info(interviewee.toString());

}

}

相关文章

  • Junit学习笔记

    1.JUnit - 基本用法 使用原因:测试就是检验实际输出是否符合预期。只有经过验证的代码才能上生产。通过单元测...

  • Junit 学习笔记

    [TOC] Junit 学习笔记 1. 编写测试用例时需要注意 测试方法上必须使用 @Test 进行修饰 测试方法...

  • Junit4 源码分析(本文只是汇总链接)

    链接 Junit源码阅读笔记一(从JunitCore开始) Junit源码阅读笔记二(Runner构建) Juni...

  • Junit4学习笔记

    必要的包 org.junit.* import static org.junit.Assert.*; 可选的Ham...

  • 自我提升计划

    * Spring文档学习 * junit的源代码学习

  • Junit学习

    本文是对唯鹿_Android单元测试(一):JUnit框架的使用的学习笔记 需要进行测试的工具类 1.用单个数据进...

  • JUnit学习

    What is Junit?Junit is a simple framework to write repeat...

  • PHPUnit学习笔记

    PHPUnit学习笔记 PHPUnit是一个轻量级的PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整...

  • JDBC

    最近学习了Java中的JDBC,做个总结~~ 1.Jdbc基础准备 junit(单元测试的工具) Junit单元测...

  • Android 测试快速入门

    在正式学习Android应用测试之前,我们先来了解以下几个概念。 JUnit JUnit是一个Java语言的单元测...

网友评论

      本文标题:Junit学习笔记

      本文链接:https://www.haomeiwen.com/subject/enkduqtx.html