Saturday, June 18, 2022
HomeWordPress DevelopmentLacking Run Take a look at in Android Studio

Lacking Run Take a look at in Android Studio


Manually edit run configuration as workaround for lacking run check in Android Studio Bumblebee

This text was initially revealed at vtsen.hashnode.dev on March 28, 2022.

I observed in Android Studio Bumblebee, we won’t Run Take a look at anymore from the Android Studio UI. It looks like is a recognized concern right here and supposes it must be mounted on this model already, however in some way I nonetheless have the problem?



Anticipated Conduct

  • From the supply code editor
    Missing_Run_Test_in_Android_Studio_BumbleBee_01.gif
  • From proper click on folder / file
    Missing_Run_Test_in_Android_Studio_BumbleBee_02.gif



Android Studio Bumblebee

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



Workarounds

I am not a unit testing man. Perhaps I am 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 data in testing.



1. Use Totally different Android Studio Model

I suppose you possibly can roll again to earlier secure launch model Arctic Fox or improve to the most recent preview model. I personally strive Android Studio Dolphin (Canary construct preview model) and haven’t any points.



2. Manually Edit Run Configuration

  • Go to app->Edit Configuration…
    Missing_Run_Test_in_Android_Studio_BumbleBee_05.gif
  • Add Gradle job
  • Give the gradle job title (any title) and specify the gradle venture (primarily based in your venture folder title)
  • Add this Activity
:app:testDebugUnitTest
Enter fullscreen mode

Exit fullscreen mode

--tests "com.instance.myapplication.ExampleUnitTest"
Enter fullscreen mode

Exit fullscreen mode

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

--tests "com.instance.myapplication.*"
Enter fullscreen mode

Exit fullscreen mode

  • So it seems like this
    Missing_Run_Test_in_Android_Studio_BumbleBee_06.png

  • Run the unit check
    Missing_Run_Test_in_Android_Studio_BumbleBee_07.gif

To run unit check in command line, you possibly can run the next command within the terminal

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

Exit fullscreen mode

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

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

Exit fullscreen mode

For instrument check, you additionally must 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
    Missing_Run_Test_in_Android_Studio_BumbleBee_08.png
  • Run the instrumented check (just like the unit check above)

The above steps run all instrumented checks below 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 title you need to run.

To run instrumented check in command line, you possibly can run the next command within the terminal

gradlew :app:connectedDebugAndroidTest
Enter fullscreen mode

Exit fullscreen mode



Conclusion

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



See Additionally

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments