Parsing through spock test results - java

All, I have a test suite developed using spock-groovy framework. The output of this is a set of html files. I have a requirement to run this test as part of a docker container on cloud. After the test execution, I would like to get a summary of the test results and also a link of the html files to view the details of these results.
Is there a library already available for parsing the test results for spock? How can I get this done using Java from the app running in the container?
Build tool: gradle.
I created the docker container using the Dockerfile. The entrypoint for this docker container is a shell script which sets required variables and then executes the command gradle clean test....
Few issues I am trying to resolve:
The container is able to execute the tests but I am unable to get the results out of that container. I am trying the approach as mentioned in point 2 below to get the results out of the container.
I have added def cleanupSpec() {....} method where I am trying to send a notification to slack channel. As I see from inside the container, this step is not getting executed. When I run this app locally, I am able to see the notification being sent.

Related

Azure/IntelliJ shows runScenario instead of actual test name using Cucumber

I have just added my cucumber test to an Azure pipeline. After running the pipeline I noticed that my cucumber tests are showing up as runScenario instead of the test name.
If I click on the runScenario and I go to Attachments I do see that it shows my test scenario there.
If I run it in IntelliJ my tests shows up as runScenario []
I've googled a bit but cant seem to find how to fix that. Any idea how to show my test scenario or Feature?
On your Agent job tasks I used Maven.
In the configuration under JUnit Test Results add the path to your Junit result (Should be an .xml file). For me specifically it was under:
$(System.DefaultWorkingDirectory)/<project>/target/cucumber-junitReports/Cucumber.xml

how to add new azure function via maven plugin at intellij IDE

I want to use timerTrigger in azure functions.
I created function according this guide:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-maven-intellij
it is generated by default httpTrigger. I tried command of azure-functions:add.
I succeeded adding timerTrigger but I encountered with a lot of errors
How I can delete httpTrigger and declaring only timerTrigger?
before I run the azure-functions:add:
after running the command:
I guess it is related to azure plugin and maven plugin conflict but not sure and I don't know how to handle such this situation
any help will be appreciated
thanks
For now, I suppose it doesn't support create java function with default timer trigger. However you could delete the HTTP one then create the timer, cause you don't provide much information so maybe you could refer to my steps.
Create the function with maven.(I'm using the 1.22 version)
Delete the HTTP function, and delete the test folder.
Create the Timer Trigger function.
After this the project will be like this.(Before packaging remember set the storage connection string in the local.settings.json)
Package it.(Use the package method in the Lifecycle.)
Run it with azure-functions:run under azure-functions plugin.

Xcode 8 Jenkins JUnit error: test report no report files found

I'm new to Jenkins and am trying to setup CI for my iOS app. I've created a unit test target in the project and have configured Jenkins to properly build and run my unit tests, but the build fails when trying to actually output the rest results xml file and I'm not sure what I'm doing wrong. I borrowed a lot of ideas presented from these sources:
https://www.raywenderlich.com/22816/beginning-automated-testing-with-xcode-part-22
http://www.sailmaker.co.uk/blog/2013/04/02/advanced-jenkins-for-ios-and-mac/
My actual console log after a build looks like this:
=== BUILD TARGET run_to_it OF PROJECT run_to_it WITH CONFIGURATION Debug ===
Check dependencies
=== BUILD TARGET run_to_itTests OF PROJECT run_to_it WITH CONFIGURATION Debug ===
Check dependencies
** BUILD SUCCEEDED **
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
My build step execute shell looks like this :
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
security unlock-keychain -p ${KEYCHAIN_PASSWORD} ${KEYCHAIN_PATH}
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PASSWORD} ${KEYCHAIN_PATH}
xcrun xcodebuild clean build CODE_SIGN_IDENTITY="${CODE_SIGNING_IDENTITY}" PROVISIONING_PROFILE=${PROVISIONING_PROFILE} OTHER_CODE_SIGN_FLAGS="--keychain ${KEYCHAIN_PATH}"
xcodebuild -target run_to_itTests -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO TEST_AFTER_BUILD=YES GCC_TREAT_WARNINGS_AS_ERRORS=NO WANT_IOS_SIM=YES OBJROOT="${WORKSPACE}"/tmp/objs build | /usr/local/bin/ocunit2junit
My post build step for where the test reports are to be placed looks like this:
I've ensured I've installed the necessary plugins as well as installing the ocunit2junit gem in the /usr/local/bin directory as well as having installed the JUnit plugin in Jenkins.
I'm not 100% sure if any xml file is being generated at all as I've looked through every folder in the Jenkins workspace and see no such xml file anywhere. I'm not sure if I need to explicitly specify this file to be created in any of the build steps or if it is handled by default. I've looked far and wide on the internet and I've not been able to conclusively figure out the problem.
For context: My Jenkins server is running on my Mac at the moment. I have a Jenkins user with a workspace on my local machine. I'm also running macOS Sierra and I'm not sure if there could be any permissions issues with the test-reports folder. I see that the folder is being created but no xml file is ever placed inside of it.
If I remove the Publish JUnit test report result then my project will build successfully.
Value on Test report XMLs field (Publish JUnit test result report option) seems to be correct. If you don't have any xml file inside this directory after your build, the problem is inside your test (and generation of xml junit result file), not in Publish JUnit test result report configuration.
Can you be sure that your unit test generate result inside xml file, with Junit format?

Why does ":project:testXlib" replace the ":project:test" Gradle task and how does that work?

Environment
I'm currently trying to run JavaFX GUI tests via xvfb on multiple environments on Travis CI. I'm using Gradle to run these tests while using the TestFX and NestedRunner testing frameworks to write them. Before running the tests, export DISPLAY=:99.0 is called.
Context
There are times when the build succeeds and other times when it fails. However, I've noticed that Gradle outputs a single line that I can use to predict when the build will succeed or fail.
Before that line appears, one will see the following in the Travis CI log:
:richtextfx:compileJava
:richtextfx:processResources
:richtextfx:classes
:richtextfx:compileTestJava
:richtextfx:processTestResources
:richtextfx:testClasses
After that, one of two lines appears that predicts whether the build will succeed/fail:
on success: :richtextfx:testXlib: extension "RANDR" missing on display ":99.0".
on failure: :richtextfx:test
My Question
Why does Gradle change the test task to testXlib task? What are the inner mechanisms that handle this? And what does it all mean?
Gradle for sure does not do this. I've never heard of a task called testXlib and also the complete Gradle source does not contain this character sequence.
Either your build script does this, or some plugin you apply, or an init script that is applied by Travis CI.
Try to increase the logging level to debug and also add a call to tasks --all, maybe that will shed some light.

Access teamCity Build number in Java

I am running my automation test suite from TeamCity. I need to access the buildId property as I have a situation where I have to construct a file path using this buildId.
I tried using System.getProperty("teamcity.build.id") but it just displays null. How can I access the buildID of the current team city run from my automation code which is written in java.
You can pass it while running the build step, using %build.number%.
https://confluence.jetbrains.com/display/TCD5/Predefined+Properties

Categories