cucumber / cucumber-java-skeleton Goto Github PK
View Code? Open in Web Editor NEWThis is the simplest possible setup for Cucumber-JVM using Java.
License: MIT License
This is the simplest possible setup for Cucumber-JVM using Java.
License: MIT License
Hello, can you please help ?
I get funny characters when I run through eclipse :
Scenario: Admin user creates Event and Selections �[90m# skeleton/admin.feature:3�[0m
�[32mGiven �[0m�[32mmy browser is "�[0m�[32m�[1mfirefox�[0m�[32m"�[0m �[90m# Stepdefs.my_browser_is(String)�[0m
�[32mWhen �[0m�[32mI log to "�[0m�[32m�[1mAdmin�[0m�[32m" app with username "�[0m�[32m�[1mAdministrator�[0m�[32m" and password "�[0m�[32m�[1m1ncharge�[0m�[32m"�[0m �[90m# Stepdefs.i_log_to_app_with_username_and_password(String,String,String)�[0m
�[32mThen �[0m�[32mI should be able to create a "�[0m�[32m�[1mPre-Play�[0m�[32m" Event with its selections�[0m �[90m# Stepdefs.i_should_be_able_to_create_a_Event_with_its_selections(String)�[0m
1 Scenarios (�[32m1 passed�[0m)
3 Steps (�[32m3 passed�[0m)
0m23.421s
But when I run through console : mvn test its all fine.
I didn't changed anything but for some reason whenever try to run this I get the stacktrace below
`
java.lang.NullPointerException: No format for key undefıned
at cucumber.runtime.formatter.AnsiFormats.get(AnsiFormats.java:51)
at cucumber.runtime.formatter.PrettyFormatter.printStep(PrettyFormatter.java:207)
at cucumber.runtime.formatter.PrettyFormatter.handleTestStepFinished(PrettyFormatter.java:145)
at cucumber.runtime.formatter.PrettyFormatter.access$300(PrettyFormatter.java:32)
at cucumber.runtime.formatter.PrettyFormatter$6.receive(PrettyFormatter.java:78)
at cucumber.runtime.formatter.PrettyFormatter$6.receive(PrettyFormatter.java:75)
at cucumber.runner.AbstractEventPublisher.send(AbstractEventPublisher.java:45)
at cucumber.runner.AbstractEventBus.send(AbstractEventBus.java:9)
at cucumber.runner.TimeServiceEventBus.send(TimeServiceEventBus.java:3)
at cucumber.runner.ThreadLocalRunnerSupplier$SynchronizedEventBus.send(ThreadLocalRunnerSupplier.java:90)
at cucumber.runner.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:63)
at cucumber.runner.TestStep.run(TestStep.java:57)
at cucumber.runner.PickleStepTestStep.run(PickleStepTestStep.java:43)
at cucumber.runner.TestCase.run(TestCase.java:44)
at cucumber.runner.Runner.runPickle(Runner.java:40)
at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:146)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:124)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:65)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:133)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
`
Since I installed JDK 1.8 on osx, none of my tests are found - they are all ignored !
Is it a directory issue ? Could someone test mvn -X test & check if something missing ?
Any clue ? Thks !
mvn -X test
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: /usr/local/Cellar/maven/3.1.1/libexec
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.1.1/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/pvdyck/.m2/settings.xml
[DEBUG] Using local repository at /Users/pvdyck/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/pvdyck/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project cucumber:cucumber-java-skeleton:jar:0.0.1: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: cucumber:cucumber-java-skeleton:jar:0.0.1
[DEBUG] Tasks: [test]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Cucumber-Java Skeleton 0.0.1
[INFO] ------------------------------------------------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: cucumber:cucumber-java-skeleton:0.0.1
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [compile, test]
[DEBUG] Repositories (dependencies): [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] Repositories (plugins) : [central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources)
[DEBUG] Style: Regular
[DEBUG] Configuration:
${encoding}
${maven.resources.escapeString}
${maven.resources.escapeWindowsPaths}
${maven.resources.includeEmptyDirs}
${maven.resources.overwrite}
${maven.resources.supportMultiLineFiltering}
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile)
[DEBUG] Style: Regular
[DEBUG] Configuration:
${maven.compiler.compilerId}
${maven.compiler.compilerReuseStrategy}
${maven.compiler.compilerVersion}
${maven.compiler.debug}
${maven.compiler.debuglevel}
${encoding}
${maven.compiler.executable}
${maven.compiler.failOnError}
${maven.compiler.fork}
${maven.compiler.maxmem}
${maven.compiler.meminitial}
${maven.compiler.optimize}
${project.build.finalName}
${maven.compiler.showDeprecation}
${maven.compiler.showWarnings}
${maven.compiler.skipMultiThreadWarning}
I have maven project with Spring Boot and Cucumber with JUnit5. Test works fine with maven and from intellij.
But when I create executable test jar it fails to find the context configuration.
Error Message:
Exception in thread "main" io.cucumber.core.exception.CucumberException: io.cucumber.core.backend.CucumberBackendException: Please annotate a glue class with some context configuration.
For example:
@CucumberContextConfiguration
@SpringBootTest(classes = TestConfig.class)
public class CucumberSpringConfiguration { }
Or:
@CucumberContextConfiguration
@ContextConfiguration( ... )
public class CucumberSpringConfiguration { }
at io.cucumber.core.runtime.CucumberExecutionContext.getException(CucumberExecutionContext.java:82)
at io.cucumber.core.runtime.Runtime.run(Runtime.java:103)
at io.cucumber.core.cli.Main.run(Main.java:92)
at com.test.cucumber.runner.CucumberTestRunner.main(CucumberTestRunner.java:25)
Caused by: io.cucumber.core.backend.CucumberBackendException: Please annotate a glue class with some context configuration.
For example:
@CucumberContextConfiguration
@SpringBootTest(classes = TestConfig.class)
public class CucumberSpringConfiguration { }
Or:
@CucumberContextConfiguration
@ContextConfiguration( ... )
public class CucumberSpringConfiguration { }
at io.cucumber.spring.SpringFactory.start(SpringFactory.java:129)
at io.cucumber.core.runner.Runner.buildBackendWorlds(Runner.java:99)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:67)
at io.cucumber.core.runtime.Runtime.lambda$execute$5(Runtime.java:110)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
at io.cucumber.core.runtime.Runtime.lambda$execute$6(Runtime.java:110)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.cucumber.core.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:233)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
at io.cucumber.core.runtime.Runtime.lambda$run$2(Runtime.java:86)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.SliceOps$1$1.accept(SliceOps.java:199)
at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.cucumber.core.runtime.Runtime.run(Runtime.java:87)
Code Sample: https://github.com/cgohil/spring-cucumber-test-executable
To create executable jar:
mvn clean install
To run test cases from test-jar:
java -jar target/spring-cucumber-test-executable-1.0.0-SNAPSHOT-test-jar-with-dependencies.jar classpath:com/test/cucumber/FunctionalTest.feature
Download
Import into eclipse
Run feature as cucumber
fails with exception: Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/formatter/Formatter
I didn't touch the pom or anything else after importing.
"mvn test" from the command line also fails with the same error
If I add TestNG to the skeleton example like so (since I have a project that has both JUnit and TestNG dependencies along with a Cucumber JUnit runner),
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
mvn test
passes instead of failing, although it seems to have detected the Cucumber test:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.cucumber.skeleton.RunCucumberTest
Scenario: a few cukes # io/cucumber/skeleton/belly.feature:3
Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
When I wait 1 hour # null
Then my belly should growl # null
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.658 s - in io.cucumber.skeleton.RunCucumberTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.794 s
[INFO] Finished at: 2021-01-07T01:38:05-05:00
[INFO] ------------------------------------------------------------------------
io.cucumber.junit.platform.engine.UndefinedStepException: The step 'I wait 1 hour' and 1 other step(s) are undefined.
All steps to be defined
commit d262b8d refs/heads/main (HEAD -> main, origin/main, origin/HEAD)
./gradlew test --rerun-tasks --info
dewi@dewiserver:~/code/cucumber-java-skeleton/gradle$ ./gradlew test --rerun-tasks --info
Initialized native services in: /home/dewi/.gradle/native
Initialized jansi services in: /home/dewi/.gradle/native
Received JVM installation metadata from '/home/dewi/.sdkman/candidates/java/19.0.2-open': {JAVA_HOME=/home/dewi/.sdkman/candidates/java/19.0.2-open, JAVA_VERSION=19.0.2, JAVA_VENDOR=Oracle Corporation, RUNTIME_NAME=OpenJDK Runtime Environment, RUNTIME_VERSION=19.0.2+7-44, VM_NAME=OpenJDK 64-Bit Server VM, VM_VERSION=19.0.2+7-44, VM_VENDOR=Oracle Corporation, OS_ARCH=amd64}
Found daemon DaemonInfo{pid=3911126, address=[612c5627-df8a-4b9d-8062-b56aac889544 port:43275, addresses:[/127.0.0.1]], state=Idle, lastBusy=1681388481979, context=DefaultDaemonContext[uid=fc814eab-4d65-4233-b3e6-24365107f7a9,javaHome=/home/dewi/.sdkman/candidates/java/17.0.6-tem,daemonRegistryDir=/home/dewi/.gradle/daemon,pid=3911126,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=GB,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/home/dewi/.sdkman/candidates/java/19.0.2-open,daemonRegistryDir=/home/dewi/.gradle/daemon,pid=3924974,idleTimeout=null,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=GB,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=fc814eab-4d65-4233-b3e6-24365107f7a9,javaHome=/home/dewi/.sdkman/candidates/java/17.0.6-tem,daemonRegistryDir=/home/dewi/.gradle/daemon,pid=3911126,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=GB,-Duser.language=en,-Duser.variant]
Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 3914818). The daemon log file: /home/dewi/.gradle/daemon/8.1/daemon-3914818.out.log
Starting 3rd build in daemon [uptime: 5 mins 31.974 secs, performance: 99%, GC rate: 0.00/s, heap usage: 0% of 512 MiB, non-heap usage: 31% of 384 MiB]
Using 16 worker leases.
Now considering [/home/dewi/code/cucumber-java-skeleton/gradle] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Starting Build
Settings evaluated using settings file '/home/dewi/code/cucumber-java-skeleton/gradle/settings.gradle'.
Projects loaded. Root project using build file '/home/dewi/code/cucumber-java-skeleton/gradle/build.gradle.kts'.
Included projects: [root project 'gradle']
> Configure project :
Evaluating root project 'gradle' using build file '/home/dewi/code/cucumber-java-skeleton/gradle/build.gradle.kts'.
The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these.
The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set.
The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these.
The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set.
Caching disabled for Kotlin DSL accessors for root project 'gradle' because:
Build cache is disabled
Skipping Kotlin DSL accessors for root project 'gradle' as it is up-to-date.
All projects evaluated.
Task name matched 'test'
Selected primary task 'test' from project :
The configuration :mainSourceElements is both consumable and declarable. This combination is incorrect, only one of these flags should be set.
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test']
Tasks that were excluded: []
Resolve mutations for :compileJava (Thread[#244,Execution worker,5,main]) started.
:compileJava (Thread[#244,Execution worker,5,main]) started.
> Task :compileJava
Caching disabled for task ':compileJava' because:
Build cache is disabled
Task ':compileJava' is not up-to-date because:
Executed with '--rerun-tasks'.
The input changes require a full rebuild for incremental task ':compileJava'.
Watching 30 directories to track changes
Watching 29 directories to track changes
Watching 28 directories to track changes
Watching 27 directories to track changes
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/home/dewi/.sdkman/candidates/java/19.0.2-open'.
Compiling with JDK Java compiler API.
Class dependency analysis for incremental compilation took 0.0 secs.
Created classpath snapshot for incremental compilation in 0.0 secs.
Watching 31 directories to track changes
Watching 32 directories to track changes
Watching 33 directories to track changes
Watching 34 directories to track changes
Resolve mutations for :processResources (Thread[#244,Execution worker,5,main]) started.
:processResources (Thread[#243,included builds,5,main]) started.
> Task :processResources NO-SOURCE
Skipping task ':processResources' as it has no source files and no previous output files.
Resolve mutations for :classes (Thread[#243,included builds,5,main]) started.
:classes (Thread[#248,Execution worker Thread 5,5,main]) started.
> Task :classes
Skipping task ':classes' as it has no actions.
Resolve mutations for :compileTestJava (Thread[#243,included builds,5,main]) started.
:compileTestJava (Thread[#243,included builds,5,main]) started.
> Task :compileTestJava
Caching disabled for task ':compileTestJava' because:
Build cache is disabled
Task ':compileTestJava' is not up-to-date because:
Executed with '--rerun-tasks'.
The input changes require a full rebuild for incremental task ':compileTestJava'.
Watching 30 directories to track changes
Watching 29 directories to track changes
Watching 28 directories to track changes
Watching 27 directories to track changes
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/home/dewi/.sdkman/candidates/java/19.0.2-open'.
Compiling with JDK Java compiler API.
Class dependency analysis for incremental compilation took 0.0 secs.
Created classpath snapshot for incremental compilation in 0.004 secs.
Watching 31 directories to track changes
Watching 32 directories to track changes
Watching 33 directories to track changes
Watching 34 directories to track changes
Resolve mutations for :processTestResources (Thread[#243,included builds,5,main]) started.
:processTestResources (Thread[#243,included builds,5,main]) started.
> Task :processTestResources
Caching disabled for task ':processTestResources' because:
Build cache is disabled
Task ':processTestResources' is not up-to-date because:
Executed with '--rerun-tasks'.
Watching 30 directories to track changes
Watching 34 directories to track changes
Resolve mutations for :testClasses (Thread[#243,included builds,5,main]) started.
:testClasses (Thread[#248,Execution worker Thread 5,5,main]) started.
> Task :testClasses
Skipping task ':testClasses' as it has no actions.
Resolve mutations for :test (Thread[#243,included builds,5,main]) started.
:test (Thread[#243,included builds,5,main]) started.
Gradle Test Executor 3 started executing tests.
Gradle Test Executor 3 finished executing tests.
> Task :test FAILED
Watching 35 directories to track changes
Watching 40 directories to track changes
Watching 41 directories to track changes
Caching disabled for task ':test' because:
Build cache is disabled
Task ':test' is not up-to-date because:
Executed with '--rerun-tasks'.
Watching 40 directories to track changes
Watching 35 directories to track changes
Watching 34 directories to track changes
Starting process 'Gradle Test Executor 3'. Working directory: /home/dewi/code/cucumber-java-skeleton/gradle Command: /home/dewi/.sdkman/candidates/java/19.0.2-open/bin/java -Dcucumber.junit-platform.naming-strategy=long -Dorg.gradle.internal.worker.tmpdir=/home/dewi/code/cucumber-java-skeleton/gradle/build/tmp/test/work -Dorg.gradle.native=false @/home/dewi/.gradle/.tmp/gradle-worker-classpath10480301566310671512txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=GB -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 3'
Successfully started process 'Gradle Test Executor 3'
RunCucumberTest > Cucumber > Belly > io.cucumber.skeleton.RunCucumberTest.Belly - a few cukes STANDARD_OUT
Scenario: a few cukes # io/cucumber/skeleton/belly.feature:3
Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
When I wait 1 hour
Then my belly should growl
RunCucumberTest > Cucumber > Belly > io.cucumber.skeleton.RunCucumberTest.Belly - a few cukes FAILED
io.cucumber.junit.platform.engine.UndefinedStepException: The step 'I wait 1 hour' and 1 other step(s) are undefined.
You can implement these steps using the snippet(s) below:
@When("I wait {int} hour")
public void i_wait_hour(Integer int1) {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
@Then("my belly should growl")
public void my_belly_should_growl() {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
at app//io.cucumber.core.runtime.TestCaseResultObserver.assertTestCasePassed(TestCaseResultObserver.java:69)
at app//io.cucumber.junit.platform.engine.TestCaseResultObserver.assertTestCasePassed(TestCaseResultObserver.java:22)
at app//io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:114)
at app//io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:130)
at app//io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
at app//io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:130)
at app//io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109)
at app//io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168)
at app//io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:73)
at app//org.junit.platform.suite.engine.SuiteLauncher.execute(SuiteLauncher.java:63)
at app//org.junit.platform.suite.engine.SuiteTestDescriptor.execute(SuiteTestDescriptor.java:128)
at app//org.junit.platform.suite.engine.SuiteTestEngine.lambda$execute$0(SuiteTestEngine.java:73)
at [email protected]/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at [email protected]/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at [email protected]/java.util.Iterator.forEachRemaining(Iterator.java:133)
at [email protected]/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921)
at [email protected]/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at [email protected]/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at [email protected]/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at [email protected]/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at [email protected]/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at [email protected]/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at app//org.junit.platform.suite.engine.SuiteTestEngine.execute(SuiteTestEngine.java:73)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
at [email protected]/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:578)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
1 test completed, 1 failed
Finished generating test XML results (0.0 secs) into: /home/dewi/code/cucumber-java-skeleton/gradle/build/test-results/test
Generating HTML test report...
Finished generating test html results (0.001 secs) into: /home/dewi/code/cucumber-java-skeleton/gradle/build/reports/tests/test
Watching 35 directories to track changes
Watching 40 directories to track changes
Watching 41 directories to track changes
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///home/dewi/code/cucumber-java-skeleton/gradle/build/reports/tests/test/index.html
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
4 actionable tasks: 4 executed
dewi@dewiserver:~/code/cucumber-java-skeleton/gradle$
any test should have assert to make it clear what it is testing
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: ^*.gemspec
Error type: Invalid regular expression: ^*.gemspec
Hi, I'm a newbie who's been trying for hours to get cucumber scenario but I keep getting an error is my Scenario?
Step 1
Feature: Final Bill Calculation
@ScenarioOutlineExample
Scenario Outline: Customer Bill Amount Calculation
Given I have a Customer
And user enters intial bill amount as
And Sales Tax Rate is Percent
Then final bill amount calculated is
Examples:
| IntitialBillAmount | TaxRate | CalculatedBillAmount |
| 100 | 10 | 110 |
| 200 | 8 | 216 |
| 100 | 1.55 | 101.55 |
Step 2
package stepdefinitions;
import static org.junit.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import linkedinlearning.cucumbercourse.BillCalculationHelper;
public class ScenarioOutlineSteps {
int InitalBillAmount;
double TaxRate;
@Given("I have a Customer")
public void i_have_a_Customer() {
}
@Given("user enters intial bill amount as {int}")
public void user_enters_intial_bill_amount_as(Integer initialBillAmount) {
this.InitalBillAmount = initialBillAmount;
System.out.println("InitialBillAmount: " + initialBillAmount);
}
@Given("Sales Tax Rate is {int} Percent")
public void sales_Tax_Rate_is_Percent(Integer taxRate) {
// Write code here that turns the phrase above into concrete actions
this.TaxRate = taxRate;
System.out.println("Tax Rate: " + taxRate);
}
@Then("final bill amount calculated is {int}")
public void final_bill_amount_calculate_is(Integer expectedValue) {
double SystemCalcValue =
BillCalculationHelper.CalculateBillForCustomer(this.InitalBillAmount, this.TaxRate);
System.out.println("Expected Value: " + expectedValue);
System.out.println("Calculated Value: " + SystemCalcValue);
assertTrue(expectedValue == SystemCalcValue);
}
@Given("Sales Tax Rate is {double} Percent")
public void sales_Tax_Rate_is_Percent(Double taxRate) {
this.TaxRate = taxRate;
System.out.println("Tax Rate: " + taxRate);
}
private void invokeWebPage(Double expectedValue) {
System.setProperty("webdriver.chrome.driver", "C:\\ChromeDriver\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("http://localhost:8080/BasicWebsite/Index.jsp");
WebElement BillAmountTextBox = driver.findElement(By.id("billamount"));
WebElement TaxRateTextBox = driver.findElement(By.id("taxrate"));
WebElement Button = driver.findElement(By.id("mybutton"));
BillAmountTextBox.sendKeys(Integer.toString(InitalBillAmount));
TaxRateTextBox.sendKeys(Double.toString(TaxRate));
Button.click();
WebElement Header1Element = driver.findElementByXPath("//h1");
System.out.println(Header1Element.getText());
boolean Matched = Header1Element.getText().contains("Final Bill Amount is: $" + expectedValue.toString());
System.out.println(Matched);
}
@Then("final bill amount calculated is {double}")
public void final_bill_amount_calculate_is(Double expectedValue) {
double SystemCalcValue =
BillCalculationHelper.CalculateBillForCustomer(this.InitalBillAmount, this.TaxRate);
System.out.println("Expected Value: " + expectedValue);
System.out.println("Calculated Value: " + SystemCalcValue);
assertTrue(expectedValue == SystemCalcValue);
invokeWebPage(expectedValue);
}
}
Step 3
package testrunners;
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(
features= {"src/test/java/linkedinlearning/cucumbercourse/features"},
glue = {"stepdefinitions"},
plugin= {"pretty",
"html:target/SystemTestReports/html",
"json:target/SystemTestReports/json/report.json",
"junit:target/SystemTestReports/junit/report.xml"},
tags = "@ScenarioOutlineExample",
dryRun = false,
monochrome = true
)
public class MenuManagementTest {
}
And I keep getting this answer:
@ScenarioOutlineExample
Scenario Outline: Customer Bill Amount Calculation # src/test/java/linkedinlearning/cucumbercourse/features/ScenarioOutlineExample.feature:12
Given I have a Customer # stepdefinitions.ScenarioOutlineSteps.i_have_a_Customer()
InitialBillAmount: 100
And user enters intial bill amount as 100 # stepdefinitions.ScenarioOutlineSteps.user_enters_intial_bill_amount_as(java.lang.Integer)
And Sales Tax Rate is 10 Percent # null
io.cucumber.core.runner.AmbiguousStepDefinitionsException: "Sales Tax Rate is 10 Percent" matches more than one step definition:
"Sales Tax Rate is {double} Percent" in stepdefinitions.ScenarioOutlineSteps.sales_Tax_Rate_is_Percent(java.lang.Double)
"Sales Tax Rate is {int} Percent" in stepdefinitions.ScenarioOutlineSteps.sales_Tax_Rate_is_Percent(java.lang.Integer)
at io.cucumber.core.runner.CachingGlue.findStepDefinitionMatch(CachingGlue.java:373)
at io.cucumber.core.runner.CachingGlue.stepDefinitionMatch(CachingGlue.java:341)
at io.cucumber.core.runner.Runner.matchStepToStepDefinition(Runner.java:146)
at io.cucumber.core.runner.Runner.createTestStepsForPickleSteps(Runner.java:126)
at io.cucumber.core.runner.Runner.createTestCaseForPickle(Runner.java:109)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:70)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:199)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:90)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:234)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Then final bill amount calculate is 110 # null
@ScenarioOutlineExample
Scenario Outline: Customer Bill Amount Calculation # src/test/java/linkedinlearning/cucumbercourse/features/ScenarioOutlineExample.feature:13
Given I have a Customer # stepdefinitions.ScenarioOutlineSteps.i_have_a_Customer()
InitialBillAmount: 200
And user enters intial bill amount as 200 # stepdefinitions.ScenarioOutlineSteps.user_enters_intial_bill_amount_as(java.lang.Integer)
And Sales Tax Rate is 8 Percent # null
io.cucumber.core.runner.AmbiguousStepDefinitionsException: "Sales Tax Rate is 8 Percent" matches more than one step definition:
"Sales Tax Rate is {double} Percent" in stepdefinitions.ScenarioOutlineSteps.sales_Tax_Rate_is_Percent(java.lang.Double)
"Sales Tax Rate is {int} Percent" in stepdefinitions.ScenarioOutlineSteps.sales_Tax_Rate_is_Percent(java.lang.Integer)
at io.cucumber.core.runner.CachingGlue.findStepDefinitionMatch(CachingGlue.java:373)
at io.cucumber.core.runner.CachingGlue.stepDefinitionMatch(CachingGlue.java:341)
at io.cucumber.core.runner.Runner.matchStepToStepDefinition(Runner.java:146)
at io.cucumber.core.runner.Runner.createTestStepsForPickleSteps(Runner.java:126)
at io.cucumber.core.runner.Runner.createTestCaseForPickle(Runner.java:109)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:70)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:151)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:135)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:199)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:90)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:234)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Then final bill amount calculate is 216 # null
@ScenarioOutlineExample
Scenario Outline: Customer Bill Amount Calculation # src/test/java/linkedinlearning/cucumbercourse/features/ScenarioOutlineExample.feature:14
Given I have a Customer # stepdefinitions.ScenarioOutlineSteps.i_have_a_Customer()
InitialBillAmount: 100
And user enters intial bill amount as 100 # stepdefinitions.ScenarioOutlineSteps.user_enters_intial_bill_amount_as(java.lang.Integer)
Tax Rate: 1.55
And Sales Tax Rate is 1.55 Percent # stepdefinitions.ScenarioOutlineSteps.sales_Tax_Rate_is_Percent(java.lang.Double)
Then final bill amount calculate is 101.55 # null
Also
Please help me tell me what I did wrong??
While i was adding features and gave compile facing this issue . Please help me on this
Feb 17, 2021 8:45:47 AM cucumber.api.cli.Main run
WARNING: You are using deprecated Main class. Please use io.cucumber.core.cli.Main
Feb 17, 2021 8:45:48 AM io.cucumber.core.runtime.FeaturePathFeatureSupplier get
WARNING: No features found at file:/C:/Users/hp%208.1/Music/cucmberjava/Features/login.Feature
0 Scenarios
0 Steps
0m0.089s
?????????????????????????????????????????????????????????????????????????????????????
? Share your Cucumber Report with your team at https://reports.cucumber.io ?
? Activate publishing with one of the following: ?
? ?
? src/test/resources/cucumber.properties: cucumber.publish.enabled=true ?
? src/test/resources/junit-platform.properties: cucumber.publish.enabled=true ?
? Environment variable: CUCUMBER_PUBLISH_ENABLED=true ?
? JUnit: @CucumberOptions(publish = true) ?
? ?
? More information at https://reports.cucumber.io/docs/cucumber-jvm ?
? ?
? Disable this message with one of the following: ?
? ?
? src/test/resources/cucumber.properties: cucumber.publish.quiet=true ?
? src/test/resources/junit-platform.properties: cucumber.publish.quiet=true ?
?????????????????????????????????????????????????????????????????????????????????????
Failed Gradle test task for the skeleton project.
The test task fails every time on a fresh cloned project.
Successful execution of the test task.
The Gradle wrapper from the skeleton project.
Run on Ubuntu 20.04.5 LTS
./gradlew test --rerun-tasks --info
This text was originally generated from a template, then edited by hand. You can modify the template here.
I think it is worth mentioning in the docs, that the step definitions package should not be called cucumber, as this gives failed tests.
Tests not working... I get message Step undifined
Step undefined
You can implement this step and 1 other step(s) using the snippet(s) below:
@When("I wait {int} hour")
public void i_wait_hour(Integer int1) {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
@Then("my belly should growl")
public void my_belly_should_growl() {
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.java.PendingException();
}
Step skipped
maven and InteliJ
Just following starting guide
git clone https://github.com/cucumber/cucumber-java-skeleton.git
cd cucumber-java-skeleton
cd maven
./mvnw test
I watched some newbies use this skeleton today and it confused them. If we do want to have it, I think it's better in a branch.
For someone using maven. the gradle stuff looks like clutter. Could we keep them in separate branches? Or have sub-folders within the one repo for different typical setups? Keeping them both in one repo seems confusing.
This project runs perfectly fine when using the command line. When I import it into IntelliJ it loses the step definitions and says they are all undefined (I have added the missing steps to Stepdefs but otherwise have not touched the project).
Any reason this might be?
This issue provides visibility into Renovate updates and their statuses. Learn more
This repository currently has no open or pending branches.
By using:
@CucumberOptions(plugin = {"pretty"}) in RunCukesTest.java we are moving away from simplest.
consequence 1: (relatively innocent)
import cucumber.api.CucumberOptions; in RuncukesTest.java
consequence 2: (this is the reason for raising an issue)
pom.xml , the entire build section can be removed.
As I am new to github, I am raising an issue and not submitting a pull request. Happy to discuss here first and create the pull request later if we decide to simplify the simplest setup.
Thank you.
Hello,
I checked out the cucumber-java-skeleton looking for a working example of -Dcucumber.options=""; if I run 'mvn -Dcucumber.options="--help" test' it will not print the help message like the documentation says. It runs the tests and seems to ignore the -Dcucumber.options setting.
Is this a problem with the skeleton project? Documentation? Does there need to be further set up to get this working?
I am having lots of issues with -Dcucumber.options option; it doesn't seem to be respected. I have been finding a way to get it to work all day.
I am able to run the tests otherwise with mvn test.
Thank you,
Constantine
I am executing my cucumber feature file using cucumber.api.cli.Main , execution is happening no issues with it. However i have a small requirement. Lets say my driver initialization fails in hooks because of some reason. I want to know that error after run. how can i get that error once the execution completes. and control comes out of "int exitstatus = run(options, Thread.currentThread().getContextClassLoader());" this line
import java.io.IOException;
import cucumber.api.cli.Main;
public class Execute extends Main{
public static void runclimain() {
String[] options = {"-g", "StepDfination","--plugin","/path/to/json/report.json", "-t", "<your tag what you need to test", "/path/to/your/feature.feature"};
try {
int exitstatus = run(options, Thread.currentThread().getContextClassLoader());
System.out.println("exitstatus"+ exitstatus);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
step 1. download the package and extract
step 2. run gradle build
[...java/cucumber-java-skeleton]$ gradle build
Task :test
skeleton.RunCukesTest > initializationError FAILED
java.lang.ExceptionInInitializerError
Caused by: cucumber.runtime.CucumberException
1 test completed, 1 failed
i am new for cucumber and java, how should i make the skeleton work
With maven everything works well - show cucumber tests, suggests missed steps.
With gradle nothing happens.
What helps:
$ gradle cleanTest test --info
or
$ gradle test --rerun-tasks --info
OS: Windows 10
Java: Oracle JDK 1.8.0_221
Gradle: 5.6
Please update documentation.
While following the Cucumber School Online tutorial (https://school.cucumber.io/enrollments, "Fundamentals of BDD (Java)"), I was not able to progress past the point where the Person
class began to be used to model the domain. I searched the repo that I cloned (the latest version), and it appears that class doesn't exist.
See title.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.