Testare l'app
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
In questa pagina vengono descritti vari strumenti che consentono di creare, configurare ed eseguire i test da Android Studio o dalla riga di comando.
Per saperne di più sulle nozioni di base dei test e su come scrivere i test, consulta la pagina Testare le app su Android.
Esistono diversi modi per eseguire e configurare i test:
Esegui dei test in Android Studio
Per esigenze di test di base, Android Studio include funzionalità che consentono di creare, eseguire e visualizzare i risultati dei test, il tutto dall'IDE. Con Android Studio, puoi puntare e fare clic sul codice sorgente dell'app per creare ed eseguire test per classi o metodi specifici, utilizzare i menu per configurare più dispositivi di test e interagire con la finestra dello strumento Matrice di test per visualizzare i risultati dei test. Per ulteriori informazioni su come utilizzare Android Studio per creare e gestire i test, consulta Test in Android Studio.
Eseguire test dalla riga di comando
Per un controllo più granulare, puoi eseguire test dalla riga di comando.
I test della riga di comando offrono un modo semplice per scegliere come target i moduli o
creare varianti singolarmente o in combinazioni. L'esecuzione di test tramite la shell di Android Debug Bridge (adb) consente la massima personalizzazione in termini di test che vuoi eseguire.
L'esecuzione di test dalla riga di comando è utile anche in un sistema di integrazione continua.
Per ulteriori informazioni, consulta Eseguire test dalla riga di comando.
Test avanzati
Per esigenze di test avanzate, potresti voler eseguire l'override delle impostazioni predefinite, configurare le opzioni Gradle o rifattorizzare il codice in modo che i test siano separati nel rispettivo modulo. Per ulteriori informazioni su come impostare le configurazioni di test per casi d'uso speciali, consulta Configurazione di test avanzata.
Per verificare il comportamento della tua app quando l'utente interagisce con essa, puoi utilizzare
strumenti come Espresso Test
Recorder,
App Crawler,
UI Automator o
Monkey Testing.
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2023-09-25 UTC.
[null,null,["Ultimo aggiornamento 2023-09-25 UTC."],[],[],null,["# Test your app\n\nThis page describes various tools that help you create, configure, and\nrun your tests from Android Studio or the command line.\n\nIf you want to learn more about the fundamentals of testing and how to write\ntests, see [Test apps on Android](/training/testing).\n\nThere are different ways to run and configure your tests:\n\n- **Test in Android Studio**\n\n For basic testing needs, Android Studio includes features that help you\n create, run, and view results of tests all from the IDE. Using Android Studio,\n you can point and click in the app source code to create and run tests for\n specific classes or methods, use menus to configure multiple test\n devices, and interact with the Test Matrix tool window to visualize test\n results. For more information on how to use Android Studio to create and\n manage your tests, see\n [Test in Android Studio](/studio/test/test-in-android-studio).\n- **Run tests from the command line**\n\n For more fine-grained control, you can run tests from the command line.\n Command-line testing provides a straightforward way to target modules or\n build variants individually or in combinations. Running tests through the\n Android Debug Bridge (adb) shell allows for the most customization in terms of\n which tests you want to run.\n\n Running tests from the command line is also useful on a [continuous\n integration system](/studio/projects/continuous-integration).\n\n For more information, see\n [Test from the command line](/studio/test/command-line).\n- **Advanced testing**\n\n For advanced testing needs, you may want to override default settings,\n configure Gradle options, or refactor your code so that tests are separated in\n their own module. For more information about how to set up your test\n configurations for special use cases, see [Advanced test\n setup](/studio/test/advanced-test-setup).\n\n To test how your app behaves when your user interacts with it, you can use\n tools such as [Espresso Test\n Recorder](/studio/test/other-testing-tools/espresso-test-recorder),\n [App Crawler](/studio/test/other-testing-tools/app-crawler),\n [UI Automator](/training/testing/other-components/ui-automator), or\n [Monkey testing](/studio/test/other-testing-tools/monkey)."]]