Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run a single Android Test using Kotlin?

I am using Kotlin 1.0.3 for Android Development in Unit Testing but when I try to run a single test it runs all tests of the class. Does anyone know how to avoid that behaviour?

like image 548
Yiyo Castillo Avatar asked Jul 18 '16 19:07

Yiyo Castillo


People also ask

How do you run a test in Kotlin?

To run tests for all targets, run the check task. To run tests for a particular target suitable for testing, run a test task <targetName>Test .

What is unit testing in Android Kotlin?

Unit tests run on your local machine only. These tests are compiled to run locally on the Java Virtual Machine (JVM) to minimize execution time. If your tests depend on objects in the Android framework, we recommend using Robolectric.


1 Answers

There's an issue with the IntelliJ Platform that causes the tests for the entire class to be executed if you try to run a single test method and have an existing run configuration for the entire class.

To run a single method, you need to delete the configuration for the entire class using the Run | Edit Configurations... action.

like image 124
yole Avatar answered Oct 09 '22 19:10

yole