How to run Junit Test (Java) from VSCode - visual-studio-code

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
Test Runner for Java
Language Support for Java(TM) by Red Hat
Maven for Java (if you have any dependencies)
Debugger for Java
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

Related

Not able to run Gatling from Eclipse

I downloaded sample Gatling maven project from here . I am able to run test from command-line but I also would like to run it from Eclipse.
I imported project to Eclipse as existing maven project and I installed Scala IDE. The documentation says: "Simply launch the Engine class in your IDE." And the question is how I can run that Engine class? Should I create new configuration to run it? Could anybody explain it please?

Eclipse cannot run Spock tests with source folder disappearing

I've encountered a very curious case about Eclipse and Spock tests.
I have Eclipse 4.5.2 (Build id: 20160218-0600) with Groovy compilers plugins installed, Groovy-Eclipse M2E Integration and Groovy-Eclipse Feature, all in version: 2.9.2.xx-201604081629-e45.
In this Eclipse I have a maven project configured to compile and run Spock tests. In Eclipse I have src/test/groovy folder configured as a source folder and it is holding my spock tests. Both maven and Eclipse can run the tests just fine.
Recently my friend has had a problem with the same setup, so I tried to reproduce it. And now I have the same Eclipse 4.5.2 (Build id: 20160218-0600) with Groovy plugin (and this is the weird part, I used the same update site for these plugins but the build version is different, it is: 2.9.2.xx-201607251752-e45). I imported the same maven project, however, when I try to run Spock tests the curious thing happens: the src/test/groovy source folder dissappears from the project and on the console I can see ClassNotFoundException with the name of the Spock test class. Here is a short summary how it looks like:
We tried the same also in Eclipse Neon and Spring STS and we have the same result. (In IntelliJ the same project runs just fine).
I'm starting ti thing that this may be related to the Groovy plugins, which might have got changed in the latest build and a bug was introduced. However, I hope I am mistaken.
Any thoughts?

Show build output when running a Java project in NetBeans

I created a small Java project in NetBeans. When I run it, there appears no compiler log.
I'd like to see the compiler output even when I decide to run the project. How can I enable it?
In NetBeans Menu/Window/Output

JUnit4 plug-in and build path for junit.jar in Eclipse

I've got Eclipse (Helios) installed along with the JUnit3, JUnit4 and Java Development Tools plug-ins for some Android development.
I've created some unit tests but the only way they run (without throwing a java.lang.ClassNotFoundException for org.junit.Test) is if I add an External JAR to the test project build path for junit.jar from the normal JUnit install I have.
Why isn't Eclipse able to reference the junit.jar from the JUnit4 plugin which I can see when I expand the library in Package Explorer? In fact I can remove the JUnit4 Library from the test project leaving just the External JAR and the tests run fine.
I tried adding the path to the plug-in folder to my CLASSPATH system environment variable as I had to setting up JUnit but this made no difference. The plugin path is created as a JUNIT_HOME Classpath Variable in Eclipse but this is labeled as deprecated.
Do I even need the JUnit3 and JUnit4 plugins as these must have come with the distro I used?
In any new project, the sure way I add the required Junit deps (with the exception of declaring them in maven) is through creating the test using the in-built Junit test shortcut.
Go to New > Junit Test Case. If the right deps are not on the project classpath, eclipse will pull them in automatically.

Groovy + Eclipse

I have a simple question regarding groovy with eclipse. I downloaded the plugin as mentioned and i didnt have problems with installations but i have compiler errors in hello p. the problem in my opinion that eclipse isnot using the groovy compiler. but i have no idea what to do
Is the filename extension .groovy?
Are you sure the project has the Groovy nature? (right-click on the project, and ensure Remove Groovy Nature appears. If Add Groovy nature appears, then the project doesn't have a groovy nature, and therefore the groovy compiler won't work).
Could you also post the file that isn't compiling. There might be something wrong with what you typed.
Make sure you are opening the file in a Groovy editor.
Look for any exceptions in your error log.
Also, just in case, you can try uninstalling and reinstalling the plugin. I'd recommend using the latest milestone version as that one is about to be promoted to 2.1.2 final.
http://dist.springsource.org/milestone/GRECLIPSE/e3.6/
I confirmed that Groovy plugin isnot workingn on mac. I tried it on 2 machines and they are giving the same error. Groovy plugin is working on windows without problems :)
NetBeans is a better option for Groovy+Java development. You can mix Java and Groovy files in a Java project in NetBeans. It also creates a distributable jar for your project. No classpath and jar issues with NetBeans created MET-INF file.