Integrating Karate with Circleci (Config.yml) [duplicate] - circleci

This question already has an answer here:
Visual reporting for Karate without Jenkins CI
(1 answer)
Closed 1 year ago.
I'm totally new with this CI stuff and was asked to use Circleci. I have been googling for some hours and still didn't get stuff clear on how I can integrate Karate with Circleci.
I'm using Gradle for dependencie so I'm pretty clueless on how to make my Karate tests running on Circleci.
Any good soul to help me out how can I config the .yml circleci file to run my Karate tests?
I really appreciate the help!

try prefixing your commands with this text cat /dev/null | so your cmd should read like this cat /dev/null | gradle dependencies test and cat /dev/null |karate test
Can you also post the Error when it's failing

Related

Docker / TeamCity / xUnit - Tests tab missing and failing tests don't stop the build

I'm using Docker Swarm on Linux to host TeamCity. In my instance I'm running integration tests via a docker-compose file, using xUnit.
I'm really struggling with the steps I need to use to get Tests tab to appear when I'm running my tests (which in turn will stop my builds if there is a failing xUnit test). I was able to get this to work fine with TeamCity 2017.1.2 but it refuses to work in TeamCity 2017.2.4.
I've added "ENV TEAMCITY_PROJECT_NAME=fake" to my Docker file as per the example (which I think is all I need to do).
How do I get the Tests tab back, and get my builds to stop when a test breaks please?!
Any assistance gratefully received - I'm tearing my hair out over this one!
Thanks. I did manage to get it working in the end.
The end of my Dockerfile is as follows:
FROM microsoft/dotnet:2-sdk
...
...
# Set the flag to tell TeamCity that these are unit tests:
ENV TEAMCITY_PROJECT_NAME = ${TEAMCITY_PROJECT_NAME}
# Run the tests:
ENTRYPOINT ["dotnet", "test", "--verbosity=normal"]
I also added this to the docker-compose file I'm using:
version: '3.6'
...
...
steve.core.tests:
image: steve.core.tests:tests
build:
context: .
dockerfile: Dockerfile-run-tests
environment:
- TEAMCITY_PROJECT_NAME
Might be belt and braces but it seems to work.
I'm using TeamCity server version 2018.1.1 with the same agent version. I've installed Docker Compose v1.22.0 into my TeamCity agent.
Now I just need to work out how I can fail my builds when the test coverage isn't high enough. See here for my next question: Breaking the build in TeamCity if .NET Core unit tests running under Docker have code-coverage less than 90%
I ran into this problem as well. Nick Adcock posted a nice solution at https://devblog.bango.com/2017/10/13/build-in-docker-test-with-net-core-report-to-teamcity/
He supplies an updated version of the microsoft/dotnet:2.0-sdk image that outputs test results in a format that can be read, used and presented by TeamCity. I'm using it with TeamCity 2017.2.4 and it seems to work fine. It didn't count my tests correctly, but at least now I have easily visible test outcomes.
Hope this was able to help you.

Setting up your module with Travis CI

Anyone got a boilerplate the world can use for Travis CI build testing for modules?
I havn't used Travis CI before but I got it hooked up however all my builds are failing, and the logs just say phpunit exited with code 1. I assume I'm definitely missing something and I have a feeling I need to download all silverstripe composer dependecies but have no idea where to start
I'm wanting it to run tests against (mymodule)/tests folder and hoping it's possible
The section on "Connecting to CI" isn't very helpful!
To set up with travis you'll need to use the travis-support module.
It's quite straightforward to do with a boilerplate .travis.yml which you can see on pretty much any SilverStripe module that's using travis. Here's a pretty standard one.
That file will test against PHP 5.3-5.6 as well as against SilverStripe versions 3.1.x-dev (latest 3.1 development version) all the way to 3.x-dev (3.5 development version).
You'll also need to customise the final line to run the correct test suite.

How to get surefire reports form Travis-CI build?

The question says it all really. How can I download or view the surefire-reports generated during a build on Travis?
You can just do
after_failure:
- cat target/surefire-reports/*.txt
Having not found a direct way to access the surefire-report files I came up with the this workaround:
In .travis.yml I added an after_failure hook:
after_failure: print_surefire_reports.sh
In the hook print_surefire_reports.sh I put:
#!/usr/bin/env sh
echo "Current directory is $(pwd)"
echo "\n=== SUREFIRE REPORTS ===\n"
for F in target/surefire-reports/*.txt
do
echo $F
cat $F
echo
done
I am using python html2text in travis after script phase.
My travis script looks like:
after_script:
- python html2text.py target/site/surefire-report.html
surefire-report.html is generated by surefire-report-plugin
See example output here: https://travis-ci.org/rmpestano/dbunit-rules/builds/160170324#L3541
Based on this bug report and this question, there is not a clean way to do this. There are, however, a couple unsupported methods of getting the reports listed in the bug report.
Those may provide options for you to look into, but the Travis CI maintainers have not provided or supported an explicit way to handle this yet. Note that those bug reports/questions are well over a year old too.
The prevailing suggestion in those threads seems to be to have Travis recommit the build artifacts back to the user's repository. This, however, requires authentication, which you probably shouldn't store in your .travis.yml file

How to get jenkins to run my qunit test using phantomjs

Im working on getting our CI (Jenkins) to use and run our qunit test, we have qunit-reporter, qunit.compposite and phantomjs to execute the whole. Im not ant expert so im using windows batch command as a prestep with the following command
phantomjs src\test\webapp\js\runner.js src\test\webapp\jquery.all.test.html > test-report.xml
Now this runs and generates the junit xml file, with a few issues, firstly since I use pipe phantomjs performance information is also put into the file so that's my first issue
My second issue is that I have no idea in the world how I can get Jenkins to actually read the xml file instead of just considering it random stuff, similar to it interpreting when we have junit test run.
Just for reference the project is a maven project.
All advice is welcome :)
In Jenkins, configure your job, add a post build action, select publish JUnit test result report then add the path to your xml file in the requested field.
A couple years ago, a colleague of mine and I worked on getting PhantomJS to run QUnit tests and output JUnit XML that Jenkins can consume:
http://www.cameronjtinker.com/post/2013/09/24/QUnit-JSCoverage-and-Jenkins.aspx
I had forgotten to post this on my blog after we worked on this so I just posted it today when I saw your question. Much has changed since 2011 when this was originally written, but it should have most of the same concepts involved.

Robotium Tests not running on Jenkins but local

i try to integrate my Robotium Tests on our Jenkins Server. I implemented an android Test Project that based on our app Project. Everything works like a charm when i run the Tests on my local Machine on Windows out of Eclipse and also by calling from shell by call
'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner'
So far, so good, but after i set up a build Job in Jenkins, let the Projects build by maven clean install sign etc. none of my tests will be proceeded. I also tried to call 'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner' as shell command after the build step but also no result. The build ended up with just 2 Tests shown log below
[workspace] $ /bin/sh -xe /tmp/hudson3571502822112946903.sh
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell pm list instrumentation
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner (target=com.zeppelin.zemos.addispo)
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell am instrument -w com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner
android.test.AndroidTestCase:.
android.test.LoaderTestCase:.
Test results for InstrumentationTestRunner=..
Time: 0.031
OK (2 tests)
Just the 2 Tests AndroidTestCase and LoaderTestCase are shown up and it seems that all of my other Testcases (i've implemented 11) are not processed by Jenkins.
I spent a long time googling around but found no solution for this. Could this be a ant Problem? I have Version 1.8 local and 1.6 on the Jenkins Server. Or is there another Problem i cannot see.....
Thanks a lot
You can try uninstalling the package from device/ emulator, using
"adb uninstall your_package"
Then, do a clean debug install again and then run the tests.

Resources