Error while setting up Allure Test Reporting in gradle project - gradle

I would like to setup Allure Test Report for the geb framework using gradle (https://gebish.org/), but get the error below although json files are created in the results folder.
added allure.properties with the following content in src/test/resources (inside the project folder):
allure.results.directory=build/allure-results
also added this to build.gradle, which points to the correct location:
systemProperty 'allure.results.directory', "$buildDir/allure-results"
https://gist.github.com/rnemeth1980/df0f7ed46487fca13e8d412c23984fbb
shows parts of build.gradle
get the following error message:
Cannot write to file '/home/abc/build/allure-results' specified for property '$1' as it is a directory.
more detailed error log https://gist.github.com/rnemeth1980/9c66bc96046086253c79275e88aef5d2
please help.

I had the same issue. Resolved it by install 'Gradle Extension' plugin into Intellij.

Related

Error: Property "sonar.cfamily.build-wrapper-output" was not specified Sonarqube

I'm configuring my sonarqube to run on my project, following the instructions given to run from the cloud I have my file like this:
sonar.projectKey=yisera_aaswtest
sonar.projectName=aaswtest
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.language=js
sonar.profile=node
sonar.exclusions=node_modules, migrations, models_old, seeders, .gitignore
I downloaded sonarqube CLI, copied the bin file to %path% on windows but for some reason, after running the test, I get the following error:
Property "sonar.cfamily.build-wrapper-output" was not specified
As you can see, my project is in javascript(nodejs specifically) and not C++, and even then, for some reason it's scanning my node_modules folder while I explicitly state in my properties file to exclude scanning there.
Any ideas what I might be doing wrong? Here is the command I run:
sonar-scanner.bat -Dsonar.projectKey=yisera_aaswtest -Dsonar.organization=yisera-bitbucket -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=cc10c0f538a6b50c876c2c53ed479eadd3e60988

What is the TestNG XML report pattern for Jenkins when using Maven with surefire?

I'm using TestNG Results Plugin.
I defined TestNG XML report pattern as: **\target\surefire-reports\testng-results.xml
I'm getting this error:
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **\target\surefire-reports\testng-results.xml
Did not find any matching files.
What should be the correct pattern?
I just fixed this problem!
It's because that the current directory was changed to the default Jenkins workspace, something like '/Users/Shared/Jenkins/Home/workspace/your_project_name' when it ran!!
You will find it yourself if you add shell command 'pwd' before Post-build Actions in the Configuration of your project in Jenkins.
You just need configure your project in General -> Advanced... -> Use custom workspace, and fill in the full path of your project, and it will work!!!
The following pattern works for me: **/target/surefire-reports/*.xml
Also ensure that the default listeners are not disabled in your surefire configuration to ensure that surefire creates the xml reports for ReoprtNG/TestNG. Until I removed the disabling of default listeners I got the same error.

JMeter gradle plugin causes build to fail with exception

I am trying to use the JMeter gradle plugin to run jmeter tests and produce a log on build.
Currently, I have added this to my build.gradle file:
apply plugin: 'jmeter'
buildscript{
repositories{
mavenCentral()
}
dependencies{
classpath "com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13"
}
}
jmeterRun.configure{
jmeterTestFiles = [file("src/test/jmeter/gradleTest.jmx")]
enableReports = true
}
However when I run the build.gradle file using 'jmeterRun' I get the following error:
org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-bin.zip'.
Here is the full error message
and it suggests I check the jmeter logs for more information, though no new logs are created and there is no entry in the existing log related to this error.
I had previously tried to use the plugin as suggested here, however I was getting an error saying the plugins block was not correct (despite being copy-pasted).
How do I get the JMeter plugin working properly?
Regardless of whether or not your test uses one one, a jmeter.properties file is required, otherwise an error will occur. Normally this error should say that
Could not read JMeter properties file
according to here.
I am still unsure why a jmeter.log file was created.

Failed to publish TestNG Report in Jenkins

I have used Maven project with Selenium & TestNG to create automated scripts which I want to execute from Jenkins. In Jenkins I have added the TestNG plugin to publish the TestNG report. But it is not getting displayed. I'm getting the below mentioned error.
Error:
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: /target/surefire-reports/testng-results.xml
Did not find any matching files.
Finished: SUCCESS
Actual path of the TestNG report file:
E:\STUDY_MATERIAL\JAVA\WORKSPACE\SeleneniumFrameWork\target\surefire-reports\testng-results.xml
I have tried the following options but didn't work out for me.
Tried giving the full path of the TestNG report. Forward ans backward slash in the pattern.
I have tried different other options by changing the TestNG result file path but it's working for me.
Please share some inputs on how to resolve this issue.
"testng-results.xml" file is available in workspace. But it's failed to display the report. I have attached screenshot of Jenkins workspace and Console Output.
Note: I am using Jenkins 2.7.0 in Windows 10.
Jenkins Workspace
I have attached the Job configuration details of Jenkins.
Job Configuration Details
Few checkpoints :
1. Check if testng is producing this file at the specified location : /target/surefire-reports/testng-results.xml
2. TestNG needs to be configured to generate xml report
If this file is there, pass path in file locator as :
target/surefire-reports/testng-results.xml
Hopefully, you will get results on jenkins if everything mentioned above is correct.

gradle build causing error :startScripts Failed

I am following the step-by-step instructions provided in http://spring.io/guides/gs/consuming-web-service/#scratch to learn how to consume a SOAP web service using Gradle and Spring-WS. I have created the folder structure specified in the above URL (namely., c:/src/main/java/hello) and copied the source code for build.gradle, WeatherClient.java, WeatherConfiguration.java and Application.java into this directory structure. When I execute the command "gradle build" in c:\src\main\java\hello, I am getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':startScripts'.
No value has been specified for property 'mainClassName'.
Following a suggestion I found in one of the Q&A in stackoverflow, I included mainClassName = '' at the end of the build.gradle file. The above error was overcome, but I do not find the "gs-consuming-web-service.jar" file in the C:\src\main\java\hello\build\libs folder as suggested by the instructions. Rather, I find a jar file named "hello.jar" in this folder.
And if I try to execute the hello.jar executable, I get a java.lang.ClassNotFoundException.
Has anyone tried to follow the instructions given in the URL: http://spring.io/guides/gs/consuming-web-service/#scratch with success? If yes, can you please advise where I have gone wrong?
I was able to get the demo project work by following the steps:
Create a folder named gs-consuming-web-service and in it, create a file named build.gradle with the source code provided in http://spring.io/guides/gs/consuming-web-service/#scratch. Add an extra dependency (the one that is highlighted below) in this build.gradle file at the location below:
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.ws:spring-ws-core")
compile(files(genJaxb.classesDir).builtBy(genJaxb))
**compile("org.springframework:spring-web:4.1.4.RELEASE")**
jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"
}
Create the directory structure ...gs-consuming-web-service/src/main/java/hello and in the hello folder, create the java files for WeatherClient.java, WeatherConfiguration.java and Application.java using the source code in http://spring.io/guides/gs/consuming-web-service/#scratch.
Launch InteliJ IDE and select the import project option. In the ensuing screen/step, select the build.gradle file in gs-consuming-web-service folder. Select check-boxes "Use auto-import" and "Create directories for empty content roots automatically". In this screen, make sure that the Gradle home, Gradle JVM are pre-populated correctly (in my case, these have been pre-populated with the path to Gradle-2.8 and JDK 1.8 respectively). Click OK.
At command prompt window, while within the gs-consuming-web-service folder, execute the command "gradle build".
This should get you to a successful gradle build. Good luck and happy learning.

Resources