精通 Java 單元測試( Unit Testing ) – 使用 Spring Boot 和 Mockito

在 40 個簡單步驟內學習用 Spring Boot、 Mockito、 JsonAssert、 Hamcrest 和 JsonPath 編寫出色的 Java JUnit 單元測試

從這 4 小時的課程,你會學到

  • 你將學習使用從零開始的 Spring Boot Starter Test 編寫很棒的單元和整合測試
  • 你將學習如何在 Web、業務和資料多層架構下為 RESTFUL Web 服務編寫獨立的單元測試
  • 你將學習使用最重要的單元測試注釋 ( ANNOTATIONS )-@springboottest,@webmvctest,@datajpatest 和@mockbean
  • 在 Spring Boot Starter Test 中使用所有的框架-JUnit,Spring Test,Spring Boot Test,AssertJ,Hamcrest,Mockito,JSONassert 和 JsonPath
  • 你將學習使用 MOCKITO 建立的 MOCKS 和 SPYS 編寫單元測試
  • 你將學習使用使用一個記憶體資料庫 H2 編寫整合測試

要求

  • 你有一種樂在其中的學習態度
  • 你應該具有 Java、 Junit、 Spring、 Spring Boot 和 JPA / Hibernate 的工作知識
  • 我們將幫助您安裝 Eclipse,並啟動和執行 Maven 和 Tomcat

課程說明

偉大的程式設計師編寫偉大的單元測試。想為 Spring Boot REST API 編寫偉大的單元測試?

Spring Boot 測試? ? 是的。 分層單元測試 ? ? 是的。 當然。 Spring Boot 整合測試? 是的。

Mockito? 是的。 JsonAssert, Hamcrest Matchers 和 JsonPath? 是的。 包括在內。

******* 學習者的一些評論 *******

★★★★★ This a very comprehensive introduction to spring boot test, which brings Mockito, Junit, JsonAssert, Spring Data JPA, REST, design pattern, and many more. Very valuable course. Thanks.

★★★★★ Excellent and to the point course on Unit testing with good references.

★★★★★ This is an excellent course for both beginners as well as experienced Java developers who which to hone their skill. The instructor was very knowledgeable and knew how to keep the course engaging while providing lots of tips. Highly recommended…

★★★★★ Great Course to learn Junit Testing. Great content and great examples to explain each scenarios of writing test cases. If you want to write java test cases then definitely go through this course.

★★★★★ This course is a great introduction to unit and integration testing using Spring Boot, Mockito, and a number of other libraries that can help to write effective tests. It is easy to follow along with and has plenty of references where to look for more information.

★★★★★ Needed it for new client project. Excellent source of concise tutorials for JUnit of microservices.

★★★★★ I was drowning in unit test concepts and this course cleared up what read about them. And have a simple but clear explanation of when is good and how to create unit test in your app.

******* 課程概觀 *******

Spring Boot 是開發 RESTful 服務最流行的框架。 它透過 Spring Boot Starter Test 具有了不起的單元測試能力。 是最流行的 mocking 框架。 JUnit 是最流行的 Java 單元測試框架。

在本課程中,你將學習使用 Spring Boot Starter Test、 Mockito 和 JUnit 編寫簡單 RESTful 服務的優秀單元測試。 你將學習為 RESTful web 服務和 Web、業務和資料等多層對話編寫獨立單元測試。 你將學習如何使用記憶體資料庫 H2 編寫整合測試。

你將一步一步地建構單元測試——40個簡單的步驟。 本課程是介紹使用 Spring Boot 和 Mockito 框架進行單元測試的完美第一步。

你將使用記憶體資料庫 H2 和 Tomcat Embedded Web Server 中使用 Spring (相依管理)、 Spring Boot、 Maven (相依管理)、 Eclipse (IDE)。 我們將幫助你建立每一個這些。

你將使用 Spring Boot Starter Test 的所有框架-JUnit、 Spring Test、 Spring Boot Test、 AssertJ、 Hamcrest、 Mockito、 JSONassert 和 JsonPath。

你將學習使用最重要的單元測試 Annotations -@runwith (SpringRunner.class)、@springboottest、@webmvctest、@datajpatest 和@mockbean。

******* 每一個 in28Minutes 的課程你能期待什麼 *******

in28Minutes 建立了20個最暢銷的課程,為全世界25萬名學習者提供了令人驚歎的學習經歷。

這些課程都附帶了

令人驚奇的實踐經驗,一步一步學習

使用最佳工具和框架的實際專案經驗

200 + FAQ 回答疑難解答指南

在問答部分提供友好的支援

完成課程後的 Udemy 證書

~~~ 對 in28Minutes 的一些評價 ~~~

★★★★★ Excellent, fabulous. The way he has prepared the material and the way he teaches is really awesome. What an effort .. Thanks a million

★★★★★ A lot of preparation work has taken place from the teacher and this is visible throughout the course.

★★★★★ This guy is fantastic. Really. Wonderful teaching skills, and goes well out of his way to make sure that everything he is doing is fully understood. This is the kind of tutorial that gets me excited to work with a framework that I may otherwise not be.

★★★★★ The best part of it is the hands-on approach which the author maintained throughout the course as he had promised at the beginning of the lecture. He explains the concepts really well and also makes sure that there is not a single line of code you type without understanding what it really does.

★★★★★ I also appreciate the mind and hands approach of teaching something and then having the student apply it. It makes everything a lot clearer for the student and uncovers issues that we will face in our project early.

★★★★★ Amazing course. Explained super difficult concepts (that I have spent hours on the internet finding a good explanation) in under 5 minutes.

現在就開始學習,點選註冊按鈕!

******* Step By Step Details *******

第一部分——用 Mockito 學習 Mocking

  • 步驟01: 使用 Spring Initializr 設定專案
  • 步驟02: 為簡單業務服務編寫單元測試
  • 步驟03: 設定一個業務服務來呼叫資料服務
  • 步驟04: 使用 Stub 編寫第一個單元測試
    • 練習-更新測試步驟 2及3
  • 步驟05: 練習方案-更新測試2和3使用 Stubs-Stubs問題。
  • 步驟06: 使用 Mockito 編寫使用 Mocking 的單元測試
    • 練習-更新測試2和3使用 Mockito
  • 步驟07: 練習解決方案-更新測試2和3使用 Mockito
  • 步驟08: 更多的重構 -@mock,@injectmocks 和@runwith (MockitoJUnitRunner.class)
  • 步驟09: Mockito 提示-多個返回值和特定引數匹配器
  • 步驟10: Mockito Tips-Argument Matchers
  • 步驟11: Mockito 提示-驗證方法呼叫
  • 步驟12: Mockito Tips-Argument Capture
  • 步驟13: Mockito 提示-捕獲多次呼叫的引數
  • 步驟14: Spy 入門
  • 步驟15: Mockito FAQ

第二部分——基於 Spring Boot 和 Mockito 的 RESTful 服務單元測試

  • 步驟 01: 建立 Hello World 控制器
  • 步驟02: 使用 Mock Mvc 測試 Hello World Controller
  • 步驟03: 使用響應匹配器檢查狀態和內容
  • 步驟04: 在專案控制器中建立基本 REST 服務
  • 步驟05: 單元測試專案控制器和基本 JSON Assertions
  • 步驟06: 更深入地挖掘 JSON Assert
  • 步驟07: 編寫一個與業務層對話的 REST 服務
  • 步驟08: 為 REST 服務模擬( mocking )業務層編寫單元測試
  • 步驟09: 使用 JPA、 Hibernate 和 H2準備資料層
  • 步驟10: 建立專案實體並使用 data.sql 填充資料
  • 步驟11: 建立一個與資料庫通訊的 RESTful 服務
  • 步驟12: 為 Web 層編寫單元測試-Controller-Using Mock MVC
  • 步驟13: 練習和解決方案-為業務層編寫單元測試-Mocking
  • 步驟14: 為資料層編寫單元測試-資料 JPA 測試
  • 步驟15: 使用@springboottest 編寫整合測試
  • 步驟16: 提示: 使用@mockbean 模擬你不想交談的相依項!
  • 步驟17: 提示: 建立不同的測試配置
  • 步驟18: 為其它請求方法編寫單元測試
  • 步驟19: 使用函數語言程式設計重構一些商業邏輯
  • 步驟20: 更好的 Assertions 與 hamkrest-HamcrestMatcherTest
  • 步驟21: 使用 AssertJ 做更好的 Assertions – AssertJTest
  • 步驟22: 使用 JSONPath 做更好的Assertions -JSONPathTest
  • 步驟23: 簡化靜態匯入
  • 步驟24: 提示: 使用 Eclipse 測量測試覆蓋率
  • 步驟25: 提示: 關注單元測試的效能!
  • 步驟26: 好的單元測試

現在就開始學習,點選註冊按鈕!

目標受眾

  • 你是一個 Spring / Spring boot / Java 程式設計師,你想要為你的 RESTful 服務寫一個很棒的單元測試
  • 你需要編寫使用 mocking 的很棒單元測試
  • 你希望瞭解使用 JUnit、 Mockito 和 Spring Boot Starter Test 編寫優秀單元測試的最佳實踐
  • 你需要學習使用 Hamkrest Matchers、 JSON Assert、 Assert j 和 JSON Path 庫編寫偉大的 asserts

講師簡介

in28Minutes Official Learners – Java, Spring, Full Stack – React & Angular ( 更多講師主講課程介紹 )

關於我 我是 Ranga Karanam,與世界各地的主要銀行客戶進行15年的 Java 程式開發和設計的架構師。 我們創立 in28Minutes 是想要創造與真實世界專案相關的實踐課程。逐步指引系列是我們的創作之一。

關於 in28Minutes  

我們使用基於問題解決方案的逐步實踐方法,結合實際的實用案例。 雖然我們的主要專長是 Java 和相關框架(Spring、Spring Boot 、Spring MVC、Struts、Hibernate)的開發、設計和架構,但是我們正在擴展到前端世界(Bootstrap、JQuery、Angular JS)。

我們的信仰

最好的課程是互動和有趣的。 建立高品質應用的基礎最好是在學習的時候培養。

我們的方法

我們喜歡自由軟體,因此,我們所有的程式碼也是開放的,並且可以在 Github上取得。 我們使用 80-20 法則,我們對 20% 重要事物用 80% 的時間深度說明。我們並簡述其他的東西,給你裝備足夠的知識,以便你能自己學得更多。基於問題解決方案的逐步實踐學習。

英文字幕:有

  • 想要了解如何將英文字幕自動翻譯成中文? 請參考這篇 How-To

  • 點選 ✨ 週四週五兩天大多課程 NT320 優惠連結 ( 需登入 Udemy 取得 )| Udemy 永久擁有課程 ( 在電腦瀏覽器登入,點選“優惠連結”後再回想要的課程介紹中點選“報名參加課程”即可取得 )
  • Udemy 現在越來越多課程有中文字幕,請參考 Soft & Share 中文線上課程
  • 手機上點選優惠連結看到的價格比電腦上看到的貴
  • $代表當地貨幣, 如在台灣為 NT
  • 點選”報名參加課程”有可能因瀏覽器 cookies 轉久一點或回報錯誤而無法連上,請稍等刷新或重新點選就會出現

報名參加課程

Sponsored by Udemy


也許你會有興趣


幫我們個小忙!

請為我們的網站評分(必)

使用 e-mail 追蹤 Soft & Share

Comments are closed.

Powered by WordPress.com.

Up ↑

探索更多來自 Soft & Share 的內容

立即訂閱即可持續閱讀,還能取得所有封存文章。

Continue reading