2013-06-30 11 views
6

मैं जेबॉस पर ग्रेले के साथ सेलेनियम परीक्षण चलाने के लिए चाहता हूं, और मैं आवश्यक कॉन्फ़िगरेशन करने में सक्षम था और मैं इसे समुदाय के साथ साझा करना चाहता हूं।ग्रेडन के साथ सेलेनियम परीक्षण को कैसे कॉन्फ़िगर करें?

उत्तर

2

समाधान इस प्रकार है:

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 
} 

आप मैन्युअल रूप से jboss सर्वर शुरू करने के लिए तो आदेश का उपयोग की जरूरत है gradlew स्वच्छ सेलेनियम

+0

जब जैकोको को धीरे-धीरे बनाने के लिए बनाया गया है तो एम्मा का उपयोग क्यों करें? – Gus

7

मैं a complete example here on my Github acccoun टी बनाया ।

मेरे निर्भरता, केवल mavenCentral रेपो का उपयोग कर रहे हैं:

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.+' 
} 

मैं बजाय Gradle से सीधे निष्पादित करने के लिए कोशिश कर रहा है की एक सेवा (खिड़कियों पर) के रूप में JBoss7 चलाना शामिल है। यदि आप इसका उपयोग करना चाहते हैं तो मैंने a script to register a service लिखा था। फिर, आप सेवा शुरू करने के लिए "प्रारंभ" तर्क के साथ स्क्रिप्ट को निष्पादित करने के लिए केवल एक क्रमिक कार्य करते हैं।

संबंधित मुद्दे