Intellij idea not compiles special classes when running test. Now I run the compilation manually via activator console. How can I customize the intellij idea to run automatically when start a compilation of test?
I'm not sure if I got you right but you can try to right click your test class and choose "Run [your_class]". It will compile the needed classes.
Related
I imported a folder of a java solution but when I try to compile and run there is no option to build and run program in IntelliJ. Normally when right clicking on java file there is an option to run. How do I run the program. Please see attached print screen.
Maybe because there is no main method inside the class you are highlighting.
Is there a main method?
I am trying to work through the Kotlin Koans in Intellij Idea Ultimate 2017.2 and I am having issues running the tests. I have marked the test directory as such, but when I try to run them as a whole or individually with the triangle arrow in the gutter that Intellij adds to tests I get a "No tests were found" error.
Screenshots are attached.
I have marked the test directory as such, but when I try to run them as a whole or individually with the triangle arrow in the gutter that Intellij adds to tests I get a "No tests were found" error.
You have it marked (incorrectly) as a test resource, not test source. Make sure to open the project by importing from Gradle then IDE will automatically configure the project structure and set the folders categories as needed.
I have a project in IntelliJ that has a number of syntactically correct and incorrect classes and a unit test that I've written for a particular class.
Is there a way to execute the test even though other classes, completely independent from the current class I want to test, have errors that prevent the entire project from compiling?
The class I want to test has no compile-time errors. When I try to run the test, I'm directed to those other classes with syntax errors.
Replace the Before launch Build step with Build, no error check:
Do this change for the default JUnit configuration (under Defaults node in the tree on the left) so that it's applied to all the new JUnit run/debug configurations automatically.
You can also remove the Build step and compile the test files manually (from the file right click context menu):
When trying to run some code after compilation is finished, I wrote the following in my sbt build:
compile in Compile <<= (compile in Compile) map { x=>
// post-compile work
doFoo()
x
}
Which works well if I run sbt compile from command line, but doesn't get executed when I build from IntelliJ IDEA.
Is there any way to have IntelliJ IDEA run my post compilation step?
Looks like the only way IntelliJ IDEA supports is via Ant, unfortunately.
See VS post build event command line equivalent in IntelliJ IDEA?.
Also, if you go down this route, you might be interested to use ant4sbt.
IDEA has Run/Debug configurations.
In the Before Launch option, normally we have Make as the default action.
It is a matter of simply adding a Run external Tool action after Make. We can define any number of actions.
The external tool could invoke SBT.
Or we can remove Make and call SBT to handle all the process. The only inconvenience of this, is that is a little less confortable to go to syntax errors when compiling.
After running Rebuild Project successfully in IntelliJ 13.1.3 Ultimate IDE, I opened my Test NG test file.
When right-clicking on the file, I don't see any option to run the test.
How can I run an TestNG test in IntelliJ 13.1.3?
This question is similar, but it's from 2012 with an unaccepted answer.
Yes you can!
Сheck the folder that contains the test classes whether marked as Test Source Root. In another case see whether installed TestNG-J plugin.
Update:
There are 3 possibilities in the new Intellij 2017.2 to run a testNG test.
You can click on the module (project) name >>Run>>All Tests(TNG). Be careful as there are 2 'All Tests' options. The second option is the one you need. It carries a testNG logo. This way you can run all your testNG classes in parallel
The second possibility is to run a single TestNG class. Righ click the class name in the package explorer and choose 'Run Test' If your class is a testNG class, by default, the test will run as a TestNG test.
This option is my favourite as it gives me a lot of control over my tests. Install this 'Create TestNG XML' plugin. Once installed. if you right click on your module name, you will see a new option called 'Create TESTNG XML' and you will be able to directly use that option to run your TestNG tests, giving you a lot of flexibility.
It could be that a plugin that you need is disabled.
Make sure the testNg plugin is enabled.
I noticed this plugin wasn't enabled,
and as soon as I turned it on, everything started working.