मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग10k · #11937

testing-setup

यह क्या करती है

यह स्किल जाँचती है कि Android प्रोजेक्ट अभी अपना कोड कैसे टेस्ट करता है, और टेस्टिंग सेटअप की योजना बनाती है। यह unit, UI, स्क्रीनशॉट और end-to-end टेस्ट के लिए टेस्ट लाइब्रेरी और हार्नेस जोड़ सकती है। यह उन Android डेवलपरों के लिए है जिन्हें एक काम करने वाली टेस्ट रणनीति चाहिए।

कब इस्तेमाल करें

  • ✓जब आपके Android प्रोजेक्ट में बहुत कम या कोई टेस्ट न हों और आपको टेस्टिंग सेटअप चाहिए।
  • ✓जब आप Compose या View स्क्रीन के लिए स्क्रीनशॉट टेस्ट जोड़ना चाहते हैं।
  • ✓जब आपको यह जानना हो कि आपका प्रोजेक्ट पहले से कौन सी टेस्ट लाइब्रेरी और mocking टूल इस्तेमाल करता है।

Skill का लिंक

https://github.com/android/skills/blob/main/testing/testing-setup/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/android/skills/blob/main/testing/testing-setup/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे Android प्रोजेक्ट का टेस्टिंग सेटअप देखिए और unit तथा Compose UI टेस्ट के लिए लाइब्रेरी जोड़िए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल आपकी version catalog और build फ़ाइलें पढ़कर dependency injection फ़्रेमवर्क, टेस्ट फ़्रेमवर्क, mocking टूल और UI प्रकार ढूँढती है। फिर वह प्रोजेक्ट के अनुकूल लापता लाइब्रेरी और हार्नेस जोड़ती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Step 1: Analyze the current testing setup

To understand the testing setup of an existing project, look for these dependencies in the libs.versions.toml file, or build files:

  1. Dependency Injection framework used. For example, Hilt, Koin, Anvil, or vanilla Dagger.
  2. Unit (local) testing framework this project uses. For example, JUnit4 or JUnit5.
  3. Mocking framework (if any) used for unit tests, and for instrumented and UI tests. For example, Mockito or Mockk.
  4. Robolectric. Identify which of these three uses apply:
    1. Used in unit tests to have fakes for platform entities
    2. To run behavior UI tests without a device or emulator. For example, used to run Espresso or Compose tests.
    3. To do screenshot testing with Roborazzi
  5. Is the app 100% Compose, Views or hybrid?
  6. Behavior UI tests:
    1. Compose Tests (androidx.compose.ui:ui-test-*)
    2. Espresso Tests for Views. Check for wrappers such as Kaspresso. Dependencies: androidx.test.espresso:espresso-core, androidx.test:runner, androidx.test:rules.
  7. Screenshot tests. Identify which of these types the project uses:
    1. Instrumented (device-based). For example, using Dropshots.
    2. Based on Robolectric, so they run locally. For example, using Roborazzi.
    3. Based on LayoutLib, so they run locally. For example, Paparazzi, or the Compose Preview Screenshot Testing tool.
  8. End to end tests (also known as Release Candidate tests) always run on device and use high-level frameworks such as UIAutomator, Appium, or Robotium.
  9. Generate a Markdown report with the analysis

Step 2: Set up Dependency Injection frameworks for testing

If there is no Dependency Injection framework, install one: if it's a multiplatform application, ask the user whether they want to install Koin, or kotlin-inject. If it's not multiplatform, install Hilt.

Install the testing dependencies (for example com.google.dagger:hilt-compiler that should be applied with a kspAndroidTest configuration).

[!IMPORTANT] Important: Always consult the documentation of the applicable framework to learn about testing (for example: Hilt testing guide, Koin Instrumented tests).

For instrumented tests, create and configure (by adding testInstrumentationRunner to the build gradle files) a new test runner and apply the testing rules required by the framework (for example in Hilt, annotate your test classes with @HiltAndroidTest and apply the HiltAndroidRule). Other frameworks use other mechanisms, consult their documentation.

Step 3: Install frameworks

Unless otherwise specified, respect the current stack of testing frameworks.

If there are no testing frameworks, and the user didn't specify any preference, install the following:

  • JUnit4 for local and instrumented tests

  • JaCoCo for test coverage

  • For UI tests: if the project has views, Espresso. If it's fully Compose, use the Compose Testing APIs.

  • Robolectric to run UI Tests

  • Compose Preview Screenshot Testing tool for screenshot tests. Check the project's AGP version first, then pick the matching setup and follow it strictly:

    • AGP 9.5.0-alpha03 or higher (recommended): configure an AGP test suite using testOptions { screenshotTests.create(...) }, as described in Screenshot testing with test suites.
    • Lower AGP versions: use the legacy standalone plugin setup with com.android.compose.screenshot, and tell the user it's deprecated. Don't upgrade AGP as part of setting up screenshot tests. Mention that test suites are available on 9.5.0-alpha03 or higher, and leave the upgrade as a separate decision.

    Don't combine both setups in the same module. If the project already uses the standalone plugin and its AGP version supports test suites, offer to migrate it using the tasks and paths mapping table in Screenshot testing with test suites.

  • Dropshots for device screenshot tests

  • If a mocking framework is necessary, install Mockk (io.mockk:mockk). Do not install it unless it is clearly necessary.

If instrumented screenshot tests are requested, install Dropshots.

If end-to-end testing is requested, install

अक्सर पूछे जाने वाले सवाल

क्या यह मेरे असली टेस्ट केस लिखती है?

स्किल टेस्टिंग सेटअप और हार्नेस पर केंद्रित है, इसलिए कौन सा व्यवहार टेस्ट करना है, यह आप तय करते हैं।

यह कौन से स्क्रीनशॉट टेस्ट पहचानती है?

यह डिवाइस-आधारित स्क्रीनशॉट टेस्ट और Robolectric या LayoutLib पर आधारित लोकल टेस्ट पहचानती है।

यह कौन से dependency injection टूल पहचानती है?

यह Hilt, Koin, Anvil और vanilla Dagger जैसे फ़्रेमवर्क पहचानती है।

जानकारी

लेखक का मूल विवरण

Analyze and create a testing strategy for Android apps - install testing libraries, set up test infrastructure, create harnesses for unit tests, UI tests, screenshot tests, and end-to-end tests.

repo: android/skills

लोकप्रियता

GitHub स्टार
10k
रैंकिंग में स्थान
#11937
लाइसेंस
Apache-2.0
अपडेट की गई
29/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

agp-9-upgrade

10k

आपके एजेंट को Android ऐप को Android Gradle Plugin 9 पर ले जाने और उसके breaking changes सुधारने में मदद करती है। मल्टीप्लेटफ़ॉर्म प्रोजेक्ट के लिए नहीं।

कोडिंगमोबाइल ऐप

camerax

10k

आपके एजेंट को CameraX से Android कैमरा फ़ीचर बनाने में मदद करती है, जिसमें वीडियो रिकॉर्डिंग, हार्डवेयर कंट्रोल, ML Kit और Media3 इफ़ेक्ट शामिल हैं।

कोडिंगमोबाइल ऐप

android-for-cars-parked-apps

10k

आपके एजेंट को Android वीडियो, गेम या ब्राउज़र ऐप को Android Auto और Android Automotive पर parked ऐप के रूप में चलाने के लिए ढालने में मदद करती है।

कोडिंगमोबाइल ऐप

appfunctions

10k

आपके एजेंट को Android ऐप के मुख्य काम ढूँढकर उन्हें AppFunctions के रूप में देने में मदद करती है, ताकि AI एजेंट और वॉइस कमांड उन्हें चला सकें।

AI और एजेंटएजेंट

मिलती-जुलती skills