Skip to content

gadiim/mobile_native_application_testing

Repository files navigation

CI

Table of Contents

Overview

This project is a test automation suite for an Android Calculator app using WebdriverIO and Appium. It is designed to validate the core functionalities of the Calculator app by performing end-to-end tests on various arithmetic operations. The tests are executed on BrowserStack to ensure compatibility across different devices and configurations. Additionally, tests were also conducted locally using Appium, with a Samsung S8 smartphone. Detailed test results are available through Allure reports for comprehensive analysis.

Requirements:

  • Android Version: 9.0 (Pie).
  • Calculator Version: 12.0.05.5.

Key Features:

  • Automated tests for addition, subtraction, multiplication, division, percentage calculation, and sign change.
  • Integration with BrowserStack for cross-device testing.
  • Continuous Integration/Continuous Deployment (CI/CD) using GitHub Actions.
  • Allure reports for detailed test result analysis.

Test Cases

The following test cases are designed to validate the core functionalities of the Android Calculator app:

Preconditions

  • The Calculator app must be installed and running on the device
Test Case Description Steps
Addition Test Adds 1 and 2 and verifies the result is 3 1. Clear the calculator.
2. Press 1.
3. Press the addition (+) button.
4. Press 2.
5. Press the equals (=) button.
6. Verify the result is 3.
Subtraction Test Subtracts 3 from 4 and verifies the result is 1 1. Clear the calculator.
2. Press 4.
3. Press the subtraction (-) button.
4. Press 3.
5. Press the equals (=) button.
6. Verify the result is 1.
Multiplication Test Multiplies 5 by 6 and verifies the result is 30 1. Clear the calculator.
2. Press 5.
3. Press the multiplication (*) button.
4. Press 6.
5. Press the equals (=) button.
6. Verify the result is 30.
Division Test Divides 8 by 2 and verifies the result is 4 1. Clear the calculator.
2. Press 8.
3. Press the division (/) button.
4. Press 2.
5. Press the equals (=) button.
6. Verify the result is 4.
Percentage Calculation Test Calculates 10% of 90 and verifies the result is 9 1. Clear the calculator.
2. Press 1.
3. Press 0.
4. Press the percentage (%) button.
5. Press 9.
6. Press 0.
7. Press the equals (=) button.
8. Verify the result is 9.
Change Sign Test Changes the sign of the number and verifies the result 1. Clear the calculator.
2. Press 5.
3. Press the plus/minus (±) button.
4. Verify the result is -5.

Test Results

The test automation suite was executed both locally using Appium and on BrowserStack for cross-device compatibility.

Allure Reports

Detailed test results, including screenshots and logs, are available through Allure reports. Below is a sample screenshot of the Allure report:

BrowserStack Public Link

Tests were also run on BrowserStack, and you can view the detailed results and logs through the following public link: BrowserStack Test Results

Installation

To get started with the project, follow these steps to set up your environment and install all necessary dependencies:

Clone the Repository:

git clone https://github.com/gadiim/mobile_native_application_testing.git

Navigate to the project directory:

cd mobile_native_application_testing

Install Dependencies:

npm install

Download and Install the APK File:

  • Ensure you have the Calculator app APK file available.
  • You can either download your own APK file or use the provided APK file from APKMirror.
  • Note: The provided APK file works with the current project configuration. If you download a different APK file, you will need to update the project configuration to match the APK file's requirements.

  • If you're testing locally, install the APK on your Android device/emulator using the following command:
    adb install path/to/your/calculator.apk
  • Replace path/to/your/calculator.apk with the actual path to your APK file.

Set Up Environment Variables:

  • Create a .env file in the root of the project.

  • Add the following environment variables:

    BROWSERSTACK_USERNAME=your_browserstack_username
    
    BROWSERSTACK_ACCESS_KEY=your_browserstack_access_key
    
    BROWSERSTACK_ANDROID_APP_ID=your_browserstack_android_app_id
    
  • You can obtain these credentials from your BrowserStack account:

    • BROWSERSTACK_USERNAME: Log in to your BrowserStack account, go to the Profile section, and copy your username.
    • BROWSERSTACK_ACCESS_KEY: In the same Profile section, copy your access key.
    • BROWSERSTACK_ANDROID_APP_ID: Upload your APK file to BrowserStack App Automate and copy the app ID from the upload page.

Ensure Device Requirements:

  • Verify the device meets the necessary requirements for testing.

Usage

Follow these instructions to run the tests both locally and on BrowserStack.

Running Tests Locally

Ensure you have your device or emulator ready.

npm run test

Running Tests on BrowserStack

Set up environment variables as described in the Installation section.

npm run test:bs

Generate Allure Reports

  • Generate the Allure report after running the tests:

    npm run allure:generate
  • Open the Allure report in your default web browser:

    npm run allure

Project Structure

mobile_native_application_testing/
├── .github/
│   └── workflows/
│       └── ci.yml                    -- GitHub Actions CI workflow
├── config/
│   ├── wdio.conf.android.bs.ts       -- Configuration for BrowserStack
│   └── wdio.conf.android.ts          -- Local configuration
│   └── wdio.conf.ts                  -- Common WebdriverIO configuration
├── test/
│   ├── specs/
│   │   └── test.e2e.ts               -- End-to-end test cases for the calculator
│   └── pageobjects/
│       └── calculator.ts             -- Page object methods for the calculator
├── reporters/                        -- Directory for Allure and other reports
│   ├── allure-results/               -- Allure results
├── .gitignore                        -- Git ignore file
├── package.json                      -- Project dependencies and scripts
├── tsconfig.json                     -- TypeScript configuration
└── README.md                         -- Project documentation

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this project. See the LICENSE file for more details.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Automated testing project for an Android Calculator app using WebdriverIO, Appium, and BrowserStack integrated with GitHub Actions for CI/CD.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published