For those who want to experience unit testing using JUnit with VS Code for the time being. I haven't even put Java on my Mac yet! Please refer to here.
You can use another JDK, but this time I will use 1.8 for the time being.
First, let's put the Java Extension Pack into VS Code.
This also includes Maven extensions, which are required this time.
After installing the extension, open the command palette with Cmd + Shift + p
and select Maven: Create Maven Project
.
For archtype, select ʻarchtype-quickstart-jdk8. If you are using other than JDK1.8, please select
maven-archtype-quickstart`.
In that case, please note that the execution result after this may change.
I'm just thinking about running JUnit easily for the time being.
For the version, select the latest 2.0.0 for the time being.
You will be asked in which directory to create it, so select any directory. Then you will be asked what kind of project you want to create interactively in the VS Code terminal. This time, I created it as follows.
groupID
is demo, ʻartifactID` is com.demo.
If the creation is successful as described above, the directory structure will be as follows.
ʻWhen you open AppTest.java, the test code will be displayed as shown below. Click
Run Test`.
The test will be run.
Recommended Posts