How to run Clojure-tests in Eclipse? - java

I'd like to execute my Clojure tests directly from eclipse (alternative would be to run lein test from the commandline).
I already installed the CounterClockwise-Plugin for Eclipse, but there is no "Run as / Clojure test" in the context-menu. So far I added a (run-tests) to the end of my Clojure-tests files and execute the test via "Run as / Clojure Application".
Is there a better way to run tests from eclipse? In general it shouldn’t be necessary to add code to start the tests.

You can open a project REPL in Eclipse, move the REPL to the test namespace and (run-tests) from there.

Related

How can I see the actual commands (java) running in Intellij Idea?

I use IntelliJ IDEA CE in two environments (CentOS and Ubuntu).
The two share a project via GitHub.
In CentOS, the project is regarded as Java project? with a file build.gradle.
In the other, the project is fully managed as Gradle-Java project.
When I run a main method in CentOS, IDE just runs Java (after some compiles if are required)
On the other hand, when I run the same main method in Ubuntu, IDE activates Gradle and run that.
I think this difference happens from the module structures.. which I have not tried though....
(Am I wrong?)
One question I really want to know here is,
in CentOS, when I run a code, it shows how IDE ran the code in the Run window, like...
java [too many options] foo.target.Hoge
If I copy and paste this line, I can activate foo.target.Hoge anywhere, even where I do not set CLASSPATH because [too many options] contain that.
I always do it (I am afraid if I should not though)
However, in Ubuntu (Gradle-based environment)
the windows show only
time PM: Executing task 'Hoge.main()'...
I can not copy, paste and run it...
I want to know where I can found the actual command activated.
or.... using Gradle.. are there any simpler ways?? like
gradle run Java Hoge ...
When I run a main method in CentOS, IDE just runs Java (after some compiles if are required) On the other hand, when I run the same main method in Ubuntu, IDE activates Gradle and run that.
For Gradle-based projects this behaviour is controlled in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Build and run using option. When Gradle is set IDE uses Gradle to run and build the project. When IntelliJ is set IDE uses it's own builder and Run/Debug Configurations to run.

intellij builds java project when run groovy script

I just wanted to run quick groovy scratch file and now my Intellij is building my multi-module project because there are codegen tools and it feels like generating missing classes on each run is obligatory. But I just want to run the script, fast, that's why I used scripting language in first place!
I dont have a groovy compiler and cannot get it, so I have to use javac
And default configuration on Run is "java -Dmaven.allTheOptions etc" and I just want it to execute script when I press the hotkey
The answer is:
Run -> Edit Configurations... -> Defaults -> Groovy -> Before launch -> Press "Remove" on Build configuration
Groovy can be built to a jar file, and run that way if you just have Groovy as a dependent library. If you want to run groovy as a script, I would use sdkman to download Groovy,so you can run it without compiling:
https://sdkman.io/install
Alternatively you can download Groovy manually, and add it to your path like Java:
http://groovy-lang.org/download.html
Once you have Groovy installed, you can run groovy scripts from the command line, or ues the groovyConsole.
I don't understand why you can't download Groovy, and have to use Javac.As macg33zr mentioned Intellij does have a Groovy console built-in, although I don't remember if it requires a Groovy install, but it probably does.

How to attach a debugger of a java program, which is run by using ant, to Eclipse?

So I have a java program, for which, I have an ant script to run. I know how to enable the debugging option in the ant script, by adding two parameters (-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5432) to the ant's java task.
After adding those parameters to the java task in ant, I open the ant view in eclipse, right-click on the target I want to debug, and choose "debug as" -> "ant build".
Now, I need to attach this debugger to that same eclipse (which runs on the same machine), so that it will take me to the java code, and I can debug it line by line.
The two questions are: 1) how to attach that ant debugger to eclipse? and how to run it?
I found this question (How to debug Java code when using ANT script in Eclipse), but it does not explain how to attach an ant debugger to eclipse, and how to run.
I know, you may ask, why don't I just debug the java program directly on eclipse? The thing is, the program is quite large, have a lot of junit suite tests, and we use ant to run those tests. The ant was written by some other developer.
Thanks
You don't debug the ant script. You just run the ant script, even from the command line.
You then create a "Debug Configuration" in Eclipse to a "Remote Java Application", specifying the port number (5432).

Launch selenium webdriver test from terminal in linux

I wrote a simple regression test for a website with a little GUI to launch the test. Works fine in eclipse but for some reason it will stall after pressing the launch button on the GUI when I try to run it from the terminal. The web driver will launch firefox but the page stays blank when its supposed to go to the URL of the site I'm testing. I believe this has to do with error in configuring the classpath, I have the following in a shell script
javac -classpath ":ojdbc6.jar:selenium-server-2.33.0.jar:selenium-server-standalone-2.33.0.jar" Test.java
java -classpath ":ojdbc6.jar:selenium-server-2.33.0.jar:selenium-server-standalone-2.33.0.jar" Test
Why does it stall and how to fix it?
I use the Junit ant task to run my tests. It will run my tests and print a nice looking html report at the other end for clear results.
Use Ant or Maven build tool with Junit or TestNG framework as both framework has capability of running test from terminal and generating nice html formated report. Here is a sample project with ant build script you can get from my github account.

how to run playframework FunctionalTest through Eclipse?

and the second question:
is it possible to run them all in a bunch through Eclipse?
One approach could be, Install 'antify' module and run 'play antify' on your application. It will create a build.xml for your app (which would import the needed targets from application-build.xml file) and run 'auto-test' from eclipse.
FunctionalTest and UnitTest extend BaseTest, which is annotated with the PlayJunit4TestRunner, so you should find that you can just run tests as you would with any other test (i.e. Run As > Junit Test). You'll see the Play environment being initialised on the console before the tests actually run.
One problem I've found is that running a whole package of Play tests in Eclipse is buggy, so I tend to just run one at a time in Eclipse and then use Play's own testrunner to verify the whole suite.

Categories

Resources