Android Test stopping in instantiating tests - android-testing

When i run my ui test, it just stopping in instantiating tests...
Uploading file:
local path: /Users/eclo/AndroidStudioProjects/Minicooper4android/Minicooper4android/app/build/outputs/apk/NAMmogujie714-uiTest-debug-androidTest-unaligned.apk
remote path: /data/local/tmp/com.mogujie.test
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.mogujie.test
Running tests
What's wrong?

Related

Appium tests on Amazon device farm getting stuck in custom test environment stuck at npm install *.tgz

I have android tests written in webdriverIO, appium. Running fine on my local machine. But on Amazon device farm execution getting stuck in custom test environment at npm install *.tgz.
Tech stack selected on amazon device farm: node 14.19.1 appium 1.22.2
# Phases are collection of commands that get executed on Device Farm.
phases:
# The install phase includes commands that install dependencies that your tests use.
# Default dependencies for testing frameworks supported on Device Farm are already installed.
install:
commands:
# By default the Node.js version installed is 11.4.0, however we enable you to change it
# using the Node version manager (nvm). An example "nvm" command below changes the version to 14.19.1
- export NVM_DIR=$HOME/.nvm
- . $NVM_DIR/nvm.sh
- nvm install 14.19.1
# Unpackage and install the node modules that you uploaded in the test phase.
- echo "Navigate to test package directory"
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- npm install *.tgz
# This test execution environment uses Appium version 1.9.1 by default, however we enable you to change it using
# the Appium version manager (avm). An example "avm" command below changes the version to 1.22.2.
# For your convenience, we have preinstalled the following versions: 1.22.2, 1.19.0, 1.18.3, 1.18.1, 1.18.0, 1.17.1, 1.16.0, 1.15.1, 1.14.2, 1.14.1, and 1.13.0.
# To use one of these Appium versions, change the version number in the "avm" command below to your desired version:
- export APPIUM_VERSION=1.22.2
- avm $APPIUM_VERSION
- ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js
# The pre-test phase includes commands that setup your test environment.
pre_test:
commands:
# We recommend starting appium server process in the background using the command below.
# Appium server log will go to $DEVICEFARM_LOG_DIR directory.
# The environment variables below will be auto-populated during run time.
- echo "Start appium server"
- >-
appium --log-timestamp
--default-capabilities "{\"deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \"platformName\":\"$DEVICEFARM_DEVICE_PLATFORM_NAME\",
\"app\":\"$DEVICEFARM_APP_PATH\", \"udid\":\"$DEVICEFARM_DEVICE_UDID\", \"platformVersion\":\"$DEVICEFARM_DEVICE_OS_VERSION\",
\"chromedriverExecutable\":\"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE\"}"
>> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
- >-
start_appium_timeout=0;
while [ true ];
do
if [ $start_appium_timeout -gt 60 ];
then
echo "appium server never started in 60 seconds. Exiting";
exit 1;
fi;
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
if [ $? -eq 0 ];
then
echo "Appium REST http interface listener started on 0.0.0.0:4723";
break;
else
echo "Waiting for appium server to start. Sleeping for 1 second";
sleep 1;
start_appium_timeout=$((start_appium_timeout+1));
fi;
done;
# The test phase includes commands that start your test suite execution.
test:
commands:
# Go into the root folder containing your source code and node_modules
- echo "Navigate to test source code"
# Change the directory to node_modules folder as it has your test code and the dependency node modules.
- cd $DEVICEFARM_TEST_PACKAGE_PATH/node_modules/*
- echo "Start Appium Node test"
# Enter the command below to start the tests . The comamnd should be similar to what you use to run the tests locally.
# For e.g. assuming you run your tests locally using command "node YOUR_TEST_FILENAME.js.", enter the same command below:
- npm run test:adf:android
# The post test phase includes are commands that are run after your tests are executed.
post_test:
commands:
# The artifacts phase lets you specify the location where your tests logs, device logs will be stored.
# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm.
# These logs and artifacts will be available through ListArtifacts API in Device Farm.
artifacts:
# By default, Device Farm will collect your artifacts from following directories
- $DEVICEFARM_LOG_DIR
I followed this blog to setup amazon device farm set up amazon device farm

How to run multiple execute windows batch in jenkins

I am trying to open appium, avd, and ride to run a test in Jeninks. I have the following in execute windows batch command:
C:
cd C:\Users\Gebruiker
appium
adb start-server
cd C:\Users\Gebruiker\AppData\Local\Android\Sdk\emulator
emulator -avd Pixel_3_API_23
ride.py
D:
cd D:\RIDE - testproject\Avans-One
robot -d Open_settings_connect_wifi AvansOne
It keeps loading after opening Appium, the first step. I have tried seperating the steps but it still doesnt work. It completes the first step and then just keeps loading. How do i fix this?
Most probably, this is happening because the command used to start the app is not returning while the app is running. So you will have to use a command that allows you to run the application in the background.
Check with something like below.
START /B title program
e.g.:
C:
cd C:\Users\Gebruiker
START /B "" appium
You can read more about the background process here

Unable to create merged directory when executing test in chrome

I have started to receive "Unable to create merged directory" error during executing tests in docker container. Command to execute test:
pub run build_runner test --fail-on-severe --delete-conflicting-outputs -- -p chrome
Output:
[SEVERE] Unable to create merged directory for /tmp/build_runner_testFCULZJ/.
[SEVERE] Failed after 1m 14s
There were two changes:
docker image with chrome was created from 2.7 instead 2.5
build_web_compilers dev dependecy version was increased: ^1.0.0 -> ^2.9.0
Not sure what is the reason - docker image not allows to create or build_runner issue.
Reason was test sources was not included(test source folder was excluded in build.yaml):
targets:
$default:
sources:
- lib/**
- web/**
- pubspec.*

AngularDart interface tests

I'm using this command to run tests in my application:
pub run angular_test --test-arg=--tags=aot --test-arg=--platform=dartium --test-arg=--reporter=expanded --serve-arg=--hostname=192.168.173.1 --serve-arg=--port=8180 --verbose
But when my tests run, I got this:
Failed to load "test\app_test.dart":
Error getting http://localhost:8180/app_test.dart.browser_test.dart: The remote computer refused the network connection.
(errno 1225)
Make sure "pub serve" is running.
How I can change the call to localhost? Should not the call follow --serve-arg=--hostname=192.168.173.1 config?
Thanks!

Start Appium on jenkins and wait for it to fully complete startup

I m setting up jenkins to run appium scripts. The issue I am seeing is if I run main.js to start appium the jenkins will not execute next commands and if I put appium in background next statements are executed immediately. Is there any way to start appium in background and wait for it to complete? and also once test execution complete how will I stop appium if appium process is in background?
Thanks in Advance
Shrikanth
You can create one folder called build and put your application in same folder and create a batch file using following commands :
cd /d C"":\Program Files (x86)\Appium\node_modules""
node appium --address 127.0.0.1 --port 4723 --app C:\Build\Application.apk --pre-launch --platform-name Android --platform-version 23 --automation-name Appium --device-name "DEVICEID" --log-no-color
Trigger this batch file from Jenkins and give wait of 20000 millisecond before running your test script.

Resources