How to get pass and fail test case count in UIAutomator - android-uiautomator

I am running multiple tests by using different classes.
ex:
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.NewUserRegistration
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Login
adb shell uiautomator runtest PrjoectXYZ.jar -c com.myapp.testautomation.Logout
And if i am redirecting the console output to a text file it is giving only the last ran result.
Can someone help me on getting the overall result with pass and fail counts ?

In the Console output, you should find an "INSTRUMENTATION_STATUS_CODE:" for each test with a status of 0 or 1.
0 is Pass.
1 is fail.
So you want to build something custom? Maybe you can look at the source code for uiautomator2junit. thats what i use for reporting on Jenkins
https://github.com/dpreussler/automator-log-converter

Related

how can I add multiple command in jmeter

I'm using jmeter in macOS(Big sur) to test some actions.
Before main test, I am trying to use JMeter naturally.
What I wanna do is to execute multiple commands by jmeter(OS Process Sampler)
The scenario is like this.
I want to print out the current path by "pwd" command.
After that, I want to make Dircetory named dir123 by "mkdir dir123" command.
Finally, I want to see all directories and files by "ls" command.
The screenshot is like this.
OS Process Sampler
And current Result by "View Results Tree" is like this.
View Results Tree
It seems the first command "pwd" is the only command executed.
How can I execute more commands?
You're trying to execute 3 different commands so my expectation is that you should be using 3 OS Process Samplers.
If some reason you want/need/have to do it using single OS Process Sampler - you can use && operator to connect these 3 commands like:
pwd && mkdir dir123 && ls
More information:
How to Run External Commands and Programs Locally and Remotely from JMeter
Bash Reference Manual - List of Commands

Jenkins fails with Execute shell script

I have my bash script in ${JENKINS_HOME}/scripts/convertSubt.sh
My job has build step Execute shell:
However after I run job it fails:
The error message (i.e. the 0: part) suggests, that there is an error while executing the script.
You could run the script with
sh -x convertSubt.sh
For the safe side, you could also do a
ls -l convertSubt.sh
file convertSubt.sh
before you run it.
make sure that the script exist with ls
no need to sh , just ./convertSubs.sh ( make sure you have run permissions)

Currently running WGETs

I'm having a hard time using knowing if it is possible to have a clue on my download speed using WGET.
To run my gets I use the following command :
wget -c -b http://mylink.com
So it runs in background BUT I can still have access to its PID.
What I was wondering is :
If I have the PID, do I have the possibility to attach anything to the process in order to check the speed ?
What if I use the following :
screen -dmS MYDOWNLOADPROCESS_XXXXX wget -c http://mylink.com
Is there a way I can retrieve stuffs even if its running in DEAMON ? Cause it seems I can't attach it back... :(
Well I think I just found myself a solution. I can totally use --spider option from wget
In order to get the expected length of content. Extract it using a bash script using the length: value, and then ls -al and bashing everything to match anything like :
downloaded / expected length
To get a percentage.

Repeating Bash Task using At

I am running ubuntu 13.10 and want to write a bash script that will execute a given task at non-pre-determined time intervals. My understanding of this is that cronjobs require me to know when the task will be performed again. Thus, I was recommended to use "at."
I'm having a bit of trouble using "at." Based on some experimentation, I've found that
echo "hello" | at now + 1 minutes
will run in my terminal (with and without quotes). Running "atq" results in my computer telling me that the command is in the queue. However, I never see the results of the command. I assume that I'm doing something wrong, but the manpages don't seem to be telling me anything useful.
Thanks in advance for any help.
Besides the fact that commands are run without a terminal (output and input is probably redirected to /dev/null), your command would also not run since what you're passing to at is not echo hello but just hello. Unless hello is really an existing command, it won't run. What you want probably is:
echo "echo hello" | at now + 1 minutes
If you want to know if your command is really running, try redirecting the output to a file:
echo "echo hello > /var/tmp/hello.out" | at now + 1 minutes
Check the file later.

Getting a shell error code from curl in Jenkins while still displaying output in console

I am using a shell script in Jenkins that, at a certain point, uploads a file to a server using curl. I would like to see whatever output curl produces but also check whether it is the output I expect. If it isn't, then I want to set the shell error code to > 0 so that Jenkins knows the script failed.
I first tried using curl -f, but this causes the pipe to be cut as soon as the upload fails and the error output never gets to the client. Then I tried something like this:
curl ...params... | tee /dev/tty | \
xargs -I{} test "Expected output string" = '{}'
This works from a normal SSH shell but in the Jenkins console output I see:
tee: /dev/tty: No such device or address
I'm not sure why this is since I thought Jenkins was communicating with the slave using a normal SSH shell. In any case, the whole xargs + test thing strikes me as a bit of a hack.
Is there a way to accomplish this in Jenkins so that I can see the output and also test whether it matches a specific string?
When Jenkins communicates with slave via SSH, there is no terminal allocated, and so there is no /dev/tty device for that process.
Maybe you can send it to /dev/stderr instead? It will be a terminal in an interactive session and some log file in non-interactive session.
Have you thought about using the Publish over SSH Plugin instead of using curl? Might save you some headache.
If you just copy the file from master to slave there is also a plugin for that, copy to slave Plugin.
Cannot write any comments yet, so I had to post it as an answer.

Resources