with one click
test
// Run unit tests and instrumentation tests for Canvas Android apps. Use when user mentions testing, running tests, JUnit, Espresso, or checking test results. Includes commands for Student, Teacher, and Parent apps.
// Run unit tests and instrumentation tests for Canvas Android apps. Use when user mentions testing, running tests, JUnit, Espresso, or checking test results. Includes commands for Student, Teacher, and Parent apps.
Create pull requests for Canvas Android following project conventions. Use when user mentions creating PR, pull request, opening PR, or submitting changes for review. Includes PR template requirements and affects field guidelines.
Build Canvas Android apps (Student, Teacher, Parent) using Gradle. Use when user mentions building, compiling, assembling, or making the app. Provides commands for dev, qa, and prod build variants.
Install and deploy Canvas Android apps to connected devices or emulators using adb and Gradle. Use when user mentions installing, deploying, running on device, launching app, or working with emulators.
| name | test |
| description | Run unit tests and instrumentation tests for Canvas Android apps. Use when user mentions testing, running tests, JUnit, Espresso, or checking test results. Includes commands for Student, Teacher, and Parent apps. |
| allowed-tools | Bash, Read |
Run unit tests, instrumentation tests, and Espresso tests for Canvas Android apps.
All test commands must be run from the repository root (canvas-android/), not the apps/ directory.
Unit tests verify business logic in isolation using Mockk for mocking.
qaDebug in Android Studio, ortestQaDebugUnitTest as shown below# Student app - all unit tests
./gradle/gradlew -p apps :student:testQaDebugUnitTest
# Teacher app - all unit tests
./gradle/gradlew -p apps :teacher:testQaDebugUnitTest
# Parent app - all unit tests
./gradle/gradlew -p apps :parent:testQaDebugUnitTest
# Test a specific module (e.g., pandautils)
./gradle/gradlew -p apps :pandautils:testDebugUnitTest
# Test specific class or package
./gradle/gradlew -p apps :pandautils:testDebugUnitTest --tests "com.instructure.pandautils.features.discussion.router.*"
# Force re-run tests (ignore cache)
./gradle/gradlew -p apps :pandautils:testDebugUnitTest --rerun-tasks
Use the --tests flag to run specific test classes or methods:
# Run single test class
./gradle/gradlew -p apps :student:testQaDebugUnitTest --tests "com.instructure.student.features.dashboard.DashboardViewModelTest"
# Run tests matching a pattern
./gradle/gradlew -p apps :student:testQaDebugUnitTest --tests "com.instructure.student.features.dashboard.widget.*"
src/test/java/com/instructure/{app}/features/{feature}/src/androidTest/java/com/instructure/{app}/ui/{feature}/Instrumentation tests run on a device or emulator to test UI interactions.
Before running UI tests, check for connected devices:
adb devices -l
If multiple devices are connected:
ANDROID_SERIAL environment variable or -s flag to specify a device# Student app
./gradle/gradlew -p apps :student:connectedQaDebugAndroidTest
# Teacher app
./gradle/gradlew -p apps :teacher:connectedQaDebugAndroidTest
# Run single test class
./gradle/gradlew -p apps :student:connectedQaDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.instructure.student.ui.dashboard.DashboardPageTest
If multiple devices are connected:
# Use environment variable
ANDROID_SERIAL=emulator-5554 ./gradle/gradlew -p apps :student:connectedQaDebugAndroidTest
# Or use adb flag
adb -s emulator-5554 shell ...
student/src/test/)student/src/androidTest/):espresso moduleRun all widget tests:
./gradle/gradlew -p apps :student:testQaDebugUnitTest --tests "com.instructure.student.features.dashboard.widget.*"
Run tests and view report:
./gradle/gradlew -p apps :student:testQaDebugUnitTest
open apps/student/build/reports/tests/testQaDebugUnitTest/index.html