スキル一覧に戻る
instructure

test

by instructure

testは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。

148🍴 108📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


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

Test Canvas Android Apps

Run unit tests, instrumentation tests, and Espresso tests for Canvas Android apps.

Test Location

All test commands must be run from the repository root (canvas-android/), not the apps/ directory.

Unit Tests

Unit tests verify business logic in isolation using Mockk for mocking.

Prerequisites

  • Set Build Variant to qaDebug in Android Studio, or
  • Use command line with testQaDebugUnitTest as shown below

Run Unit Tests for Apps

# 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

Run Unit Tests for Shared Libraries

# 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

Run Specific Unit Tests

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.*"

Test Structure

  • Unit tests: src/test/java/com/instructure/{app}/features/{feature}/
  • Instrumentation tests: src/androidTest/java/com/instructure/{app}/ui/{feature}/

Instrumentation/Espresso Tests

Instrumentation tests run on a device or emulator to test UI interactions.

Prerequisites

Before running UI tests, check for connected devices:

adb devices -l

If multiple devices are connected:

  • Prefer running on an emulator if available
  • Use ANDROID_SERIAL environment variable or -s flag to specify a device

Run All Instrumentation Tests

# Student app
./gradle/gradlew -p apps :student:connectedQaDebugAndroidTest

# Teacher app
./gradle/gradlew -p apps :teacher:connectedQaDebugAndroidTest

Run Specific Instrumentation Test

# Run single test class
./gradle/gradlew -p apps :student:connectedQaDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.instructure.student.ui.dashboard.DashboardPageTest

Target Specific Device

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 ...

Testing Patterns

  • Write unit tests in the same style as existing tests (check student/src/test/)
  • Write instrumentation tests following existing patterns (check student/src/androidTest/)
  • Mock dependencies with Mockk
  • Use test doubles for repositories in ViewModel tests
  • Espresso tests should use page object pattern from :espresso module
  • Ensure tests are isolated and repeatable

Examples

Run 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

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

+5
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です