atest की मदद से, प्लैटफ़ॉर्म कोड की जांच करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Android Studio for Platform (ASfP), atest
कमांड-लाइन टूल के साथ इंटिग्रेट होता है. इससे, कनेक्ट किए गए डिवाइस या एम्युलेटर पर सीधे आईडीई से टेस्ट चलाए जा सकते हैं.
ज़रूरी शर्तें
- अपने AOSP सोर्स कोड से ASfP प्रोजेक्ट खोलें.
- अपने कोड को किसी डिवाइस या एम्युलेटर पर बनाएं और फ़्लैश करें.
source build/envsetup.sh
और lunch
का इस्तेमाल करके, अपना बिल्ड एनवायरमेंट शुरू करें.
टेस्ट चलाना
ASfP में atest
का इस्तेमाल करके, कई तरीकों से टेस्ट किए जा सकते हैं:
गटर रन आइकॉन: रन आइकॉन play_circle पर क्लिक करें
पर क्लिक करें.
राइट-क्लिक मेन्यू: प्रोजेक्ट विंडो या एडिटर में किसी टेस्ट फ़ाइल, क्लास या तरीके पर राइट-क्लिक करें. इसके बाद, 'atest' चलाएं को चुनें.
टर्मिनल का इस्तेमाल करके: ASfP में इंटिग्रेट किया गया टर्मिनल खोलें (व्यू > टूल विंडो > टर्मिनल) और सीधे atest
कमांड चलाएं. उदाहरण के लिए: bash
atest MyTestModule
atest MyTestClass#myTestMethod
परीक्षण के नतीजे देखें
जांच के नतीजे, ASfP में Run टूल विंडो में दिखते हैं. इस विंडो में, टेस्ट की प्रोग्रेस, पास या फ़ेल होने का स्टेटस दिखता है. साथ ही, हर टेस्ट के लिए लॉग और आउटपुट मिलता है.
टेस्ट कॉन्फ़िगरेशन
गटर या दायां क्लिक करने पर खुलने वाले मेन्यू से टेस्ट चलाने पर, ASfP अपने-आप कुछ समय के लिए रन या डीबग कॉन्फ़िगरेशन बना देता है. इन कॉन्फ़िगरेशन में बदलाव किया जा सकता है और इन्हें सेव किया जा सकता है. इससे, खास विकल्पों या फ़्लैग के साथ टेस्ट को तुरंत फिर से चलाया जा सकता है:
- चलाएं > कॉन्फ़िगरेशन में बदलाव करें पर जाएं.
- वह
atest
कॉन्फ़िगरेशन ढूंढें जिसमें आपको बदलाव करना है. इसके अलावा, + बटन पर क्लिक करके और atest को चुनकर, नया कॉन्फ़िगरेशन बनाएं.
- टेस्ट मॉड्यूल, क्लास, और तरीका तय करें. साथ ही, ज़रूरी
atest
कमांड-लाइन विकल्प जोड़ें.
टेस्टिंग के लिए सलाह
- टारगेट की गई टेस्टिंग: समय बचाने के लिए, सिर्फ़ वे टेस्ट चलाएं जिनकी आपको ज़रूरत है.
Module:Class#Method
फ़ॉर्मैट या अन्य atest
फ़िल्टर का इस्तेमाल करें.
- एम्युलेटर स्नैपशॉट का इस्तेमाल करें: एम्युलेटर पर टेस्ट तेज़ी से चलाने के लिए, स्नैपशॉट का इस्तेमाल करें. इससे, जानी-पहचानी अच्छी स्थिति पर तुरंत वापस लौटा जा सकता है.
- लॉग की जांच करना: किसी भी टेस्ट के फ़ेल होने की वजह का पता लगाने के लिए, Run टूल विंडो में मौजूद लॉग का इस्तेमाल करें.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-09-05 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-09-05 (UTC) को अपडेट किया गया."],[],[],null,["Android Studio for Platform (ASfP) integrates with the `atest` command-line\ntool, letting you run tests on your connected device or emulator directly from\nthe IDE.\n\nPrerequisites\n\n- Open an ASfP project with your AOSP source code.\n- Successfully build and flash your code to a device or emulator.\n- Initialize your build environment using `source build/envsetup.sh` and `lunch`.\n\nRun tests\n\nYou can run tests using `atest` in ASfP in several ways:\n\n- **Gutter run icons:** Click the **Run** icon play_circle\n\n next to a test class or method in the editor to run that specific test.\n- **Right-click menu:** Right-click on a test file, class, or method in the\n Project window or editor and select **Run 'atest'**.\n\n- **Using the terminal:** Open the integrated terminal in ASfP (**View \\\u003e Tool\n Windows \\\u003e Terminal** ) and run `atest` commands directly. For example: `bash\n atest MyTestModule\n atest MyTestClass#myTestMethod`\n\nView test results\n\nTest results are displayed in the **Run** tool window within ASfP. This window\nshows the test progress, pass or fail status, and provides logs and output for\neach test.\n\nTest configurations\n\nWhen you run a test from the gutter or right-click menu, ASfP automatically\ncreates a temporary run or debug configuration. You can modify and save these\nconfigurations to quickly re-run tests with specific options or flags:\n\n1. Go to **Run \\\u003e Edit Configurations**.\n2. Find the `atest` configuration you want to modify or create a new one by clicking the **+** button and selecting **atest**.\n3. Specify the test module, class, method, and add any necessary `atest` command-line options.\n\nTips for testing\n\n- **Targeted testing:** Run only the specific tests you need to save time. Use the format `Module:Class#Method` or other `atest` filters.\n- **Use emulator snapshots:** For faster test runs on emulators, consider using snapshots to quickly revert to a known good state.\n- **Check logs:** Use the logs in the **Run** tool window to diagnose any test failures."]]