0Pricing
Jetpack Compose Academy · Ders

createComposeRule ve Bulucular

Bir Compose testi kurun ve düğümleri bulun.

createComposeRule ve Bulucular, CoddyKit'te ücretsiz bir Jetpack Compose Academy dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Jetpack Compose Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Why Test Your UI?

Manual testing is slow and easy to forget. A UI test launches your Composable and checks it automatically, catching breakages before your users ever do. 🧪

Meet the Compose Test Rule

Every Compose test starts with a test rule. It hosts your Composables in a controlled environment so you can render, inspect, and interact with them from test code.

createComposeRule

For pure UI with no Activity, createComposeRule gives you a lightweight rule. You attach it as a JUnit @get:Rule field in your test class.

@get:Rule
val composeTestRule = createComposeRule()

setContent in a Test

Use setContent on the rule to render the Composable you want to verify. This is your test's UI, just like in a real Activity.

composeTestRule.setContent {
    Greeting(name = "Ada")
}

Finders Locate Nodes

Once your UI is on screen, you need a finder to grab a specific element. Finders search the semantics tree and return a node you can assert on.

onNodeWithText

The friendliest finder is onNodeWithText. Give it the text shown on screen and it returns that exact node for you to check.

composeTestRule.onNodeWithText("Hello, Ada!")

onNodeWithContentDescription

For images and icons with no visible text, use onNodeWithContentDescription. It matches the accessibility label, which keeps tests and screen readers in sync.

composeTestRule.onNodeWithContentDescription("Profile photo")

One Node vs Many

onNode finds a single match and fails if there are several. When you expect a group of elements, reach for onAllNodes to get a collection instead.

composeTestRule.onAllNodesWithText("Item")

Quick Check

You want to locate an icon button that has no visible text. Which finder fits best?

Finders Are Lazy

A finder does not search immediately. It captures your intent, and the actual lookup happens when you call an assertion or action on it.

Helpful Failure Messages

When a finder matches nothing, the test fails with a clear message and even prints the current node tree. That makes debugging a missing element fast.

createAndroidComposeRule

Need a real Activity, resources, or navigation? Swap in createAndroidComposeRule, which launches an Activity and still exposes the same finder API.

@get:Rule
val rule = createAndroidComposeRule<MainActivity>()

Recap: Rules & Finders

You set up a compose rule, render with setContent, then locate elements with finders like onNodeWithText. That foundation powers every Compose test you write. 🎉

Sıkça Sorulan Sorular

“createComposeRule ve Bulucular” dersi ücretsiz mi?

Evet — “createComposeRule ve Bulucular” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Jetpack Compose Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Jetpack Compose Academy kursu toplamda 4 dersten oluşur.

“createComposeRule ve Bulucular” dersinde ne öğreneceğim?

Bir Compose testi kurun ve düğümleri bulun. Jetpack Compose Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Jetpack Compose Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Jetpack Compose Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.

“createComposeRule ve Bulucular” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Jetpack Compose Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Jetpack Compose Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. createComposeRule ve Bulucular
  2. Doğrulamalar ve Eylem Gerçekleştirme
  3. Anlambilim ve Test Etiketleri
  4. ViewModels ve Flow'ları Test Etme
← Jetpack Compose Academy Sayfasına Dön