SPONSORS:






View RSS Feed

thomasdfg

Android Application Automation Testing

Rate this Entry
by , 05-01-2016 at 09:59 PM (168 Views)
Android testing is based on JUnit. In general, a JUnit test is a method whose statements test a part of the application. You organize test methods into classes called test cases. You can further organize these classes into test suites.

In JUnit, you build one or more test classes and use a test runner to execute them. In Android, you use Android Studio (or the Android Plugin for Gradle) to build one or more test source files into an Android test app.

From your testing environment, you can run your test in one of the following ways:
ĽOn your local machine: Compile the test classes and execute them locally on the Java Virtual Machine (JVM) using the JUnit test runner.
ĽOn a device or emulator: Install the test app and the app under test to a physical device or emulator, and then execute your tests using an Android-specific test runner (such as AndroidJUnitRunner).

The structure of your test code and the way you build and run the tests in Android Studio depend on the type of testing you are performing. For more details open the below link

You should write your unit or integration test class as a JUnit 4 test class. JUnit is the most popular and widely-used unit testing framework for Java. The framework offers a convenient way to perform common setup, teardown, and assertion operations in your test.

JUnit 4 allows you to write tests in a cleaner and more flexible way than its predecessor versions. Unlike the previous approach to Android unit testing based on JUnit 3, with JUnit 4, you do not need to extend the junit.framework.TestCase class. You also do not need to prepend the test keyword to your test method name, or use any classes in the junit.framework or junit.extensions package.

A basic JUnit 4 test class is a Java class that contains one or more test methods. A test method begins with the test annotation and contains the code to exercise and verify a single functionality (that is, a logical unit) in the component that you want to test.

The following snippet shows an example JUnit 4 integration test that uses the Espresso APIs to perform a click action on a UI element, then checks to see if an expected string is displayed.


Testing Concepts | Android Developers

Comments


vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:36 PM.

Copyright BetaSoft Inc.