usuario3552450
Estoy tratando de ejecutar mis pruebas de pepino en paralelo.
Aquí está mi script de compilación:
import groovyx.gpars.GParsPool
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'base'
group = 'com.bj.bjetf.mobile'
sourceCompatibility = 1.5
version = '1.0'
defaultTasks 'clean','run'
ext {
projTitle="IOS Tests"
projVersion = '1.0'
}
repositories {
mavenCentral()
}
repositories {
maven {
url "http://repo.bodar.com/"
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.codehaus.gpars:gpars:1.1.0"
}
}
dependencies {
compile project(':ioscore')
compile project(':baseframework')
compile group: 'junit', name: 'junit', version: '4.11'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.38.0'
compile group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '2.38.0'
compile group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '2.38.0'
compile group: 'io.appium', name: 'java-client', version: '1.1.0'
compile group: 'info.cukes', name: 'cucumber-java', version: '1.1.8'
compile group: 'info.cukes', name: 'cucumber-junit', version: '1.1.8'
compile group: 'info.cukes', name: 'cucumber-core', version: '1.1.8'
compile group: 'info.cukes', name: 'cucumber-picocontainer', version: '1.1.8'
compile group: 'net.masterthought', name: 'cucumber-reporting', version: '0.0.21'
compile group: 'com.googlecode.totallylazy', name: 'totallylazy', version: '1049'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.+'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.0.+'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.+'
compile group: 'io.appium', name: 'java-client', version: '1.1.0'
}
configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}
def concurrentMethod(String fileName, String runner) {
def args = ['--format', 'html:target/cucumber-html-report' + runner, '--format', 'junit:target/junit-report' + runner + '.xml' , '--format', 'json:target/cucumber' + runner + '.json', '-f', 'pretty', '--tags', '@grid', '--glue', 'com.bj.bjetf.ios.tests'].join(" ")
def classpath = configurations.cucumberRuntime.getAsPath() + ":" + sourceSets.test.output.getAsPath() + ":" + sourceSets.main.output.getAsPath()
def main = "cucumber.api.cli.Main"
logger.quiet "FileName: $fileName , ThreadName: $runner"
def process = "java -cp $classpath $main $args $fileName".execute()
process.waitForOrKill(25000)
logger.quiet "Process Out: ${process.text}"
}
task cucumber() {
dependsOn assemble, compileTestJava, processTestResources
def manifestFile1 = file("environment.txt")
def capabilitylist1 = file("capability.txt")
// manifestFile.write(envType)
manifestFile1.write(envType + "&" + hubUrl)
capabilitylist1.write(device + "&" + udid + "|" + bundleid + "*" + platformVersion + "@" + platformName + "!" + deviceName + "#" + simulator)
def cucumberTags = [];
if (testTags.contains('&')) {
def tags = testTags.split("&")
tags.each { tagId ->
cucumberTags.add('--tags')
cucumberTags.add(tagId)
}
cucumberTags.add('--tags')
cucumberTags.add('~@pending')
cucumberTags.add('--tags')
cucumberTags.add('~@wip')
} else {
cucumberTags = ['--tags', testTags, '--tags', '~@pending', '--tags', '~@wip']
}
logger.quiet("Tags are" + cucumberTags)
def cucumberArgs = ['--format', 'html:target/cucumber-html-report', '--format', 'junit:target/junit-report.xml', '--format', 'json:target/cucumber.json', '-f', 'pretty', '--glue', 'com.bj.bjetf.ios.tests','src/test/resources/features'] + cucumberTags
logger.quiet("Arguments are" + cucumberArgs)
doLast {
javaexec {
jvmArgs = []
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = cucumberArgs
}
}
}
task concurrentCucumber() {
dependsOn assemble, compileTestJava, processTestResources
def cores = Runtime.runtime.availableProcessors()
def threads = 2
def runner = "0"
println " > Using $threads threads on $cores cores..."
GParsPool.withPool(threads) {
def features = fileTree(dir: 'src/test/resources/features').include '**/*.feature'
features.eachParallel { File file ->
logger.quiet "File: ${file.name}"
concurrentMethod(file.path, runner)
runner = runner + 1;
}
}
logger.quiet("Run complete!")
}
task wrapper(type: Wrapper) {
jarFile="wrapper/gradle-wrapper.jar"
gradleVersion = "1.8"
}
Cuando ejecuto concurrentCucumber , el script revisa todos los archivos de funciones y busca los escenarios que tienen la etiqueta @grid .
Como podemos ver en:
-----------------------------------
_____ _ _
/ ____| | | |
| | __ _ __ __ _ __| | | ___
| | |_ | '__/ _` |/ _` | |/ _ \
| |__| | | | (_| | (_| | | __/
\_____|_| \__,_|\__,_|_|\___|
-----------------------------------
Tags are[--tags, @grid, --tags, ~@pending, --tags, ~@wip]
Arguments are[--format, html:target/cucumber-html-report, --format, junit:target/junit-report.xml, --format, json:target/cucumber.json, -f, pretty, --glue, com.bj.bjetf.android.tests, src/test/resources, --tags, @grid, --tags, ~@pending, --tags, ~@wip]
Tags are[--tags, @grid, --tags, ~@pending, --tags, ~@wip]
Arguments are[--format, html:target/cucumber-html-report, --format, junit:target/junit-report.xml, --format, json:target/cucumber.json, -f, pretty, --glue, com.bj.bjetf.ios.tests, src/test/resources/features/AcidScenarios, --tags, @grid, --tags, ~@pending, --tags, ~@wip]
> Using 2 threads on 8 cores...
File: Audio only mode UI.feature
File: joinMeeting.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/joinMeeting.feature , ThreadName: 0
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/Audio only mode UI.feature , ThreadName: 0
Process Out:
File: Box document sharing.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/Box document sharing.feature , ThreadName: 01
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/joinMeeting.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: leaveMeeting.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/leaveMeeting.feature , ThreadName: 011
Process Out:
File: chat.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/chat.feature , ThreadName: 0111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/leaveMeeting.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: login.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/login.feature , ThreadName: 01111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/chat.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: crossPartition.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/crossPartition.feature , ThreadName: 011111
Process Out: Feature: Normal Login Scenarios
@mobile @Sanity_14 @Sanity_30 @grid
Scenario: verify login with given credentials # /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/login.feature:5
Given I login with default credentials
Then I should see schedule meeting option
@mobile @Login2 @grid
Scenario: verify login with given credentials # /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/login.feature:11
Given I login with default credentials
Then I should see schedule meeting option
2 Scenarios (2 undefined)
4 Steps (4 undefined)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^I login with default credentials$")
public void i_login_with_default_credentials() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^I should see schedule meeting option$")
public void i_should_see_schedule_meeting_option() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
File: Logout.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/Logout.feature , ThreadName: 0111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/crossPartition.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: documentsharing.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/documentsharing.feature , ThreadName: 01111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/documentsharing.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: DoubleTaptoCancel.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/DoubleTaptoCancel.feature , ThreadName: 011111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/Logout.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: MultiEndPointMeeting.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/MultiEndPointMeeting.feature , ThreadName: 0111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/DoubleTaptoCancel.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: ForceModLogin.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/ForceModLogin.feature , ThreadName: 01111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/MultiEndPointMeeting.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: muteOnEntry.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/muteOnEntry.feature , ThreadName: 011111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/muteOnEntry.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: scheduling.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/scheduling.feature , ThreadName: 0111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/ForceModLogin.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: Help button.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/Help button.feature , ThreadName: 01111111111111
Process Out:
File: inMeeting.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inMeeting.feature , ThreadName: 011111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/scheduling.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: settings.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/settings.feature , ThreadName: 0111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inMeeting.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: InMeetingAudioVideo.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/InMeetingAudioVideo.feature , ThreadName: 01111111111111111
Process Out: Feature: Settings
@mobile @Sanity_32 @sanity @grid
Scenario: I turn ON 'Start audio muted' in the App settings and start the meeting # /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/settings.feature:9
Given I login with default credentials
And I turn "ON" 'Start audio muted' in the App settings
And I start the personal meeting
Then I should join the meeting with Audio muted
1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^I login with default credentials$")
public void i_login_with_default_credentials() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Given("^I turn \"(.*?)\" 'Start audio muted' in the App settings$")
public void i_turn_Start_audio_muted_in_the_App_settings(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Given("^I start the personal meeting$")
public void i_start_the_personal_meeting() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^I should join the meeting with Audio muted$")
public void i_should_join_the_meeting_with_Audio_muted() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
File: signUp.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/signUp.feature , ThreadName: 011111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/InMeetingAudioVideo.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: inMeetingStageLeft.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inMeetingStageLeft.feature , ThreadName: 0111111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/signUp.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: ssologin.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/ssologin.feature , ThreadName: 01111111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inMeetingStageLeft.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: inviteOnFly.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inviteOnFly.feature , ThreadName: 011111111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/ssologin.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: startMeeting.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/startMeeting.feature , ThreadName: 0111111111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/inviteOnFly.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/startMeeting.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
File: testdata.feature
FileName: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/testdata.feature , ThreadName: 011111111111111111111111
Process Out: None of the features at [/Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/resources/features/testdata.feature] matched the filters: [@grid]
0 Scenarios
0 Steps
0m0.000s
Run complete!
:baseframework:compileJava UP-TO-DATE
:baseframework:processResources UP-TO-DATE
:baseframework:classes UP-TO-DATE
:baseframework:jar UP-TO-DATE
:ioscore:compileJava UP-TO-DATE
:ioscore:processResources UP-TO-DATE
:ioscore:classes UP-TO-DATE
:ioscore:jar UP-TO-DATE
:iostests:compileJava UP-TO-DATE
:iostests:processResources UP-TO-DATE
:iostests:classes UP-TO-DATE
:iostests:jar
:iostests:assemble
:iostests:compileTestJava
warning: [options] bootstrap class path not set in conjunction with -source 1.5
Note: /Users/sandeep/MobileRepoAgain/bjetfmobile/iostests/src/test/java/com/bj/bjetf/ios/tests/runners/RunCukesTests.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
:iostests:processTestResources
:iostests:concurrentCucumber
BUILD SUCCESSFUL
encuentra los escenarios con la etiqueta @grid PERO las pruebas no se ejecutan ya que no puede encontrar la definición de paso para el mismo (advertencia de escenario/pasos indefinidos) aunque –glue está configurado en el paquete adecuado que tiene la definición de paso.
Actualmente estamos atascados en este punto, agradecemos cualquier ayuda al respecto.
Gracias de antemano !
¿Ha sido útil esta solución?
Tu feedback nos ayuda a saber si la solución es correcta y está funcionando. De esta manera podemos revisar y corregir el contenido.
¿A qué se refiere la última parte de su configuración? (‘–glue’, ‘com.bj.bjetf.ios.tests’, ‘src/test/resources/features’). ¿No debería agregar ‘–features’, antes de ‘src/test/resources/features’?
– usuario745733
15 de enero de 2015 a las 7:34
@mylenereiners: ¡Gracias por la respuesta! . (‘–glue’, ‘com.bj.bjetf.ios.tests’, ‘src/test/resources/features’) está en la tarea pepino() que funciona bien. Me enfrento a un problema cuando ejecuto la tarea concurrentCucumber(). Esta tarea llama a la función concurrentMethod en la que he dado la ruta de pegamento adecuada ‘–glue’, ‘com.bj.bjetf.ios.tests’. Cuando ejecuto ‘gradle concurrentCucumber( )’, recorre todos los archivos de funciones, pero no puede encontrar la definición de paso para el mismo (como podemos ver en el fragmento de registro adjunto). No estoy seguro de qué está fallando aquí.
– usuario3552450
15 de enero de 2015 a las 9:23
Lástima, entonces, la causa más obvia es, como bien sabe, una ruta de pegamento incorrecta … pero si ese no es el caso, no lo sé 🙁
– usuario745733
15 de enero de 2015 a las 10:48