0Pricing
Kotlin Multiplatform Academy · درس

تشغيل الاختبارات على أهداف Android وiOS

نفّذ مجموعة الاختبارات على كل منصة.

تشغيل الاختبارات على أهداف Android وiOS درس مجاني في Kotlin Multiplatform Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Kotlin Multiplatform Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

One Suite, Every Target

A common test compiles for each platform, so you can run the exact same suite on Android and on iOS. 🚀

Gradle Drives It All

You launch tests through Gradle tasks, each one tied to a specific platform target of your shared module.

Run the Android Tests

The testDebugUnitTest task runs your common and JVM tests on the local JVM, no emulator needed.

./gradlew :shared:testDebugUnitTest

Run on the iOS Simulator

A target-named task runs the same shared tests on the iOS simulator via Kotlin/Native's runner.

./gradlew :shared:iosSimulatorArm64Test

Pick the Right Arch

The iOS task name encodes the architecture, so Apple Silicon uses iosSimulatorArm64 while older setups differ.

Run Everything at Once

Calling the broad allTests task executes every target's suite in a single command.

./gradlew :shared:allTests

Reading the Report

Gradle writes an HTML report under build/reports, showing which case failed on which platform.

Catch Platform Drift

Running on both targets reveals subtle differences, like number formatting, before they reach your users.

iOS Tests Need a Mac

The iOS simulator target only runs on macOS with Xcode installed, while JVM tests run anywhere.

Wire It Into CI

In CI, run the JVM tests on any runner and the iOS suite on a macOS runner to cover everything.

Green on Both Means Done

When the suite passes on Android and iOS, you have real confidence that shared logic behaves identically. ✅

Quick Check

Pick the Android test task.

Recap

Use Gradle tasks per target: testDebugUnitTest for Android and iosSimulatorArm64Test for iOS, or allTests for both.

الأسئلة الشائعة

هل درس «تشغيل الاختبارات على أهداف Android وiOS» مجاني؟

نعم — نص درس «تشغيل الاختبارات على أهداف Android وiOS» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Kotlin Multiplatform Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.

ماذا ستتعلم في «تشغيل الاختبارات على أهداف Android وiOS»؟

نفّذ مجموعة الاختبارات على كل منصة. تتمرن على Kotlin Multiplatform Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Kotlin Multiplatform Academy؟

لا تُشترط خبرة سابقة. Kotlin Multiplatform Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «تشغيل الاختبارات على أهداف Android وiOS»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Kotlin Multiplatform Academy هذا؟

نعم. كل درس في Kotlin Multiplatform Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. kotlin.test في commonTest
  2. اختبار الدوال المعلّقة وFlows
  3. محاكاة Ktor Client والمستودعات
  4. تشغيل الاختبارات على أهداف Android وiOS
← العودة إلى Kotlin Multiplatform Academy