简体   繁体   中英

How to run Junit Test (Java) from VSCode

I have an Eclipse Maven project that uses selenium and Junit to run some tests. It currently works fine when I run it as Junit Test.

I want to try out the ide from visual studio code but I can't get it to work. I am getting the following message:

ConfigError: The project 'CopaSelfWebCheckIn' is not a valid java project.

在此处输入图像描述

I know there is no main folder. I rather run it from where it is right now.

Can someone explain me how to set this up. Thanks.

Make sure you have all the required java extension installed on your VS-Code

Mainly

  1. Test Runner for Java
  2. Language Support for Java(TM) by Red Hat
  3. Maven for Java (if you have any dependencies)
  4. Debugger for Java
  5. Project Manager for Java

All these extensions are packed with a single extension Extension Pack for Java

if you have installed proper dependencies and extensions your vscode will look similar to the below picture

Vscode Java 测试视图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM