Intellij No Tests Found Kotlin - intellij-idea

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.

Related

where is com.intellij.rt.junit.junitstarter

i use intellij with junit to run tests (new), when i debug my test code for practice, one of the very first lines of code that seems to run is some method called main from package called com.intellij.rt.junit. I've tried clicking on it as well as searching for it open that package or class to see what's inside but i can't find it all. anyone know what it is or where i could find it in intellij and why i can't just access it from the debugger like every other class? i have junit 5.8 installed in maven.
y.bedrov's analysis is quite right.
com.intellij.rt.junit.JUnitStarter is part of IDE. In your case, the IDE is IntelliJ IDEA. You may find the source code in this local path:
/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar
then import the jar package into your own project to read the source code conveniently.

IntelliJ (2020.2) - How disable 'Build project automatically' for a project based on Gradle?

I am an Eclipse/STS user/developer, now trying to use IntelliJ Idea (CE)
2020.2.(1,2,3)
For a project based on Gradle, how spring-integration, when I open the IDE it happens the following
Ok, let the IDE load the project ... but
From above, that is the problem, I don't want that the IDE starts automatically to build/rebuild the project. I just need, open the project and that's all.
Observation: for example in Eclipse/STS exists the option to disable Build Automatically
I did do a research in the Web and I read the following posts and questions:
How to disable automatic gradle builds?
IntelliJ IDEA “Build project automatically” apparently not working
Intellij IDEA Java classes not auto compiling on save
Sadly the dialog options were changed but ...
Therefore:
From above, seems nothing to do.
Observation: from above observe the Build project automatically option is disabled
Even with that disabled and after to restart the IDE, I must always stop manually the build process
So what is missing? or Do I need a special extra plugin to accomplish my goal?
The images that you show indicate that you are building with Gradle, but the Compiler option that you disable is relevant for building projects with Idea not with Gradle.
For the 2020.2 version, you need to do the following:
Open the Setting > Build Tools page.
Disable the "Reload changes in build scripts" option.
This way you can manually control the reload. When you change the build script, you will see a small gradle icon in the right side of the editor.
For more info, refer to the IntelliJ IDEA help > Gradle section.
https://www.jetbrains.com/help/idea/work-with-gradle-projects.html#auto_reload
There are two different things in IntelliJ's Gradle support that sometimes confused: sync and build. Your pictures demonstrate sync process (note caption on the toolwindow). Word build is kind of misleading here.
What is sync? In gradle we use Groovy to define the build procedure. Groovy is an imperative programming language, so it's hard to predict resulting dependencies graph without actually executing the script. During the sync Idea executes configuration phase of gradle build (one that builds dependency graph), and obtains configured objects from the Gradle daemon. This information is used to setup project in the IDE: modules, libraries, dependencies, which sources are test, which are prod, etc.
Actual build is not happening during sync. You can convince yourself by adding syntax error to any source file, and observe that the sync succeeds. But build will fail if you invoke it.
In answer to the original question: you can't disable automatic build, because it is not enabled.
Is it possible to disable sync in Gradle project? Short answer - no. If you need a code browser, which is not required to understand all the cross-references in the source code, IDEA is not the best choice probably.
TL;DR;
Without sync IDE does not know which files are sources, and which are not. IDEA cannot open folders. It only can open projects. Good thing is that module can contain folder. So you can do the following: File | New | Project. Select Empty project, Next, select some random folder outside the source folder you want to open, Finish.
Then add new module:
Select Java in the left panel, everything else keep default, Next, Finish. Then in new module remove existing content root, and add folder with sources as new content root
Resulting project is mostly useless. Tons of red code (at least, unresolved symbols from external libraries), no inspections, no navigation, no sense. But it might be useful in some rare situations indeed.

Is there a way to run a JUnit test for a particular class in IntelliJ without compiling the entire project?

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):

how to set up an automatic compilation of test classes?

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.

Can't replicate simple akka project in intelliJ

I am a new scala user and am having problems getting a development environment functional.
I downloaded the typesafe activator which launches an editor in a web browser and was able to run the akka actor tutorial script fine.
However, I have set up my intelliJ scala/akka environment, and when copying the same sample code to intelliJ, I am getting compile errors. I have added akka 2.2-M1 via maven to my project.
Initially when I copy
import akka.actor.{ActorSystem, Props, Actor, Inbox}
the last "Inbox" library is highlighted in red, and on compile I get "Error: object Inbox is not a member of package akka.actor. It suggests that I add akka.actor.dsl.Inbox. When I do that the import is greyed out because it is "not implimented", and get a compile error further down in the script when I go to implement inbox. It says "
not found: value Inbox
val inbox = Inbox.create(system)
"
What am I doing wrong? Thanks!
I would recommend you use sbt and then use the gen-idea plugin to create your intellij project.
You'll need to re-run gen-idea every time your dependencies change - intelliJ currently won't automatically discover and resolve managed dependencies for you.
here is the plugin with directions.
https://github.com/mpeltonen/sbt-idea
also, as a professional I would recommend you use the sbt console for most of your tasks.
Ctrl-tab 0 will let you hop over there without touching your mouse.
Escape brings you back to the code editor window.
You can run sbt ~test to test on change to your files etc.
Note you may need to change focus off of intellij for it to save the file in memory if you're use ~test
I managed to resolve the same issue by adding the following library from the Maven repository
com.typesafe.akka:akka-actor_2.10:2.2-M3
to File -- Project Structure -- Libraries