Running mobile application tests - abeedal/Abeedal GitHub Wiki
Running mobile application tests
Information After containerization of E2E tests and Wiremock we provide two approaches of running E2E tests on local environment which can be used in the following way:
When there is a new feature that needs to be tested it is better to use test on local environment approach, because is lighter and easier for debug.
Once the feature test is done you can verify it by running E2E tests in containerized environment using browser stack.
Run tests in Containerized environment using local machine Execute docker shell script Open local terminal, go to the project's tests directory and execute the following command:
sh execDockerCompose.sh This script will execute yawsso login command which will launch your default web browser to then click ‘Sign in to AWS CLI’
After successful completion of the script you will have up and running Wiremock container which listen on http://wiremock:8080/
Run tests User can run the test using the following commands:
TAG= ENV= npm run int:android TAG= ENV= npm run int:ios Running the tests in this way will use the Tags set in the wdio.shared.conf.js file
supports any tag we want e.g. @INT_GREEN, @SMOKE @WIP, etc.
we can even include conditions here e.g. @INT_GREEN and not @SMOKE (This will run all int green test that are not also tagged as smoke tests)
parameter supports the following options
dev
uat (NOTE: should only be used with a uatDebug build)
And example to run all INT_GREEN tests on android use
TAG=@INT_GREEN ENV=dev npm run int:android
NOTE: To run tests in this way you must have already started wiremock locally using the steps above
Running tests in a Node.js Debugger In order to step through tests as they are executing it is best to have a debugger configured.
To set up a working debugger you need to do the following
Open Test framework Repo in Wiremock
Select Edit Configurations from the drop down menu
Select [+] symbol on the left of the Run/Debug Configurations dialog
Select Node.js as the new configuration
In the Form that appears Set a Name and add the following information
Android debugger config settings
iOS Debugger config settings
Setting the Environment Variables: these can be changed at any time to run different tests using cucumber TAGS and an environment value
TAG environment can be any tag as long as it has an '@' symbol and the Tag exists in the code base
ENV must be dev / uat
NOTE: To run debugger in this configuration you must have already started wiremock locally using the steps above
Run tests in locally Containerized environment using browser stack Add the build that you want to test User must add the built apk or ipa files in /tests/builds directory
Execute Script Open local terminal, go to the project's tests directory and execute the following predefined commands that are coded to do specific tasks:
For android Smoke tests
sh execDockerCompose.sh e2e android SMOKE For iOS Smoke Tests
sh execDockerCompose.sh e2e ios SMOKE For Android INT_GREEN Tests
sh execDockerCompose.sh e2e android INT_GREEN For iOS INT_GREEN Tests
sh execDockerCompose.sh e2e ios INT_GREEN For Android INT Tests
sh execDockerCompose.sh e2e android INT For iOS INT Tests
sh execDockerCompose.sh e2e ios INT To run any other Tag than those predefined just supply the TAG value without the @ this will append the @ symbol at runtime and
sh execDockerCompose.sh e2e ios WIP parameter supports the following options
dev
uat (NOTE: should only be used with a uatDebug build)
NOTE: This script will execute yawsso login command which will launch your default web browser to then click ‘Sign in to AWS CLI’ in the same way you do when you run the file for local only executions
You will need to stop any local instances of wiremock at this point as the above commands will build an instance of wiremock causing a conflict error at runtime.
- This command will run local Wiremock container and execute all tests from the feature file specified in tests/e2e/config/browserstack/wdio.shared.rdc.conf.js file that are identified with the TAG indicator in the command and will expect the build uploaded to BroswerStack to have a bundle/Package Id that matches the supplied parameter
Reports Once the tests are completed test-report directory will be generated in the project root locally. There you can find all the tests reports.