I have a grails application and I'm writing testcases in junit. is there any way to start grails server using JUNIT.
You can run your unit test by --
Run as JUnit Test
or otherwise
test-app: Runs all Grails unit and integration tests and generates reports.
In your case you could do:
test-app unit:
or
test-app integration:
or for a specific ExampleTests.groovy file:
test-app unit: Example
Related
I am trying to run testNG tests, cucumber scenarios using Gradle.this is my build script
while executing command "grdale test" from Jenkins pipeline ,getting an error-error
I suspect with WebDriver is not getting invoked is the issue and finding solution.
I have been trying to integrate the Allure report with Geb and Spock framework But I am not able to make.
As Allure report has its own command to run the test and similarly Geb and Spock has its own to run the test. How do I combine the both to run the test
Allure Report Command : ./gradlew clean build allureReport
Geb and Spock Command : ./gradlew chromeTest
How do I combine both to run the Chrome test and get the Allure Result
You help is appreciated
On my Jenkins pipleline I run unit tests on both: debug and release configurations. Each test configuration generates separate JUnit XML results file. Test names on both: debug and release configuration are same. Currently I use the following junit command in order to show test results:
junit allowEmptyResults: true, healthScaleFactor: 0.0, keepLongStdio: true, testResults: 'Test-Dir/Artifacts/test_xml_reports_*/*.xml'
The problem is that on Jenkins UI both: debug and release tests results are shown together and it is not possible to know which test (from debug or release configuration) is failed.
Is it possible to show debug and release tests results separately? If yes, how can I do that?
We run the same integration tests against two different configurations with different DB types. We use maven and the failsafe plugin, so I take advantage of the -Dsurefire.reportNameSuffix so I can see the difference between the two runs.
The following is an example block of our Jenkinsfile:
stage('Integration test MySql') {
steps {
timeout(75) {
sh("mvn -e verify -DskipUnitTests=true -DtestConfigResource=conf/mysql-local.yaml " +
"-DintegrationForkCount=1 -DdbInitMode=migrations -Dmaven.test.failure.ignore=false " +
"-Dsurefire.reportNameSuffix=MYSQL")
}
}
post {
always {
junit '**/failsafe-reports/*MYSQL.xml'
}
}
}
In the report, the integration tests run against mysql then show up with MYSQL appended to their name.
It looks no solution for my question.
As a workaround I changed JUnit XML report format and included build variant name (debug/release) as a package name.
I have a Grails 3 application that I'm trying to configure an embedded datastore for functional tests for. I have the configuration for the datastore specific to the 'test' environment.
When I run 'grails test-app', the app connects to the correct datastore and my functional tests pass.
When I try testing the application with 'gradle test', it tries to connect to the datastore for the development environment and fails.
I have tried specifying the Grails environment to use for the gradle test task by adding this to build.gradle:
test {
String testEnvArg = '-Dgrails.env=test'
if (jvmArgs) {
jvmArgs.add(testEnvArg)
} else {
jvmArgs = [testEnvArg]
}
}
But the behavior appears to be unchanged.
How can I make the gradle 'test' task use the correct Grails environment configuration?
You must specify environment:
gradle -PgrailsEnv=test test
To boot run with production environment and gradle wrapper below worked:
./gradlew -Dgrails.env=production bootRun
And with requested test environment:
./gradlew -Dgrails.env=test bootRun
How do you add a post-build action in Jenkins to kick off unit and integration tests using sbt 0.13? JUnit is the testing suite that I'm using, and there doesn't seem to be a way for the test results to be in a junitxml output.
Use the maven surefire plugin in your build.sbt to generate the xml report.
libraryDependencies += "org.apache.maven.plugins" %% "maven-surefire-report-plugin" % "2.17"
Then your Post-build Action is to Publish JUnit test result report, which will be located here:
target/surefire-reports/TEST-*.xml