On test execute how can i select a different testcase that is present in my test suite? - testcomplete

I have 2 different test cases written in my test suite in test complete. Regression and preformance. Now am trying to run performance test case through test execute, but by default only regression test case gets executed. How can i change this?
Thanks in advance

You can use the command line-parameters of TestExecute in order to specify a project or even script routine to run. For example:
...\TestExecute.exe c:\tests\MySuite\MySuite.pjs
/project:PerfomanceProject /unit:Unit1 /routine:runTest /run /exit
/silentmode
or
...\TestExecute.exe c:\tests\MySuite\MySuite.pjs
/project:PerfomanceProject /test:"KeywordTests|MainTest" /run /exit
/silentmode

Related

Ability to do run test suite in single npm script to generate both testrail and mochawesome reports

Currently I have two separate scripts:
"p1_testRail": "cypress run -r cypress-testrail-accumulative-reporter {arguments} {test_suites} --headless"
"p1_mochawesome": "cypress run -r cypress-multi-reporters {arguments} {test_suites} --reporter mochawesome"
But I want to be able to run a single cypress script and get the report generated for both testrail and mochawesome. Do we have any way to be able to pass multiple arguments for a --reporter & -r?
NOTE: && would still run it one after another. That means, test suite will run twice. Instead, I want to run test suite once and update both the reporters at the same time.

Jenkins job is always failing after windows batch command execution script for rerun cucumber tests

I am running cucumber java tests in jenkins job using maven build as below
After its done in post step under windows batch command execution script I am rerunning failures
mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2"
After this step every time execution fails. I have read somewhere that if I add any of the below line it should pass but still it fails every time.
echo "exit script"
true
command || true
exit 0
Also added #!/bin/sh at start of script
Please advise.
Since this is supposed to be executed on Windows you may try
mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2" & echo note: ignoring exit code
or
cmd /c mvn clean verify -Dcucumber.options="#rerun.txt --tags #Retry1" -Dthreadcount="2" & echo note: ignoring exit code
(sorry, don't have Jenkins with Windows agent to test this at hand).

Jmeter - Run test via command line - how to set Loop Count to Infinite

I'm running jmeter on jenkins starting the test via script such as:
jmeter -n -t ${WORKSPACE}/bin/test/${testscript}.jmx -l ./bin/test/result/${testscript}.jtl -Jhost=${host} -Jthreads=${env.THREADS} -Jiterations=${env.ITERATIONS} -Jrampup=${env.RAMPUP} -Jbuildnumber=${env.BUILD_NUMBER}"
I'd like to pass to the jmeter a parameter which turns the Loop Count to Infinite while starting the .jmx from command line above rather than hardcoding it into the jmx test itself. Reason why is that I want the test to be infinite: true only when it's "scheduled" in jenkins and not when triggered manually.
Does anyone know if the "Loop Count: Infinite" can be passed via script while starting a .jmx test?
Thanks in advance,
Vincenzo
As #AngshumanBasak state, -1 define infinite loop, so change your iterations/env.ITERATIONS command line parameter
-Jiterations=-1
Set
Loop Count = -1
in your jmeter script, to run infinitely. Hope, this resolves your issue.

Jenkins Job DSL return script results

I'm converting my existing build jobs to be generated by Jenkins Job DSL.
The jobs are primarily Maven based and invoke Sonar. The existing jobs execute a couple of shell commands that make a call to the Sonar server to test if the Sonar run has passed a Sonar Quality Gate. If it passes the Quality Gate, the job proceeds, otherwise it fails. The code block for this is:
#!/bin/bash
# Query the Sonar Quality Gate for this project; if good, proceed with the job
APP_GROUPID=$(cat pom.xml | xpath /project/groupId/text\(\) 2>/dev/null)
APP_ARTIFACTID=$(cat pom.xml | xpath /project/artifactId/text\(\) 2>/dev/null)
export SONAR_RESULT=$(curl --silent -H "Accept: application/xml" "http://<sonar-server>/api/resources/index?includealerts=true&metrics=alert_status&resource=${APP_GROUPID}:${APP_ARTIFACTID}" | xpath '/resources/resource/msr/alert/text()' 2>/dev/null)
echo $SONAR_RESULT
if [ "$SONAR_RESULT" == "OK" ]; then
echo "*** SONAR_RESULT = [$SONAR_RESULT] Proceeding with deployment."
else
echo "*** SONAR_RESULT = [$SONAR_RESULT] Halting deployment attempt!"
exit -1
fi
I'm trying to replicate this functionality in the Jenkins Job DSL. To do it, I need to get the Maven Group & Artifact ID info, build the command to query the Sonar server, then return the query's result.
I don't see any info in the Job DSL documentation on how to return the status of a shell step. So far the only way I see to do it, is run 1 or more DSL shell step to get the Group + Artifact ID info, formulate the results as Jenkins environment variables & write them to a temporary file; I then inject those variables into the build job; once that's done, I then make the call to the Sonar Server and write the result to another temporary file and examine that. Obviously this is pretty kludgy.
Is there a better way to do it, without necessarily using the shell step?
Thanks in advance.
I would consider re-implementing this part of your build and avoiding the use of a shell step.
If you go to the (excellent) job-dsl api documentation you can see that there is Sonar dsl ready and waiting for you to be used ...
https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.publisher.MavenPublisherContext.sonar
In my opinion, it would be better to make use of the Job DSL that deals with Sonar there rather than running your Sonar tests via a shell script
Your code will have less languages to contend with, be cleaner, easier to maintain and understand.

How to get pass and fail test case count in 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

Resources