Is there a way to run QAF BDD test on AWS device farm? - aws-device-farm

I'm trying to execute QAF BDD test using AWS device farm (Appium test using TestNG) but unfortunately it wont trigger the execution on testcase even there is no error. The same working fine while execute it locally.
The testng.xml configurations:
<suite name="QAF Demo" verbose="0">
<test name="Launch_App" enabled="true">
<groups>
<run>
<include name="SMOKE"/>
</run>
</groups>
<classes>
<class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory"/>
</classes>
</test>
</suite>
BDD file:
SCENARIO: SampleTest
META-DATA: {"description":"Sample Test Scenario","groups":["SMOKE"]}
Given print message
END
The log from AWS :
Start Appium TestNG test
[DeviceFarm] java -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH org.testng.TestNG -testjar *-tests.jar -d $DEVICEFARM_LOG_DIR/test-output -verbose 10
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[TestRunner] Running the tests in 'Launch_App' with parallel mode:false
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector#7cf10a6f priority: 10
include groups [SMOKE]
exclude groups: [] Scanarios location:
[TestClass] Creating TestClass for [ClassImpl class=com.qmetry.qaf.automation.step.client.text.BDDTestFactory]
[TestNG] Running:
/tmp/scratchE1xraV.scratch/test-packagel0A01c/testng.xml
[SuiteRunner] Created 1 TestRunners
[TestRunner] Running test Launch_App on 1 classes, included groups:[SMOKE ] excluded groups:[]
===== Test class
com.qmetry.qaf.automation.step.client.text.BDDTestFactory
======
[TestNG] RUNNING: Suite: "Launch_App" containing "0" Tests (config: /tmp/scratchE1xraV.scratch/test-packagel0A01c/testng.xml)
===== Invoked methods
=====
Creating /tmp/customer_log_directoryz6SHdY/test-output/QAF Demo/Launch_App.html
Creating /tmp/customer_log_directoryz6SHdY/test-output/QAF Demo/Launch_App.xml
===============================================
Launch_App
Tests run: 0, Failures: 0, Skips: 0
===============================================
[TestNG]
[TestNG] ===============================================
[TestNG] Launch_App
[TestNG] Tests run: 0, Failures: 0, Skips: 0
[TestNG] ===============================================
===============================================
QAF Demo
Total tests run: 0, Failures: 0, Skips: 0
===============================================
Is it due to custom method selector used by QAF?

To integrate QAF with AWS Device Farm you can follow below steps.
As per AWS mentioned do required configuration in your project. Refer working with Appium on AWS Device Farm Documentation.
Add below folders in your assembly zip files. You can add these folders by updating your assembly/zip.xml.
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>/resources/</include>
<include>/scenarios/</include>
<include>/config/</include>
</includes>
</fileSet>
Now build zip using mvn clean package -DskipTests=true command.
Follow the same reference link to upload your test package zip.
Provide path of testng xml in your configuration yml file.
java -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH org.testng.TestNG "config/testrun_config.xml" -d $DEVICEFARM_LOG_DIR/test-output -verbose 10
Move QAF Results to build artifacts folder to fetch QAF result.
post_test:
commands:
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- cp -R test-results $DEVICEFARM_LOG_DIR
- cp -R img $DEVICEFARM_LOG_DIR
- cp -R img $DEVICEFARM_SCREENSHOT_PATH

Related

elastic beanstalk error when use sh ./platform/hooks/prebuild : no such file or directory

I'm trying to deploy simple front-end web by elastic beanstalk.
When I deploy my app by eb deploy or eb create --elb-type application --instance-type t3.micro, There are an error when executing an sh that I add to prevent Out Of Memory.
2022/12/10 08:20:43.618277 [INFO] Executing instruction: StageApplication
2022/12/10 08:20:43.620012 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2022/12/10 08:20:43.620027 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2022/12/10 08:20:43.646596 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2022/12/10 08:20:43.647365 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2022/12/10 08:20:43.647379 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2022/12/10 08:20:43.647409 [INFO] Following scripts will be executed in order: [00_test.sh 01_configure_swap_space.sh]
2022/12/10 08:20:43.647413 [INFO] Try add execution permission
2022/12/10 08:20:43.647418 [INFO] Adding execute mode to file, original mode is 420
2022/12/10 08:20:43.647428 [INFO] Running script: .platform/hooks/prebuild/00_test.sh
2022/12/10 08:20:43.647663 [ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/00_test.sh failed with error fork/exec .platform/hooks/prebuild/00_test.sh: no such file or directory
2022/12/10 08:20:43.647668 [INFO] Executing cleanup logic
2022/12/10 08:20:43.647752 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1670660443647,"severity":"ERROR"}]}]}
2022/12/10 08:20:43.648454 [INFO] Platform Engine finished execution on command: app-deploy
I created an 00_test.sh echoing simple statement in exactly same location and chomd 777 to them. But it still doesn't work.
Some post(/.platform/hooks/': No such file or directory when deploying Django App to AWS Elastic Beanstalk) said it depends on OS, so I also tried to this all process with in vscode.
If someone who experienced same situation, want to know why this happened and solution.

Pipeline failed if scanning scala files

I created Gitlab CI which sends all files in project folder to scan in SonarQube, and it's working perfect with python files, but if I add scala files it's failed. My Gitlab CI:
image: testimage
variables:
SONARQUBE_URL: https://sonarqube.com
stages:
- PyLint
pylint:
stage: PyLint
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- apt-get install scala -y
- cd project
- scalac *.scala
- ls
- cd ..
- sed -i 's/PROJECT-NAME/'"$CI_PROJECT_NAME"'/g' sonar-project.properties
- sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.qualitygate.wait=true -Dsonar.projectVersion=${CI_PIPELINE_ID}
- echo 'Repository Link:' "$SONARQUBE_URL${CI_PROJECT_NAME}"
Some lines from logs:
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 13.545s
INFO: Final Memory: 16M/136M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Can not execute Findbugs
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: One (sub)project contains Java source files that are not compiled (/builds/scala/myrepo).
Property sonar.java.binaries was not set, it is required to locate the compiled .class files. For instance set the property to: sonar.java.binaries=target/classes
Sonar JavaResourceLocator.classpath was empty
Sonar JavaResourceLocator.classFilesToAnalyze was empty
at org.sonar.plugins.findbugs.FindbugsConfiguration.buildMissingCompiledCodeException(FindbugsConfiguration.java:154)
at org.sonar.plugins.findbugs.FindbugsConfiguration.initializeFindbugsProject(FindbugsConfiguration.java:124)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:117)
... 31 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Cleaning up file based variables
00:01
ERROR: Job failed: command terminated with exit code 1
My solution was to add this line in sonar-project.properties file:
sonar.java.binaries=.

Bamboo NUnit Parser Failing task since test cases were expected but none were found

My bamboo build NUnit Runner task is creating the following result file:
${bamboo.build.working.directory}\bld-output\${bamboo.ACM.AssemblyInformationalVersion}\ACCCMApplication\TestResult.xml
But my NUnit Parser bamboo task (which is the next running task) is failing logging
build 06-Nov-2018 06:48:46 Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 2.6861236 seconds
build 06-Nov-2018 06:48:46 Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
build 06-Nov-2018 06:48:46
simple 06-Nov-2018 06:48:46 Parsing test results under D:\build-dir\ACM-NUNITINT-JOB1...
simple 06-Nov-2018 06:48:46 Failing task since test cases were expected but none were found.
I have tried the following options in the NUnit Parser task for NUnit Test Results File/Directory with no success. What is the correct way to format the path to this xml? :
${bamboo.build.working.directory}\bld-output\${bamboo.ACM.AssemblyInformationalVersion}\ACCCMApplication\TestResult.xml
**/bld-output/${bamboo.ACM.AssemblyInformationalVersion}/ACCCMApplication/TestResult.xml
**/test-reports/*.xml
${bamboo.build.working.directory}/bld-output/${bamboo.ACM.AssemblyInformationalVersion}/ACCCMApplication/TestResult.xml (with outside build checked)
In the end made it as simple as possible.
The NUnit Runner configuration Result Filename was left at the root directory (i.e TestResult.xml)
And the NUnit Parser configuration NUnit Test Results File was set to **/TestResult.xml

Allure plugin for VSTS returns error: Unknown Test Runner

The VSTS task: Generate Allure Report is failed.
The error is :
Unable to process command '##vso[results.publish type=Allure;mergeResults=true;publishRunAttachments=true;resultFiles=D:\a\1\s\allure-report\34;]' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
Unknown Test Runner.
Question: can it be a bug or problem connected to configs?
Configurations:
.Net version: 4.6.1, Nunit3, Nunit3 allure adapter
Task to run tests is a Command Line task where I used nunit3-console.exe to run test.
Configurations for Allure plugin:
Results directory : allure-results
Target directory : allure-report/$(Build.BuildNumber)
The output logs:
****************************************************************************** Starting: Generate Allure Report
============================================================================== Task : Generate Allure Report Description : Generates Allure
report based on the test results Version : 1.0.0 Author :
Molecula Help : More
Information
============================================================================== C:\Program Files\nodejs\node.exe
D:\a_tasks\AllureGenerate_5c975f9d-1c3a-469f-b7c2-8907bf3eacfb\1.0.0\node_modules\allure-commandline\bin\allure
generate --output D:\a\1\s\allure-report\34 D:\a\1\s\allure-results
Command aborted due to exception {}.
org.apache.commons.exec.ExecuteException: Process exited with an
error: 1 (Exit value: 1) at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at
ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
at
ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)
org.apache.commons.exec.ExecuteException: Process exited with an
error: 1 (Exit value: 1) at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at
ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
at
ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46) at
ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
at
ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
Exception in thread "main"
ru.yandex.qatools.allure.data.ReportGenerationException: Could not
find any allure results at
ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
at
ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
Unable to process command '##vso[results.publish
type=Allure;mergeResults=true;publishRunAttachments=true;resultFiles=D:\a\1\s\allure-report\34;]'
successfully. Please reference documentation
(http://go.microsoft.com/fwlink/?LinkId=817296) Unknown Test Runner.
The default setting directory "allure-results" in the Allure task usually does not point to the actual path to result directory correctly since the path is different in different projects and environment. You need to update the setting to configure it to the actual path to the result directory manually.
According to the information you provided, the path to the result could be like this:
$(Build.SourcesDirectory)\SolutionFolder\ProjectFolder\bin\$(BuildConfiguration)\allure-results

Hudson failing build w/o revealing cause

Every build has failed as of Tuesday. I'm not exactly sure what happened. The Phing targets (clean/prepare) are being executed properly. Additionally, the unit tests are passing with flying colors, with only a warning for duplicate code (not a reason for a fail). I tried removing the phpDoc target to see if that was causing the error, but the build still failed.
Started by user chris Updating
file://localhost/projects/svn/ips-com/trunk
At revision 234 no change for
file://localhost/projects/svn/ips-com/trunk
since the previous build [trunk] $
/opt/phing/bin/phing clean prepare
-logger phing.listener.NoBannerLogger Buildfile:
/var/lib/hudson/.hudson/jobs/IPS/workspace/trunk/build.xml
IPS > clean:
[echo] Clean... [delete] Deleting directory
/var/lib/hudson/.hudson/jobs/IPS/workspace/build
IPS > prepare:
[echo] Prepare...
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage-html
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/docs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/app
BUILD FINISHED
Total time: 1.0244 second
[workspace] $ /bin/bash -xe
/tmp/hudson3259012225710915845.sh
+ cd trunk/tests
+ /usr/local/bin/phpunit --verbose -d memory_limit=512M --log-junit
../../build/logs/phpunit.xml
--coverage-clover ../../build/logs/coverage/clover.xml
--coverage-html ../../build/logs/coverage-html/
PHPUnit 3.5.0 by Sebastian Bergmann.
IPS Default_IndexControllerTest .
Default_AuthControllerTest ......
Manage_UsersControllerTest .....
testDeleteInvalidUserId ..
testGetPermissionsForInvalidUserId .. Audit_OverviewControllerTest
............
Time: 14 seconds, Memory: 61.00Mb
[30;42m[2KOK (28 tests, 198
assertions) [0m[2K Writing code
coverage data to XML file, this may
take a moment.
Generating code coverage report, this
may take a moment.
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
[workspace] $ /bin/bash -xe
/tmp/hudson1439023061736436000.sh
+ /usr/local/bin/phpcpd --log-pmd ./build/logs/cpd.xml ./trunk phpcpd
1.3.2 by Sebastian Bergmann.
Found 1 exact clones with 6 duplicated
lines in 2 files:
library/Ips/Form/Decorator/SplitInput.php:8-14
library/Ips/Form/Decorator/FeetInches.php:10-16
0.04% duplicated lines out of 16585 total lines of code.
Time: 4 seconds, Memory: 19.50Mb [DRY]
Skipping publisher since build result
is FAILURE Publishing Javadoc [xUnit]
[INFO] - Starting to record. [xUnit]
[WARNING] - Can't create the path
/var/lib/hudson/.hudson/jobs/IPS/workspace/generatedJUnitFiles.
Maybe the directory already exists.
[xUnit] [INFO] - Processing
PHPUnit-3.4 (default) [xUnit] [INFO] -
[PHPUnit-3.4 (default)] - 1 test
report file(s) were found with the
pattern 'build/logs/phpunit.xml'
relative to
'/var/lib/hudson/.hudson/jobs/IPS/workspace'
for the testing framework 'PHPUnit-3.4
(default)'. [xUnit] [INFO] -
Converting
'/var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/phpunit.xml'
. [xUnit] [INFO] - Stopping recording.
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Finished: FAILURE
What changed since Tuesday? Try to manually run exactly the same commands that Hudson tries to run from the same directory that Hudson starts it from (usually the jobs workspace directory). Of course with the user account that Hudson is started under.
There are several possibilities. ranging from standard groups for a directory, to permission, or other things outside of Hudson. Was Hudson upgraded? Was a plugin upgraded? Was the OS or php upgraded? Was there a change in the default or user .profile or .env (or the equivalent files)? Does another process accesses the workspace? ......
Once I had the problem that all of the sudden my deployment scripts did not run anymore. The mystery was, that I could still run the script from command line with the Hudson user account. The reason was simple but took a while to uncover. There was a java upgrade from 5 to 6. Both versions were available. After comparing the environment variables, there was a difference in the path. The problem was that the new path was set in the global .profile. But Hudson does not open an interactive shell, therefore the .profile will not be executed. If you have a problem like this, you can put the initialization in the .env file (or whatever the filename is for your system), because this will be run regardless if it is a interactive shell or not. Alternatively you can configure Hudson to set it on master or node/slave level.
if you want a command to not break the 'build' as a failure you have to add #! in front of the command to prevent the flags -xe which produce this behaviour.