This repository serves as a collection of automated end-to-end test cases for the Open edX mobile applications designed for both Android and iOS platforms. It aims to ensure the reliability and functionality of the Open edX mobile apps by automating the testing process and providing a comprehensive suite of test cases.
-
Note: Java jdk is necessary if you want to automate android apps irrespective of test language
-
Recommended to install requirements other than the above via the script
-
source scripts/venv.sh
-
-
This will install all the requirements present in the requirements file as well as the pre-commit hooks. For more info on pre-commit hooks you can check out the doc under linting heading.
- Xcode with command line tools or simple command line tools
- Android SDK
- Install platform-tools and build-tools from the same link mentioned above
Don't forget to set environment variables for adb, platform-tools etc.*
- connect/start Android/iOS Device/Simulator
- Browse tests/ directory
- Rename 'user_preferences_sample.yml' to 'user_preferences.yml' and set the following values,
- Update the yml file as per instruction in the yml file.
- install edx(iOS/Android) app on specific device/simulator or simple pass app path in yml
-
Check out/download the source code, browse its directory
git clone https://github.com/openedx/openedx-app-test -
pytest- to run all test cases -
pytest tests/android/tests/- to run all android test screens -
pytest tests/ios/tests/- to run all ios test screens -
pytest <test case name>to run specific test case -
pytest <test case name>to run specific test case and create html report at end of execution -
pytest -m <marker>to run tests related to a specific marker
New markers can be added to files and should be listed inside the pytest.ini file.
Follow the link to improve the quality of code
- Complete the following steps to integrate your Python test suite using BrowserStack SDK.
export BROWSERSTACK_USERNAME="************"export BROWSERSTACK_ACCESS_KEY="************"export PLATFORM_NAME=Android/iOS
Saving your BrowserStack credentials as environment variables makes it simple to run your test suite from your local or CI environment. PLATFORM_NAME is a custom variable used to make test run unique and identifiable.
It is present in the requirements.txt file and is installed already in your env
-
Add following environment variables
BROWSERSTACK_USERNAMEBROWSERSTACK_ACCESS_KEYPLATFORM_NAME
-
vales for
BROWSERSTACK_USERNAMEandBROWSERSTACK_ACCESS_KEYcan be found in your browserstack profile. -
Update device name and version for android and ios in
browserstack.ymlfile. A complete list of available devices can be found on https://www.browserstack.com/list-of-browsers-and-platforms/automate- platformName:
Android/iOS - deviceName:
Google Pixel 7 pro/iPhone 14 pro max - platformVersion:
13.0/16
- platformName:
-
Rename
user_preferences_sample.ymltouser_preferences.ymland set the following values:-
set
target_environmenttoAndroidoriOS- target_environment: Android
-
set valid credentials to login
- login_user_name: username
- login_password: password
-
-
If you want to run on any other device/OS for android/iOS you can visit this link to see all available devices in browserstack (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
-
To run parallel execution on multiple devices, more platform details can be given with their device name and platform version
-
browserstack-sdk pytest tests/android/tests/ --env browserstackto run all android test screens -
browserstack-sdk pytest tests/ios/tests/ --env browserstackto run all ios test screens -
browserstack-sdk pytest -m ANDROID_SMOKE --env browserstackto run all tests with smoke marker
You can also use any other way of selecting tests which are available under pytest
By default each pytest command execution will clean out the allure-results folder as specified in the pytest.ini file.
In order to create a report on your local machine use the command
allure servethis will generate allure report and serve it at local endpoint provided in the terminal where the command is run To create a single file allure report for sharing purpose use the following commandallure generate allure-results --clean --single-file -o allure-reportThis will generate a single html file under allure-report folder as specified in the command with-ooption.