MoQuality

MoQuality Docs

We are glad that you are using MoQuality in your testing process. You'll find comprehensive guides and documentation to help you start working with MoQuality as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Quick Start - Follow an example

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.

How it works

There are two components: MoQuality CLI and MoQuality Dashboard. Your project files are stored locally on your drive. When you run MoQuality through the CLI, it starts an Appium server in the background. The Appium tests run on the default host and port at localhost:4723. The output of your Appium test is displayed in the MoQuality dashboard. Using the tools in the dashboard, you can create the Appium code for new test steps and copy and paste it in your local file. Rerun the test to see the output and debug for any errors. Once you are satisfied with the test, you can save it and upload it to your MoQuality project.

Requirements

MoQuality needs the following installed on your system:

  • Appium
  • Android SDK > 16
  • Java Development Kit (JDK)
  • Android Debug Bridge (adb)
  • Node.js and npm
  • An Android phone (with USB debugging on) or an Android Virtual Device (Emulator)

For iOS:

  • Xcode Installed and signed in with the respective Developer Account
  • An iPhone or an iOS Simulator running

Your mobile application: .apk or .ipa file
You may choose to get started with MoQuality's code examples on sample apps also.

You can perform a quick check for these dependencies by running this command:

appium-doctor

Assuming that you already have this setup and are familiar with Appium, you can proceed by following the steps below:

Using MoQuality

You can try out MoQuality with a sample app. Follow these steps:

  • Install MoQuality CLI
  • Run mqlab server
  • Login to MoQuality Dashboard
  • Choose from a sample app or upload your app
  • View and edit the sample test
  • Run the test
  • View test results

Install the MoQuality CLI

npm install -g @moquality/mqlab

Change directories into the test folder

Create a new project directory where you wish to work on tests with MoQuality. Navigate to the path of your project directory. Example:

cd path_to_test_folder

Start the mqlab server

mqlab

Login to MoQuality and open MoQuality Dashboard

  • Navigate to your project dashboard at https://app.moquality.com/
  • Create a new project or use the 'Personal Project'
  • Add your App - Click '+Add App' to upload your app's .apk or .ipa file. You can also simply upload one of the sample apps to try it out.
  • Click 'Test' tile under Quick Start.** This page shows you all the tests in your project.
  • Create a new Test - Click '+ Create test' button. You can either download a boilerplate code or a starter example. It will be downloaded to the currently selected directory.
  • If you see this screen, then ensure that you have installed MoQuality CLI and the mqlab server is running in your terminal. If the problem still persists, then see Common Issues.
  • The next screen prompts you to select the directory you want to use for the Appium test files. Navigate to your project directory and click 'Select this directory. Example:
  • Next screen prompts you to download Boilerplate or Starter code and run the test. Let's choose the 'Simple Calculator - Test that shows addition and crashing the app'. Click download. The test files will be downloaded in your selected project directory.
  • The test will run on the selected device and you will see this screen. You can now see all your test steps with screenshots (both before and after action). The console on the right helps you inspect the UI element hierarchy and generate the Appium code by creating a new test step.
  • Try editing the Appium script in the Test.js file locally using any code editing tool such as Notepad++. The sample code looks like this.
var should = require('chai').should()
var expect = require('chai').expect

describe('Test', function() {
    this.timeout(0)
    const wd = require('wd')
    const driver = wd.promiseChainRemote({
        host: 'localhost',
        port: 4723,
    })

    before(async () => {
        return driver.init({
            platformName: 'android',
            app: 'https://storage.googleapis.com/mq.link/codelab/calc.apk',
            deviceName: 'Device',
            automationName: 'UiAutomator2',
            autoLaunch: false,
        })
    })

    after(async () => {
        return await driver.quit()
    })

    it('Launch App', async () => {
        return await driver.launchApp()
    })

    it('Addition', async () => {
        await driver.element('id', 'com.shauvik.calc:id/btn2').then((target) => target.click())
        await driver.element('id', 'com.shauvik.calc:id/add').then((target) => target.click())
        await driver.element('id', 'com.shauvik.calc:id/btn7').then((target) => target.click())
        await driver.element('id', 'com.shauvik.calc:id/equals').then((target) => target.click())
        let answer = await driver.element('id', 'com.shauvik.calc:id/textView').then((target) => target.text())
        answer.should.equal('9')
    })

    it('Incorrect expression', async () => {
        await driver.element('id', 'com.shauvik.calc:id/btn2').then((target) => target.click())
        await driver.element('id', 'com.shauvik.calc:id/add').then((target) => target.click())
        await driver.element('id', 'com.shauvik.calc:id/equals').then((target) => target.click())
        await driver
            .element('id', 'com.shauvik.calc:id/textView')
            .catch((err) => expect(err.message).to.have.string('NoSuchElement'))
    })
})
  • Click the 'Run Test' button. This test will be run on the device selected and output will be shown on the MoQuality dashboard. Choose either of the Cloud device or local device options.

Create a new test step - Flexible Code Generation

To create a new test step select any existing step in MoQuality. 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. Select the action and MoQuality will show you the Appium code you should use in your test for this step.

If the new step depends on a widget, hover over the screenshot and select the widget first. MoQuality will try to find the best selector that widget. Choose the action you want to perform on that widget and MoQuality will show you the Appium code you should use in your test for this step. You can choose to modify the selectors if you need to and MoQuality will show you the modified code.

That's it. Use MoQuality to create or debug your test. Once you are done, you can simply save it and upload it to MoQuality.

Updated 9 days ago


What's Next

Good Practices

Quick Start - Follow an example


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.