I am making a skeletton of a java project; the gradle build file has an annoying problem : tests are ran twice, one time by the task 'JUnitPlatformTest' and a second time by the task 'test'.
The first one seems to trigger the second, so I can't disable it, and I would like to keep the second one as there is a little difference between them : the first one is in the console (of intelliJ) and the second uses the integrated intelliJ window.
here is gradle.build
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3'
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'
}
}
plugins {
id 'java'
id 'edu.sc.seis.launch4j' version '2.4.4'
}
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'javafx-gradle-plugin'
apply plugin: 'eu.appsatori.fatjar'
junitPlatform {
platformVersion '1.0.3'
reportsDir file('build/test-results/junit-platform')
enableStandardTestTask true
//show results summary even on success.
details details.SUMMARY
filters {
tags {
// Framework tests need to be run only when required to verify that this framework is still working.
exclude "Framework"
}
includeClassNamePatterns '.*Test', '.*Tests'
}
}
group 'lorry'
version '1'
sourceCompatibility = 1.8
//mainClassName="imports.ColorfulCircles"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
def final junitVersion = "5.2.0"
compile group: 'com.google.inject', name: 'guice', version: '4.1.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
compile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVersion
//compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.11.0'
compile group: 'org.assertj', name: 'assertj-core', version: '3.9.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: junitVersion
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.7.22'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVersion
compile 'org.hamcrest:hamcrest-all:1.3'
testCompile "org.testfx:testfx-core:4.0.13-alpha"
testCompile 'org.testfx:testfx-junit5:4.0.13-alpha'
testRuntime 'org.testfx:openjfx-monocle:8u60-b27'
}
test {
useJUnitPlatform()
jvmArgs = [
"-Dtestfx.robot=glass",
"-Dtestfx.headless=true",
"-Dprism.order=sw",
"-Dprism.text=t2k",
"-Dheadless.geometry=1920x1200-32"
]
}
test.dependsOn 'clean'
jfx {
// minimal requirement for jfxJar-task
mainClass = 'imports.ColorfulCircles'
// minimal requirement for jfxNative-task
vendor = 'lolveley'
}
jar {
baseName = 'executable3'
version = ''
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'imports.ColorfulCircles'
)
}
}
launch4j {
outfile='bibliotek-v3.exe'
mainClassName = 'imports.ColorfulCircles'
icon = "${projectDir}\\icons\\hands2.ico"
copyConfigurable = project.tasks.fatJar.outputs.files
jar = "lib/${project.tasks.fatJar.archiveName}"
//headerType = "console"
//jar = "${buildDir}\\productFatJar\\fat.jar"
}
junitPlatformTest {
jvmArgs = [
"-Dtestfx.robot=glass",
"-Dtestfx.headless=true",
"-Dprism.order=sw",
"-Dprism.text=t2k",
"-Dheadless.geometry=1920x1200-32"
]
}
and here is the result:
Testing started at 19:25 ...
19:25:01: Executing task 'test'...
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :clean
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :junitPlatformTest
constructeur appelé
Before all
Before each
my test 1
Before each
my test 2
This test method should be run
Test run finished after 3630 ms
[ 4 containers found ]
[ 0 containers skipped ]
[ 4 containers started ]
[ 0 containers aborted ]
[ 4 containers successful ]
[ 0 containers failed ]
[ 7 tests found ]
[ 0 tests skipped ]
[ 7 tests started ]
[ 0 tests aborted ]
[ 7 tests successful ]
[ 0 tests failed ]
> Task :test
constructeur appelé
Before all
Before each
my test 1
Before each
my test 2
This test method should be run
BUILD SUCCESSFUL in 13s
5 actionable tasks: 5 executed
19:25:15: Task execution finished 'test'.
According to this official website, ...
The JUnit Platform Gradle Plugin is deprecated
The very basic junit-platform-gradle-plugin developed by the JUnit team was deprecated in JUnit Platform 1.2 and will be discontinued in 1.3. Please switch to Gradle’s standard test task.
So you should remove this plugin from your build file and, if necessary, try to port the remaining settings to the test task of the java plugin.
Related
i use gradle-wrapper and have Gradle 6.8 installed.
Succesfull Runs:
bash gradlew check
bash gradlew test
Failed Runs:
`
Task :findMainClass FAILED
Caching disabled for task ':findMainClass' because:
Build cache is disabled
Task ':findMainClass' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:findMainClass (Thread[Execution worker for ':',5,main]) completed. Took 0.001 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':findMainClass'.
'java.io.File org.gradle.api.tasks.SourceSetOutput.getClassesDir()'
`
This is my build.gradle:
`
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
}
}
ext {
bootVersion = "1.5.2.RELEASE"
}
//apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
repositories {
mavenCentral()
//mavenLocal()
//maven { url "http://repo.springsource.org/snapshot" }
//maven { url "http://repo.springsource.org/milestone" }
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencies {
implementation group: 'org.springframework.cloud', name: 'spring-cloud-core', version: '1.2.9.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector', version: '1.2.9.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector', version: '1.2.9.RELEASE'
implementation "org.springframework.boot:spring-boot-starter-actuator:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-tomcat:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-web:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-data-jpa:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf:${bootVersion}"
implementation 'com.amazonaws:aws-java-sdk:1.11.113'
runtimeOnly "org.yaml:snakeyaml:1.18"
runtimeOnly "mysql:mysql-connector-java:6.0.6"
implementation group: 'net.minidev', name: 'json-smart', version: '2.3'
}
task wrapper1(type: Wrapper) {
gradleVersion = '6.0.1'
}
`
and this is my gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=file:///tmp/my-project/gradle-6.8-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
Can you help me to solve this issue?
I was trying to deploy an cloudfoundry test applciation: https://github.com/cloudfoundry-samples/cf-s3-demo
I'm trying to setup unit tests in the new LibGdx project.
I added dependencies to :core project:
project(":core") {
apply plugin: "kotlin"
apply plugin: 'kotlin-kapt'
dependencies {
// ...
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.1"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
kaptTest "org.mockito:mockito-core:3.3.3"
kaptTest "com.google.dagger:dagger-compiler:$daggerVersion"
}
Test folder: core/src/test/kotlin/
Test class:
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
class FirstTest {
#Test
fun `my first test`() {
assertEquals(1,1)
}
}
But I got error: Unresolved reference: junit
What I'm doing wrong?
P.S.: I'm trying run tests in IntelliJ IDEA
[ EDIT ]
Link to repo test branch: https://github.com/Alcadur/libgdx-not-working-tests
Finally, I found the solution for my problem (full article)
I have to replace
sourceSets.main.java.srcDirs = [ "src/" ]
sourceSets.test.java.srcDirs = [ "test" ]
to
sourceSets.main.java.srcDirs = [ "src/main/java/" ]
sourceSets.test.java.srcDirs = [ "src/test/java/" ]
I also update repo for this question: GitHub repo
After I added copyBootstrap to build.gradle I am getting the next error when try to run the build task:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project '.
Cannot change dependencies of configuration ':providedCompile' after it has been included in dependency resolution.
How could this issue be solved? I have searched on Internet but no solutions were found. I got the copyBootstrap task from this link. Their goal is to extract all content from org.webjars group jars to a specific path.
I am using Gradle 3.2 and Intellij IDEA 2016.2.5
//group 'org'
//version '1.0-SNAPSHOT'
task wrapper(type: Wrapper) {
gradleVersion = '3.2'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.4.0'
}
}
repositories {
mavenCentral()
jcenter()
}
//apply plugin: 'java'
//apply plugin: 'eclipse-wtp'
//apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
//compile group: 'org.akhikhl.gretty', name: 'gretty', version: '1.4.0'
// ********************************************************************************************************
// SPRING FRAMEWORK, ORM Y H2DB
// ********************************************************************************************************
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.3.4.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.4.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version: '4.3.4.RELEASE'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.3.Final'
// ********************************************************************************************************
// JACKSON DATABIND
// ********************************************************************************************************
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.4'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.4'
// ********************************************************************************************************
// THYMELEAF
// ********************************************************************************************************
compile group: 'org.thymeleaf', name: 'thymeleaf-spring4', version: '3.0.2.RELEASE'
// ********************************************************************************************************
// SERVLET
// ********************************************************************************************************
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
// ********************************************************************************************************
// MYSQL CONNECTOR
// ********************************************************************************************************
//compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.5' issues with time zone
compile 'mysql:mysql-connector-java:5.1.6'
// ********************************************************************************************************
// WEB RESOURCES
// ********************************************************************************************************
compile group: 'org.webjars', name: 'angularjs', version: '1.5.8'
compile group: 'org.webjars', name: 'jquery', version: '2.1.4'
compile group: 'org.webjars', name: 'bootstrap', version: '3.3.7'
compile group: 'org.webjars', name: 'jquery-ui', version: '1.12.1'
compile group: 'org.webjars', name: 'modernizr', version: '2.8.3'
// ********************************************************************************************************
// JUNIT AND SPRING TEST
// ********************************************************************************************************
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.springframework', name: 'spring-test', version: '4.3.4.RELEASE'
// ********************************************************************************************************
// GOOGLE DRIVE API
// ********************************************************************************************************
compile group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0'
compile group: 'com.google.apis', name: 'google-api-services-drive', version: 'v2-rev245-1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-java6', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.22.0'
// ********************************************************************************************************
// DROPBOX API
// ********************************************************************************************************
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '1.8.2'
// ********************************************************************************************************
// TWITTER API
// ********************************************************************************************************
compile group: 'org.twitter4j', name: 'twitter4j-core', version: '4.0.5'
// compile group: 'org.slf4j', name: 'slf4j-mylearn.api', version: '1.7.21'
// compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.21'
// compile files("twitter/main/webapp/") // add this path as a classpath
}
task copyBootstrap(type: Copy) {
into "$buildDir/static_resources"
configurations.compile
.files({ it.group.equals("org.webjars")})
.each {
from zipTree(it)
}
}
//build.dependsOn(copyBootstrap)
task copyToLib2(type: Copy) {
into "$buildDir/output/libs"
from configurations.runtime
}
war {
archiveName = 'ROOT.war'
destinationDir = file('webapps')
}
// ********************************************************************************************************
// GRETTY SETTINGS
// ********************************************************************************************************
/* Change context path (base url). otherwise defaults to name of project */
gretty {
port = 8081
contextPath = ''
}
This problem seems to be related to the org.akhikhl.gretty plugin you are trying to use. If I try to build a project using the above gradle file I get the following output:
C:\ws\PLAYGROUND\test123>gradle wrapper --stacktrace
Changed dependencies of configuration ':providedCompile' after it has been included in dependency resolution. This behaviour has been deprecated and is cheduled to be removed in Gradle 3.0.
Changed dependencies of parent of configuration ':compile' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0
Changed strategy of configuration ':compile' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0
Changed dependencies of configuration ':grettyProvidedCompile' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0.
⋮
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'test123'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
⋮
Caused by: org.gradle.api.InvalidUserDataException: Cannot change dependencies of configuration ':compile' after it has been resolved.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:578)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$2.run(DefaultConfiguration.java:137)
⋮
at org.akhikhl.gretty.GrettyPlugin$_addDependencies_closure11.doCall(GrettyPlugin.groovy:130)
⋮
That is the gretty plugin seems to use functionality that has been removed with gradle 3.0
There is issue #306 that has been reported a short time ago which describes pretty much your problem.
Given the number of open issues for such a small project and the lack of activity on the issues, I don't think this plugin is much of a help and you will probably be better off using something different.
I got a gradle script that should run the testng xml files from command line. But whenever I try to run is with grald test I get the following output. With no test run even no browser opened
C:\Users\Steve\Documents\Projects\automation>gradle test
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
BUILD SUCCESSFUL
My gradle script is the following
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
group = 'automation'
version = '1.1-SNAPSHOT'
description = ""
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'2.52.0'
compile group: 'org.uncommons', name: 'reportng', version:'1.1.4'
compile group: 'org.apache.velocity', name: 'velocity', version:'1.7'
compile group: 'com.google.inject', name: 'guice', version:'4.0'
testCompile group: 'junit', name: 'junit', version:'3.8.1'
testCompile group: 'org.testng', name: 'testng', version:'6.9.4'
}
test{
useTestNG{
include '/src/test/resources/BasicTestXML/**'}
}
include is used to include (or not) test classes:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html
What you are looking for is
suites.
See an example from the TestNG build file.
Found the solution how to run them and choose which to run
test{
useTestNG() {
suites "src/test/resources/BasicTestXML/LoginTest.xml"
}
}
In this way you can choose which xml file it will run. If you want an extra to run just add an extra suites line.
i want to run selenium tests with gradle on jboss, and i was able to make the required configuration and i want to share it with the community.
I made a complete example here on my Github acccount.
My dependencies, using only mavenCentral repo are:
dependencies {
compile group: 'org.sikuli', name: 'sikuli-api', version: '1.0.+'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.+'
compile group: 'commons-io', name: 'commons-io', version: '1.3.+'
compile group: 'junit', name: 'junit', version: '4.+'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
compile group: 'net.sf.opencsv', name: 'opencsv', version: '2.+'
}
I would run JBoss7 as a service (on windows) instead of trying to execute it directly from Gradle. I wrote a script to register a service if you want to use it. Then, you just make a gradle task to execute the script with the "start" argument to start the service.
Solution is as follows:
gradle.build:
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'war'
apply plugin: 'findbugs'
//apply from:'http://github.com/breskeby/gradleplugins/raw/master/emmaPlugin/emma.gradle'
apply from: 'emma.gradle'
buildDir = 'build'
sourceCompatibility = 1.7
version = ''
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6'
}
}
repositories {
mavenCentral()
mavenRepo url: 'http://repository.primefaces.org'
mavenRepo url: 'http://repository.jboss.org/nexus/content/groups/public'
mavenRepo url: 'http://repository.jboss.org/maven2'
mavenRepo url: 'http://maven.springframework.org/release'
mavenRepo url: 'http://repo1.maven.org/maven2'
mavenRepo url: 'http://git.solutionstream.com/nexus/content/repositories/thirdparty'
}
configurations {
compileOnly
weldEmbeddedTestRuntime { extendsFrom testRuntime }
jbossasRemoteTestRuntime { extendsFrom testRuntime, compileOnly }
}
sourceSets {
main {
compileClasspath = configurations.compile + configurations.compileOnly
}
test {
compileClasspath = compileClasspath + configurations.compileOnly
}
selenium {
compileClasspath = compileClasspath + configurations.compileOnly
}
}
dependencies {
//JSF
compile group: 'com.sun.faces', name: 'jsf-api', version: '2.1.22'
compile group: 'com.sun.faces', name: 'jsf-impl', version: '2.1.22'
compile 'org.ocpsoft.rewrite:rewrite-servlet:2.0.3.Final'
compile 'org.ocpsoft.rewrite:rewrite-config-prettyfaces:2.0.3.Final'
//Servlet
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
providedCompile group: 'org.jboss.spec', name: 'jboss-javaee-6.0', version: '1.0.0.Final'
compile 'taglibs:standard:1.1.2'
compile group: 'org.springframework', name: 'spring-web', version: '3.2.2.RELEASE'
//Omnifaces
compile 'org.omnifaces:omnifaces:1.5'
//Prime Faces
compile group: 'org.primefaces', name: 'primefaces', version: '4.0-SNAPSHOT'
compile 'org.primefaces.themes:bootstrap:1.0.10'
// DB
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '1.3.1.RELEASE'
compile group: 'org.springframework', name: 'spring-aspects', version: '3.2.2.RELEASE'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.9'
compile group: 'javax.inject', name: 'javax.inject', version: '1'
compile group: 'javax.enterprise', name: 'cdi-api', version: '1.0-SP4'
compile 'cglib:cglib-nodep:2.2.2'
//Hibernate / JPA
compile 'org.hibernate:hibernate-core:4.1.0.Final'
compile 'org.hibernate:hibernate-entitymanager:4.1.0.Final'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final'
//JSR-303
compile 'org.hibernate:hibernate-validator:4.3.1.Final'
// Spring Security
compile 'org.springframework.security:spring-security-core:3.1.4.RELEASE'
compile 'org.springframework.security:spring-security-web:3.1.4.RELEASE'
compile 'org.springframework.security:spring-security-config:3.1.4.RELEASE'
//Utility
compile 'com.google.guava:guava:14.0.1'
compile 'commons-lang:commons-lang:2.6'
compile 'org.apache.commons:commons-email:1.3.1'
compile 'com.typesafe:config:1.0.0'
compile 'joda-time:joda-time:2.2'
compile 'org.apache.geronimo.javamail:geronimo-javamail_1.4_mail:1.8.3'
compile 'org.slf4j:slf4j-api:1.7.2'
compile 'org.slf4j:jcl-over-slf4j:1.7.2'
compile 'org.slf4j:slf4j-log4j12:1.7.2'
//Mustache Templates
compile 'com.github.jknack:handlebars:1.0.0'
//Projects
//compile project(":ExtraValidators")
////TESTING DEPENDENCIES
testCompile 'com.googlecode.jmockit:jmockit:1.2'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile 'com.h2database:h2:1.3.172'
//Spring Testing
testCompile 'org.springframework:spring-test:3.2.3.RELEASE'
/* Selenium */
seleniumCompile 'org.seleniumhq.selenium:selenium-java:2.33.0'
seleniumCompile 'junit:junit:4.11'
seleniumCompile 'org.slf4j:slf4j-api:1.7.2'
seleniumCompile 'org.slf4j:slf4j-log4j12:1.7.2'
seleniumCompile 'org.slf4j:jcl-over-slf4j:1.7.2'
/* Remote Jboss */
testCompile group: 'org.jboss.arquillian', name: 'arquillian-junit', version: '1.0.0-SNAPSHOT'
jbossasRemoteTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-jbossas-remote-6', version: '1.0.0-SNAPSHOT'
jbossasRemoteTestRuntime group: 'org.jboss.jbossas', name: 'jboss-as-server', classifier: 'client', version: '6.1.0.Final', transitive: false
jbossasRemoteTestRuntime group: 'org.jboss.jbossas', name: 'jboss-as-profileservice', classifier: 'client', version: '6.1.0.Final'
}
task wrapper(type: Wrapper){
gradleVersion = '1.6'
}
eclipse {
classpath {
downloadSources=true
plusConfigurations += configurations.seleniumCompile
}
}
task selenium(type: Test) {
testClassesDir = sourceSets.selenium.output.classesDir
classpath = sourceSets.selenium.runtimeClasspath + files('src/selenium/resources-jbossas') + configurations.jbossasRemoteTestRuntime
}
you need to start jboss server manually then use the command gradlew clean selenium
copy this list to gradle.build for Mobile testing with appium, testng and selenium
// https://mvnrepository.com/artifact/cglib/cglib-nodep
compile 'cglib:cglib-nodep:3.2.6'
// https://mvnrepository.com/artifact/commons-codec/commons-codec
compile 'commons-codec:commons-codec:1.10'
// https://mvnrepository.com/artifact/org.apache.commons/commons-exec
compile 'org.apache.commons:commons-exec:1.3'
// https://mvnrepository.com/artifact/commons-io/commons-io
compile 'commons-io:commons-io:2.6'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
compile 'org.apache.commons:commons-lang3:3.7'
// https://mvnrepository.com/artifact/commons-logging/commons-logging
compile 'commons-logging:commons-logging:1.2'
// https://mvnrepository.com/artifact/net.sourceforge.cssparser/cssparser
compile 'net.sourceforge.cssparser:cssparser:0.9.24'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile 'com.google.code.gson:gson:2.8.2'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile 'com.google.guava:guava:23.0'
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
compile 'org.hamcrest:hamcrest-all:1.3'
// https://mvnrepository.com/artifact/net.sourceforge.htmlunit/htmlunit
compile 'net.sourceforge.htmlunit:htmlunit:2.29'
// https://mvnrepository.com/artifact/net.sourceforge.htmlunit/htmlunit-core-js
compile 'net.sourceforge.htmlunit:htmlunit-core-js:2.28'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/htmlunit-driver
compile 'org.seleniumhq.selenium:htmlunit-driver:2.29.2'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
compile 'org.apache.httpcomponents:httpclient:4.5.4'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore
compile 'org.apache.httpcomponents:httpcore:4.4.7'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime
compile 'org.apache.httpcomponents:httpmime:4.5.4'
// https://mvnrepository.com/artifact/io.appium/java-client
compile 'io.appium:java-client:5.0.3'
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
compile 'javax.servlet:javax.servlet-api:3.1.0'
// https://mvnrepository.com/artifact/com.beust/jcommander
compile 'com.beust:jcommander:1.72'
// https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-client
compile 'org.eclipse.jetty:jetty-client:9.4.8.v20171121'
// https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-http
compile 'org.eclipse.jetty:jetty-http:9.4.8.v20171121'
// https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-io
compile 'org.eclipse.jetty:jetty-io:9.4.8.v20171121'
// https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util
compile 'org.eclipse.jetty:jetty-util:9.4.8.v20171121'
// https://mvnrepository.com/artifact/net.java.dev.jna/jna
compile 'net.java.dev.jna:jna:4.1.0'
// https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform
compile 'net.java.dev.jna:jna-platform:4.1.0'
// https://mvnrepository.com/artifact/junit/junit
compile 'junit:junit:4.12'
// https://mvnrepository.com/artifact/net.sourceforge.htmlunit/neko-htmlunit
compile 'net.sourceforge.htmlunit:neko-htmlunit:2.28'
// https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver
compile 'com.codeborne:phantomjsdriver:1.4.0'
// https://mvnrepository.com/artifact/org.w3c.css/sac
compile 'org.w3c.css:sac:1.3'
// https://mvnrepository.com/artifact/xalan/serializer
compile 'xalan:serializer:2.7.2'
// https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/websocket-api
compile 'org.eclipse.jetty.websocket:websocket-api:9.4.8.v20171121'
// https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/websocket-client
compile 'org.eclipse.jetty.websocket:websocket-client:9.4.8.v20171121'
// https://mvnrepository.com/artifact/org.eclipse.jetty.websocket/websocket-common
compile 'org.eclipse.jetty.websocket:websocket-common:9.4.8.v20171121'
// https://mvnrepository.com/artifact/xalan/xalan
compile 'xalan:xalan:2.7.2'
// https://mvnrepository.com/artifact/xerces/xercesImpl
compile 'xerces:xercesImpl:2.11.0'
// https://mvnrepository.com/artifact/xml-apis/xml-apis
compile 'xml-apis:xml-apis:2.0.2'
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
compile 'org.seleniumhq.selenium:selenium-java:3.10.0'
// https://mvnrepository.com/artifact/commons-validator/commons-validator
compile 'commons-validator:commons-validator:1.6'
// https://mvnrepository.com/artifact/org.testng/testng
compile 'org.testng:testng:6.11'
// https://mvnrepository.com/artifact/net.sourceforge.jexcelapi/jxl
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'