First of all let me tell you am a new in this . Actually i am having Cucumber framwork with graddle and using Webdriver to automate.
I have created some test cases and are running fine on local machine. but when i am running with graddle through command prompt an error is coming like error: package org.junit does not exist.
I am having the build.graddle file like this
apply plugin: ‘java’ version = ‘1.0’
repositories {
mavenCentral()
maven {
url “http://repo.springsource.org/release”
url “http://oss.sonatype.org/content/groups/public/”
} }
sourceCompatibility = 1.6 targetCompatibility = 1.6
configurations {
cucumberRuntime {
extendsFrom testRuntime
} }
task test(overwrite: true) {
dependsOn assemble, processTestResources, compileTestJava
doLast {
javaexec {
main = “org.junit.runner.JUnitCore”
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [‘com.erecyclingcorps.test.’ + (System.properties[“spring.profiles.active”].tokenize("_")[0]).toUpperCase() + ‘Test’]
systemProperties System.properties
}
} }
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the ‘test’ task in all subprojects
reportOn test }
dependencies {
compile ‘org.seleniumhq.selenium:selenium-java:2.32.+’
compile ‘org.apache.commons:commons-lang3:3.1’
compile ‘org.springframework:spring-context:3.2.3.RELEASE’
testCompile ‘info.cukes:cucumber-java:1.1.3’
testCompile ‘info.cukes:cucumber-junit:1.1.3’
testCompile ‘info.cukes:cucumber-spring:1.1.3’
testCompile ‘junit:junit:4.10’
testCompile ‘org.easytesting:fest-assert-core:2.0+’
}
Junit version is 4.10.
actually real thing was that i need to generate report for test executed. but for that i have been told that tests should run fine through Gradle first.
Please let me know if you want some more details.