Search code examples
javaandroid-studioandroid-espressoui-testing

How to run a single espresso test function using android studio?


I added a shell script in android studio project. I'm using this command in command line

./gradlew testDebugUnitTest --stackTrace org.package.package.controller.StudentGoToTheFAQActivityTest

Note: org. Package. Package. Controller is not a real package name


Solution

  • I found a solution. I just run one test class from android studio using "blue play button" and check the stack that is running and i found this command

    /Users/$macosUsername/Library/Android/sdk/platform-tools/adb shell am instrument -w -m    -e debug false -e class '$packageName.StudentGoToTheFAQActivityTest#studentGoToTheFAQActivityTest' $comBundleName.test/androidx.test.runner.AndroidJUnitRunner
    

    $username = Macos home directory

    $packageName = package name you can find it top of the test class