文章詳情頁
Springboot整合junit過程解析
瀏覽:16日期:2023-05-18 18:54:48
對maven項(xiàng)目的pom.xml進(jìn)行配置
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions><!--junit5不需要配置junit-vintage-engine--> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions></dependency>
測試類如圖所示

junit5可直接掃描測試的主啟動類 也不需要加@runwith注解 只需要加@SpringBootTest 注解 也不需要指定主啟動類的class文件

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
標(biāo)簽:
Spring
相關(guān)文章:
1. intellij idea寫Python教程2. Vue+ssh框架實(shí)現(xiàn)在線聊天3. HTML iframe標(biāo)簽用法案例詳解4. CSS單標(biāo)簽實(shí)現(xiàn)復(fù)雜的棋盤布局5. HTML基礎(chǔ)知識總結(jié)6. PHP對接阿里云虛擬號的實(shí)現(xiàn)(號碼隱私保護(hù))7. 利用Python實(shí)現(xiàn)最小二乘法與梯度下降算法8. 使用本機(jī)IIS?Express開發(fā)Asp.Net?Core應(yīng)用圖文教程9. PHP文件運(yùn)行步驟以及數(shù)據(jù)庫的連接代碼10. 如何在Vue中使localStorage具有響應(yīng)式(思想實(shí)驗(yàn))
排行榜

網(wǎng)公網(wǎng)安備