Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests cannot be run from IntelliJ IDE after update to multiplatform #17

Closed
Whathecode opened this issue Aug 23, 2018 · 5 comments
Closed
Labels
enhancement Nice to have, non-functional requirements.

Comments

@Whathecode
Copy link
Member

There seems to be a bug in the current IntelliJ plugin (reported on 1.2.60, but seemingly still present in 1.2.61) which causes this to fail.

I am under the impression this will be fixed in 1.2.70.

@Whathecode Whathecode added the enhancement Nice to have, non-functional requirements. label Aug 23, 2018
@Whathecode
Copy link
Member Author

Related report on Stack Overflow: https://stackoverflow.com/q/51910553/590790

@Whathecode
Copy link
Member Author

Doing some more debugging, I identified the specific cause of this bug: the dependency org.jetbrains.kotlin:kotlin-test-junit5 causes IntelliJ to no longer recognize unit tests in the IDE. This did work for org.jetbrains.kotlin:kotlin-test-junit, but we need JUnit 5 for our @Nested tests.

I posted more info on Stack Overflow and reported this issue to JetBrains here: IntelliJ does not recognize JUnit 5 tests in Kotlin multiplatform project.

Concretely:

  • tests results do show up in IntelliJ when running gradle test on the JVM project. Tests do not show up when running this gradle task a second time without any changes. This is by design. If you want to force the test results output, you can do so by calling gradle cleanTest test (cleaning the tests first). I updated the documentation to reflect this.
  • tests can't be run individually from the IntelliJ IDEA. This will hopefully be fixed now that JetBrains is aware about this bug report.

@Whathecode
Copy link
Member Author

In addition, I noticed when the project is imported in IntelliJ for the first time using Gradle, running gradle test on the main carp.core-kotlin project does not make JVM tests show up.

When running this task with 'coverage', they do show up! After, trying to run them again without coverage does make them show up.

Very odd stuff happening here.

@Whathecode
Copy link
Member Author

https://youtrack.jetbrains.com/issue/KT-26792#focus=streamItem-27-3805465.0-0

In 1.3.60, the run test icons now show up again!

However, running the test in a multi-module project only works for the first listed module in the Project view. And, even though the selected test results show up as 'passed' in the IDE (e.g., Tests passed: 1 of 1 test - 964 ms), the overall test result still lists 'Failed'. A FAILURE is logged for jvmTest, stating "No tests found for given includes: ...."

In order for the generated --tests com.some.specific.namespace.TestClass.some_test argument to work, the correct Gradle project needs to be selected, but by default the main gradle module is selected, which is why I believe it only runs tests correctly on the first listed module in the project.

@Whathecode
Copy link
Member Author

Tried this with the latest IntelliJ plugin (1.3.71-release-IJ2019.3-1) and this seems to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Nice to have, non-functional requirements.
Projects
None yet
Development

No branches or pull requests

1 participant