The QuickStart guide is intended for intermediate to advanced test automation engineers. This guide assumes you have Appium already setup on your machine. For a detailed guide to MoQuality, head to our MoQuality Tutorials.
Before you get started you need to have Appium and all of its basic requirements installed. This includes Android SDK with platform-tools for `adb` and `aapt`, Java Development Kit (JDK) and Node.JS. If you want to test on iOS, you need to have Xcode installed.
If you want to test on a real device, you should also have an Android or iOS device handy. Remember that to test on iOS devices you need to have an Apple Developer account with your iOS devices as one of the registered authorized devices on your account.
To get started install MoQuality's CLI (Command Line Interface tool):
npm install -g @moquality/mq
You can use this tool to do everything from creating, debugging your Appium tests, uploading your app and running tests from your CI/CD.
We have created a few starter examples. These are simple Appium boilerplates with sample apps to get you started easily. Get a starter with:
mq starter add-wd
This will create an
add-wd folder and download the starter there. It should include an Appium test in
test.js using Appium's
wd framework along with MoQuality's
mq.json configuration file.
To debug the
add-wd appium tests, start the debugger in the
add-wd folder and open the "Debugger" in MoQuality's dashboard.
cd add-wdmq debug
Then click on the "Run Test" button in Debugger on the dashboard. It will run the current Appium test and show you the test with all the debugging information (each test step along with before and after screenshots).
To record a test run, you will first need to get your API Key from your accounts page. Then connect a local Android device and run the following:
export MQ_APIKEY=<your_api_key>mq record
Note: If there is only one Android device or emulator currently on your system, Appium automatically runs the test on that device.
To record a test on a cloud device, do the following:
mq record --cloud --app <path_to_app>
This will upload the app and select a random Android or iOS device in the cloud and run the current test.
To create a new test step select an existing step in the Debugger. You will see the before and after screenshots fo that particular step along with options for creating a new step.
If the new step does not depend on the widget you will find the action on this page (these are actions like a tap, swipe, and key presses).
If the new step depends on a widget, hover over the screenshot and select it first and then select the action (these are actions like click and inputs). On selecting an action, you will see the Appium code you could use in your test. You can choose to modify the selectors if you need to and you will see you the modified code.
To run these tests in your CI/CD you need to upload the app and run the test on a cloud device. You can accomplish both with:
export MQ_APIKEY=<your_api_key>npx @moquality/mq record --cloud --app <path_to_app>
That's it. Use MoQuality to create, debug or run your tests. Once you are done, you can simply share it with your team.