Lacking Run Check in Android Studio | by Vincent Tsen | Jun, 2022


This text was initially printed at vtsen.hashnode.dev on Could 28, 2022.

I seen in Android Studio Bumblebee, we will’t Run Check anymore from the Android Studio UI. It looks like is a recognized situation right here and supposes it ought to be fastened on this model already, however in some way I nonetheless have the problem?

  • From the supply code editor
  • From proper click on folder / file
  • From the supply code editor, it reveals Nothing right here
  • From proper click on folder / file, Run Checks… menu shouldn’t be there

I’m not a unit testing man. Perhaps I’m lacking one thing right here as a result of it looks like nobody complains about this? Anyway, these are the workarounds primarily based on my restricted information in testing.

I suppose you’ll be able to roll again to earlier secure launch model Arctic Fox or improve to the newest preview model. I personally attempt Android Studio Dolphin (Canary construct preview model) and don’t have any points.

  • Go to app->Edit Configuration…
  • Add Gradle job
  • Give the gradle job identify (any identify) and specify the gradle venture (primarily based in your venture folder identify)
  • Add this Activity
:app:testDebugUnitTest
--tests "com.instance.myapplication.ExampleUnitTest"

This run all check capabilities in ExampleUnitTest. If you wish to run all lessons inside the bundle, you should utilize the *

--tests "com.instance.myapplication.*"

To run unit check in command line, you’ll be able to run the next command within the terminal

gradlew :app:testDebugUnitTest --tests "com.instance.myapplication.ExampleUnitTest"

To run particular unit check perform (e.g. ExampleUnitTest.addition_isCorrect), you simply have to replace the duty to

:app:testDebugUnitTest --tests "com.instance.myapplication.ExampleUnitTest.addition_isCorrect"

For instrument check, you additionally have to manually add it, just like the unit check run configuration above.

  • Go to app->Edit Configuration…
  • Add Android Instrumented Checks
  • Choose All in Bundle
  • Choose Module and Bundle
  • So it seems like this
  • Run the instrumented check (just like the unit check above)

The above steps run all instrumented exams underneath the specify bundle. If you wish to run check in specify class, simply select Class as a substitute of All in Bundle and specify the category identify you wish to run.

To run instrumented check in command line, you’ll be able to run the next command within the terminal

gradlew :app:connectedDebugAndroidTest

I really feel troublesome to manually add the run configuration, particularly I wish to run a single check that’s newly added. Perhaps I ought to simply transfer up my Android Studio model to the newest preview construct to do away with this downside.



Source_link

Leave a Reply

Your email address will not be published.