E2E testing allows to test your application workflows and make sure all the integration points are working as expected. You can literally test any screen and any workflow of your app. It differs from Unit Testing by the fact that unit testing is used to test an isolated piece of code usually in a mocked environment.
If you wonder when to do unit testing and when E2E testing there is a basic rule. For isolated pieces of code prefer to do a set of unit tests that are focused on the work this code do. Unit tests usually are smaller, simpler and much faster. Use E2E testing for any application workflow where multiple components are involved and you want to ascertain they work well when integrated together. E2E tests allow to cover flows in the application which are not covered by unit and integration tests.
Appium is an open-source test automation framework for use with any mobile app. It allows to easily create UI automation testing for iOS, Android, Windows and hybrid mobile apps. Read more details in the Appium introduction and Appium getting started guide.
Since Appium is used internally to test the NativeScript framework itself, the core team developed a nativescript plugin that wraps Appium and allows using it easy for UI test automation of NativeScript apps. The nativescript-dev-appium plugin is created and maintained by the core team and is constantly improving.
For the plugin to work correctly you need to have:
- Install Appium globally:
$ npm install -g appium
- iOS Dependencies
Install external dependencies of XCUITest driver for iOS via Homebrew or NPM as follows:
$ brew install carthage $ brew install libimobiledevice --HEAD $ brew install ideviceinstaller $ brew install ios-webkit-debug-proxy
$ npm install -g ios-deploy
For detailed information on external dependencies, please, refer to the XCUITest repository.
- Android Dependencies
For correct functioning of the mobile-devices-controller for Android emulators,
telnet is required to be available on your system.
telnet is removed from macOS High Sierra, it could be installed as follows:
$ brew install telnet
You have now learned the basics about what E2E testing is for mobile apps and what's the difference between unit and e2e testing. You can now continue to the simple example provided in the Getting Started section where you'll learn how to setup the nativescript-dev-appium plugin in your project and how to run your first test.
Do not miss gaining more advanced knowledge about the usage of Appium by reviewing
- nativescript-dev-appium Features
- How to create custom Appium capabilities and what options it provides?
- How to troubleshoot any issues and what are some common issues?
There are also nice blog posts and conference videos covering Appium and its usage in NativeScript apps which you can find in the References section of this documentation.