EmbracingJUnitwithEclipse

Junit with Eclipse

1.新增 Junit 5

設定 Build Path

在專案上按右鍵,選擇 Build Path → Configure Build Path。

Configure Build Path

選擇 Libraies »Classpath »Add Libray

 JavaBuildPath

Add Library »» junit

AddLibraryJunit.png

Add Library »» junit5

 AddLibraryJunit-2

加入完成

 JavaBuildPath-2.png

2.Junit 引數設定

1.點選 於 Test.java(測試的類別) 點右鍵 »>Run AS »»Run Configuations

JUnit 測試結果

2.開啟設定

Test runner : 可以選擇 版本

Enbironment : 可以選擇 環境變數

JUnit 執行設定

JUnit 執行結果

參考

Embracing JUnit 5 with Eclipse | The Eclipse Foundation