सिमैंटिक
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Compose में यूज़र इंटरफ़ेस (यूआई) की जांच करने के लिए, सिमैंटिक्स का इस्तेमाल किया जाता है. इससे यूज़र इंटरफ़ेस (यूआई) के क्रम के साथ इंटरैक्ट किया जा सकता है.
सिमैंटिक्स, जैसा कि नाम से पता चलता है, यूज़र इंटरफ़ेस (यूआई) के किसी हिस्से को मतलब देते हैं. इस संदर्भ में, "यूज़र इंटरफ़ेस (यूआई) का हिस्सा" (या एलिमेंट) का मतलब, एक कंपोज़ेबल से लेकर पूरी स्क्रीन तक कुछ भी हो सकता है. सिमेंटिक ट्री, यूज़र इंटरफ़ेस (यूआई) के क्रम के साथ जनरेट होता है और क्रम के बारे में बताता है.
Compose में सिमैंटिक्स लेख में, सिमैंटिक्स के बारे में ज़्यादा जानकारी दी गई है.
पहली इमेज. सामान्य यूज़र इंटरफ़ेस (यूआई) का क्रम और उसका सिमैंटिक ट्री.
सिमेंटिक्स फ़्रेमवर्क का इस्तेमाल मुख्य तौर पर ऐक्सेसिबिलिटी के लिए किया जाता है. इसलिए, टेस्ट में यूज़र इंटरफ़ेस (यूआई) के क्रम के बारे में सिमेंटिक्स से मिली जानकारी का फ़ायदा मिलता है.
डेवलपर तय करते हैं कि क्या और कितना डेटा शेयर करना है.
दूसरी इमेज. एक सामान्य बटन, जिसमें आइकॉन और टेक्स्ट होता है.
उदाहरण के लिए, यहां दिए गए बटन में एक आइकॉन और टेक्स्ट एलिमेंट शामिल है. डिफ़ॉल्ट सिमैंटिक्स ट्री में सिर्फ़ "पसंद करें" टेक्स्ट लेबल शामिल होता है. ऐसा इसलिए है, क्योंकि Text
जैसे कुछ कंपोज़ेबल, सिमैंटिक्स ट्री को पहले से ही कुछ प्रॉपर्टी दिखाते हैं. Modifier
का इस्तेमाल करके, सिमैंटिक्स ट्री में प्रॉपर्टी जोड़ी जा सकती हैं.
MyButton(
modifier = Modifier.semantics { contentDescription = "Add to favorites" }
)
अतिरिक्त संसाधन
- Android पर ऐप्लिकेशन की टेस्टिंग करना: Android टेस्टिंग के मुख्य लैंडिंग पेज पर, टेस्टिंग की बुनियादी बातों और तकनीकों के बारे में ज़्यादा जानकारी मिलती है.
- टेस्टिंग की बुनियादी बातें: Android ऐप्लिकेशन की टेस्टिंग से जुड़े मुख्य कॉन्सेप्ट के बारे में ज़्यादा जानें.
- लोकल टेस्ट: कुछ टेस्ट, अपने वर्कस्टेशन पर स्थानीय तौर पर चलाए जा सकते हैं.
- इंस्ट्रुमेंटेड टेस्ट: इंस्ट्रुमेंटेड टेस्ट भी चलाए जाने चाहिए. इसका मतलब है कि ऐसे टेस्ट जो सीधे तौर पर डिवाइस पर चलते हैं.
- लगातार इंटिग्रेशन करना:
लगातार इंटिग्रेशन करने की सुविधा की मदद से, अपनी जांचों को डिप्लॉयमेंट पाइपलाइन में इंटिग्रेट किया जा सकता है.
- अलग-अलग स्क्रीन साइज़ के लिए टेस्ट करें: लोगों के पास कई तरह के डिवाइस उपलब्ध होते हैं. इसलिए, आपको अलग-अलग स्क्रीन साइज़ के लिए टेस्ट करना चाहिए.
- Espresso: इसे व्यू पर आधारित यूज़र इंटरफ़ेस (यूआई) के लिए बनाया गया है. हालांकि, Espresso की जानकारी, Compose की टेस्टिंग के कुछ पहलुओं के लिए अब भी मददगार हो सकती है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-08-27 (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-08-27 (UTC) को अपडेट किया गया."],[],[],null,["# Semantics\n\nUI tests in Compose use *semantics* to interact with the UI hierarchy.\nSemantics, as the name implies, give meaning to a piece of UI. In this context,\na \"piece of UI\" (or element) can mean anything from a single composable to a\nfull screen. The *semantics tree* is generated alongside the UI hierarchy and\ndescribes the hierarchy.\n\nYou can learn more about semantics generally in [Semantics in Compose](/develop/ui/compose/accessibility/semantics).\n\n**Figure 1.** A typical UI hierarchy and its semantics tree.\n\nThe semantics framework is primarily used for accessibility, so tests take\nadvantage of the information exposed by semantics about the UI hierarchy.\nDevelopers decide what and how much to expose.\n\n**Figure 2.** A typical button containing an icon and text.\n\nFor example, given a button like this that consists of an icon and a text\nelement, the default semantics tree only contains the text label \"Like\". This is\nbecause some composables, such as `Text`, already expose some properties to the\nsemantics tree. You can add properties to the semantics tree by using a\n`Modifier`. \n\n MyButton(\n modifier = Modifier.semantics { contentDescription = \"Add to favorites\" }\n )\n\nAdditional Resources\n--------------------\n\n- **[Test apps on Android](/training/testing)**: The main Android testing landing page provides a broader view of testing fundamentals and techniques.\n- **[Fundamentals of testing](/training/testing/fundamentals):** Learn more about the core concepts behind testing an Android app.\n- **[Local tests](/training/testing/local-tests):** You can run some tests locally, on your own workstation.\n- **[Instrumented tests](/training/testing/instrumented-tests):** It is good practice to also run instrumented tests. That is, tests that run directly on-device.\n- **[Continuous integration](/training/testing/continuous-integration):** Continuous integration lets you integrate your tests into your deployment pipeline.\n- **[Test different screen sizes](/training/testing/different-screens):** With some many devices available to users, you should test for different screen sizes.\n- **[Espresso](/training/testing/espresso)**: While intended for View-based UIs, Espresso knowledge can still be helpful for some aspects of Compose testing."]]