|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/unit-testing-and-integration-testing/
课程评论:没有评论
**课程名称:** Developing Real-Time Spring Boot Unit & Integration Testing **课程概述:** 本课程旨在帮助学习者掌握使用Spring Boot进行高效单元测试和集成测试的技巧。Spring Boot是构建企业级Java应用程序最流行的框架,其内置的测试支持可以利用JUnit、Mockito和MockMvc等工具。通过学习本课程,您将能够创建出设计更优良、Bug更少、可靠性更高的应用程序。 **课程内容涵盖:** * **JUnit测试开发:** * 项目JUnit环境搭建 * JUnit断言:Equals/Not Equals, Null/NotNull, Same/Not Same, True/False * JUnit生命周期注解的运用 * 定义JUnit自定义显示名称 * 异常和超时的检查 * 定义JUnit测试的执行顺序 * JUnit测试的代码覆盖率分析 * JUnit的条件化执行 * **测试驱动开发 (TDD):** * 运用TDD编写测试和应用程序代码 * 先创建失败的测试(RED) * 更新代码使测试通过(GREEN) * 将测试从RED转为GREEN * 将TDD应用于实际编码项目 * 利用参数化测试进行TDD * **Mockito Mocking:** * 识别测试开发中Mocking的需求 * 在JUnit测试中运用Mockito * 使用`@MockBean`注解进行Mock注入 * 通过Mock抛出异常 * **数据库集成测试:** * 识别数据库集成测试的需求 * 使用`@BeforeEach`和`@AfterEach`注解进行数据库设置和清理 * 利用嵌入式数据库简化测试设置和维护
Spring Boot:Is the most popular framework for building enterprise Java applications. Spring Boot includes testing support to develop unit tests and integration tests using JUnit, Mockito and MockMvc. By developing tests, you can create applications with better code design, fewer bugs, and higher reliability. This course shows you how to take full advantage of Spring Boot's testing support.JUnit: Develop JUnit TestsSet up projects to use JUnitApply JUnit assertions: Equals/Not Equals and Null/NotNullApply JUnit assertions: Same/Not Same and True/FalseLeverage JUnit lifecycle annotationsDefine custom display names for JUnit testsCheck for exceptions and timeoutsDefine execution order in JUnit testsPerform code coverage analysis for JUnit testsApply conditionals with JUnit testsTest Driven Development (TDD): Apply Test Driven Development for build tests and application code.Create a failing test first.Update your code to make the tests pass.Take your tests from RED to GREEN.Apply TDD to a coding project.Leverage parameterized tests with TDD.Mocking with Mockito:Identify the need for mocking during test developmentLeverage Mockito in JUnit testsApplying the @MockBean annotation for injectionThrowing exceptions with MocksDatabase Integration Testing:Identify the need for database integration testing during test developmentAdd database setup and clean code using @BeforeEach and @AfterEachLeverage an embedded database to ease with testing setup and maintenance.