GithubHelp home page GithubHelp logo

cxwudi / comp5903-easy-cucumber Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 3.25 MB

A JVM Cucumber implementation that is easy to use. It is the enhanced "Cucumberized JUnit" of the original version from Alexei https://github.com/alexeikrumshyn/cucumberized-junit

Java 100.00%

comp5903-easy-cucumber's Introduction

Hi there 👋

This is CXwudi. A Mikufan with some serious coding skills.

Projects

I maintained several personal projects:

  • VocaDB Video Downloader: A set of CLI apps for archiving Vocaloid PVs from various sources, based on VocaDB API and youtube-dl.
  • YouCal: A CLI app for exporting YouTrack issues with dates into one iCalendar file, importable by both Gmail and Outlook.
  • Song Finder VocaDB: A semi-automated GUI app for batch song searches on VocaDB. It's a toy project for experimenting Compose Multiplatform.
  • hoshizora.sql (Originating from VocaDB's archived repo): A dockerized CLI program for loading a VocaDB dump into MariaDB, ideal for frequent and large offline queries, avoiding flooding the official VocaDB API.

I've maintained several libraries, available through JitPack:

  • Kotlin/JVM Inline Logging: A custom SLF4J wrapper for Kotlin, optimized at the bytecode using Kotlin's inline class.
    • To use: implementation("com.github.CXwudi:kotlin-jvm-inline-logging:<version>")
  • Kotlin/JVM Idiomatic Exec: An idiomatic Kotlin DSL for Java's Process API.
    • To use: implementation("com.github.CXwudi:kotlin-jvm-idiomatic-exec:<version>")
  • VocaDB OpenAPI Client Java: A Java Client for the VocaDB API, automatically generated and refined.
    • To use: implementation("com.github.VocaDB:vocadb-openapi-client-java:<version>")

Also some other highlights:

comp5903-easy-cucumber's People

Contributors

cxwudi avatar

Watchers

 avatar

comp5903-easy-cucumber's Issues

Cannot resolve symbol 'executeAll()'

Describe the bug or Question
When I try to run my Cucumber tests by calling executeAll() on my JFeature instance, executeAll() is instead highlighted in red and an error message pops up stating, "Cannot resolve symbol 'executeAll()'"

(For bug report only) To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error/exception

(If applicable) Stack Trace

logs

Paste your stack trace inside this HTML segment

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
Add any other context about the problem or question here.

[Doc] need to clarify the SLF4J things in doc

Describe the feature you would like
Many students are reporting that easy-cucumber has bad reporting. Well, the logging facade library SLF4J is mainly used for debugging, not for test reporting. Need to clarify it in the README doc

Additional context
Maybe we could add some test reporting code in JFeature class

[Doc + Test imple] Clarify that our tool already supported use cases dependencies

Describe the feature you would like
Clarify, and by writing a sample cucumber test, that our tool already supported use cases dependencies just like the one described in https://www.linkedin.com/pulse/use-different-background-scenario-feature-file-vikas-jain/

Is your feature request to a problem or an existing bug? Please describe and link the bug here
https://www.linkedin.com/pulse/use-different-background-scenario-feature-file-vikas-jain/

If it is a feature from the official Cucumber, provide a link to it
N/A

Additional context
N/A

[Bug] Someone said 0.3.4 still have issue with parsing

Describe the bug or Question
One student states that #12 is not fully fixed, he provided an example as following:

Player rerolls {int} {string} and {int} {string} and gets {int} {string}
Player rerolls {int} {string} and gets {int} {string} and {int} {string}

Anything else
Would need an integration test to check if this is really happened

[Decision] Should we use existing cucumber expression parser

Describe the feature you would like
If we are deciding to use regex matching as described in #28, why don't we just use the existing expression parser from cucumber official again from https://github.com/cucumber/cucumber-expressions

and maven import is https://search.maven.org/artifact/io.cucumber/cucumber-expressions/16.0.1/jar

and the usage is pretty much described in https://github.com/cucumber/cucumber-expressions/blob/main/java/src/test/java/io/cucumber/cucumberexpressions/CucumberExpressionTest.java#L50-L51

Is your feature request to a problem or an existing bug? Please describe and link the bug here
This is further thinking of #28

Additional context
There is a Java implementation from cucumber official at https://github.com/cucumber/cucumber-expressions

[Feature Request] Completely redesign the way of step matching and parameters extraction

Describe the feature you would like
The current way of extracting parameters is to go through the characters one-by-one between a step literal, and a step definition. If a mismatch on a character, or a mismatch of the parameter type vs the parameter from the step literal happened, then the tool will think that the step is mismatched.

This way of matching is hard to implement and has many many edge cases we need to handle. In fact, bugs like #12 #25 are all edge cases that I missed.

A better way to do step matching and parameters extraction is to do regex matching on the whole sentence itself. First, transfer each parameter type like {int}, {string} into a regex expression with capture group surrounded, like (\d*), (\w*), and just match the step literal from the feature file against this transferred sentence with regex expression. If matched, uses the capture group to extract the parameter. For example:

@JGivenStep("I have {int} apples and a string {string}.")

can be transferred into regex with capturing groups like :

I have (\d+) apples and a string (\"\w*\").

Then when matching:

I have 15 apples and a string "str".

The capture group can extract 15 and "str" from the step literal.

Is your feature request to a problem or an existing bug? Please describe and link the bug here
#12 #25

If it is a feature from the official Cucumber, provide a link to it
Tbh I believed this is what official Cucumber does to match and extract parameters, by reading the documentation here

Additional context
None

"Unable to find integer parameter" Error Message

Describe the bug or Question
Below is my error message for my method which checks if player dies or not. This method for checking if a player is dead does NOT take an integer parameter at all. I previously was not getting this error when running my test suite. But all of a sudden, it's coming up for a few of my methods...

(For bug report only) To Reproduce
Steps to reproduce the behavior:

  1. Create feature file with following scenario:
    singlePlayerExpCucumber.feature

@dieWith3SkullsOnFirstRoll
Scenario Outline: Die with 3 skulls and 5 swords on first roll: player gets a score of 0
Given Player is "test"
And Roll is
And Fortune Card is "G"
Then Player dies
And Expected score is 0
Examples:
|roll |
|1 1 1 3 3 3 3 3|

  1. Create step definition

package com.a1.yahtzeeGame;

import scs.comp5903.cucumber.model.annotation.*;

import junit.framework.TestCase;

import java.util.*;

public class StepDefSinglePlayerExpCucumber extends TestCase {

String fortune_card = "";
int[] dieRoll = new int[8];

Game game = new Game();
Player p;

@JGivenStep("Player is {string}")
public void initializePlayer(String name){
p = new Player(name);
}

@jandstep("Roll is {int} {int} {int} {int} {int} {int} {int} {int}")
public void and_roll_is(Integer int1, Integer int2, Integer int3, Integer int4, Integer int5,
Integer int6, Integer int7, Integer int8) {
dieRoll[0] = int1;
dieRoll[1] = int2;
dieRoll[2] = int3;
dieRoll[3] = int4;
dieRoll[4] = int5;
dieRoll[5] = int6;
dieRoll[6] = int7;
dieRoll[7] = int8;
}

@jandstep("Fortune Card is {string}")
public void coin_fortune_card_drawn(String fc){
fortune_card = fc;
}

@JThenStep("Player dies")
public void player_dies(){
assertTrue(game.isPlayerDead(dieRoll, fortune_card));
}

@jandstep("Expected score is {int}")
public void get_expected_score(Integer expScore){
assertTrue(expScore == p.getScore());
}

}

  1. Execute using following code

Path myFeatureFile = Paths.get("src/test/java/com/a1/yahtzeeGame/singlePlayerExpCucumber.feature");
JFeature jFeature = EasyCucumber.build(myFeatureFile, StepDefSinglePlayerExpCucumber.class);
jFeature.executeAll();

(If applicable) Stack Trace

logs

Paste your stack trace inside this HTML segment

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
Add any other context about the problem or question here.

The tool doesn't recognize my step definitions

Describe the bug or Question
The tool is asking for step definition for a step even though I've implemented it.

(For bug report only) To Reproduce
One of my scenarios is:

    Given ...
    And...
    When...
    And player 1 rolls "skull skull parrot parrot parrot monkey monkey monkey"
    And player 1 ...
    And player 1 enters islandofskulls
    And player 1 rerolls sth
    And player 1 ...
    And player 1 ...
    Then player 1...
    And player 1 ...
    And player 1 ...

And I have implemented a respective step definition for "player 1 enters islandofskulls"

    @JAndStep("player {int} enters islandofskulls")
    public void playerEntersIslandofskulls(int arg0) {
       .......
    }

But the tool is complaining about

EZCU013: Step definition not found for: AndStep(stepString=player 1 enters islandofskulls). Are you sure you implemented this step definition? Or did you forget to make the method public?

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
https://github.com/bloodteller123/COMP5104A1/blob/1a3b4fede056a9788899f187308dd61eca2e9a52/src/test/resources/FortuneCardTest.feature#L162

Optional Feature for convenience: support `{}`

I finally feel like we need support of {} in step definition method, although {string} can already do the trick, but considering the following example scenario outline:

Scenario Outline: I eat fruits
  Given I have 5 apples

If the user wants to match the string "apples", then the user have to add quotes around apples like Given I have 5 "apples"

Can we simplify it by implementing the {}

Add logging

Since we have SLF4J dependency, we can write some logging statement.

If a user didn't import an SLF4J implementation, these logging simple won't do anything. So it is safe to write these logging without being too noisy to the users

"Unable to find integer parameter" Error Message

Describe the bug or Question
Error message for my method which checks if player dies or not is given below. This method does NOT take an integer parameter. I previously was not getting this error when running my test suite. But all of a sudden, it's coming up for a few of my methods...

scs.comp5903.cucumber.model.exception.EasyCucumberException: EZCU009: Unable to find integer parameter as int: Player dies

Paste your stack trace inside this HTML segment

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
Add any other context about the problem or question here.

Feature 4a: Tags support

As far as I can tell, this requires code changes in

  1. UML state machine diagram for parsing feature file (and hence the feature file parsing logic)
  2. UML class diagram to store new tags information
  3. new execute() method in JFeature to support tags to enable/disable some scenarios base on tags provided in the parameter

[Feature Request] Two small improvements

Describe the feature you would like

  1. Clarify EZCU013 error to include one more hint: are you sure you are not using the official Cucumber's annotation? Also clarify this in doc
  2. if a step definition method has two annotations (e.g. both @JGivenStep and @JWhenStep), then create two different step def method detail. This shouldn't lead to too many changes

Is your feature request to a problem or an existing bug? Please describe and link the bug here
1 is inspired from #22

If it is a feature from the official Cucumber, provide a link to it
N/A

Additional context
N/A

[Bug/Question] Regex matching fails for similar strings

Describe the bug or Question
In some cases, the regex matching seems to be incorrectly matching step def and string literal in feature file.

(For bug report only) To Reproduce
Steps to reproduce the behavior:

  1. Create feature file with following scenario:
    test.feature
Feature: Test feature

Scenario: Test scenario
  Given Test given
  When Test when
  And 'Player3' gets 'GOLD' fortune card
  And 'Player3' gets disqualified
  Then Test then
  1. Creat step def file with following definitions:
    TestDefs.java
package org.joshi.easy.cucumber;

import scs.comp5903.cucumber.model.annotation.JAndStep;
import scs.comp5903.cucumber.model.annotation.JGivenStep;
import scs.comp5903.cucumber.model.annotation.JThenStep;
import scs.comp5903.cucumber.model.annotation.JWhenStep;

public class TestDefs {

  @JGivenStep("Test given")
  public void given() {}

  @JWhenStep("Test when")
  public void when() {}

  @JThenStep("Test then")
  public void then() {}

  @JAndStep("{string} gets {string} fortune card")
  public void andTest(String player, String card) {}

  @JAndStep("{string} is disqualified")
  public void disqualified(String player) {}
}
  1. Execute using following code
EasyCucumber.build(Paths.get("src/test/resources/test.feature"), TestDefs.class).executeAll();

(If applicable) Stack Trace

logs

scs.comp5903.cucumber.model.exception.EasyCucumberException: EZCU010: Unable to find string literals: disqualified, the string literal should be in double or single quotes.

at scs.comp5903.cucumber.builder.JStepParameterExtractor.extractParameterValueAndGetNextIndex(JStepParameterExtractor.java:137)
at scs.comp5903.cucumber.builder.JStepParameterExtractor.tryExtractParameters(JStepParameterExtractor.java:69)
at scs.comp5903.cucumber.builder.JFeatureBuilder.tryMatchStep(JFeatureBuilder.java:99)
at scs.comp5903.cucumber.builder.JFeatureBuilder.mapAllStepsToStepDefMethods(JFeatureBuilder.java:88)
at scs.comp5903.cucumber.builder.JFeatureBuilder.build(JFeatureBuilder.java:46)
at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:147)
at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:68)
at org.joshi.easy.cucumber.TestRunner.sampleTest(TestRunner.java:71)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Process finished with exit code 255

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
The regex matching should work as expected and framework should not try to match And 'Player3' gets disqualified with @JAndStep("{string} gets {string} fortune card")

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Java version: Java 17
  • Maven/Gradle version: Gradle 7.4
  • IDE: IntelliJ Ultimate 2022.2.3

Anything else
N/A

Test fail error (see below for the log error message)

Describe the bug or Question
Please see below for the log message of the Test Fail error.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

scs.comp5903.cucumber.model.exception.EasyCucumberException: EZCU013: Step definition not found for: AndStep(stepString="some step"). Are you sure you implemented this step definition? Or did you forget to make the method public?

Paste your stack trace inside this HTML segment

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
Add any other context about the problem or question here.

The tool doesn't recognize my step definitions

    Oh, I see, you can not mismatch a step keyword. 

For example, if you wrote And a step in the feature file, you have to use @JAndStep or @JStep with ketword = AND, using any other annotation will be traded as step definition not implemented

Originally posted by @CXwudi in #11 (comment)

[Decision] Should we use existing Gherkin parser

Describe the feature you would like
Instead of reinventing the wheel and maintained our own JFeatureFileLineByLineParser, we could just reuse the existing Gherkin file parser written in Java from Cucumber official at https://github.com/cucumber/gherkin#library.

But then, adding the new library would break one of my initial goal where I want to limit down the dependencies as much as possible.

But then, the advantage would be huge as well. Not only does it dramatically decrease the maintenance effort, but also allow us to be on sync with official Cucumber.

Additional context
Recall our main objective: the main objective of this project is to enhance Alexei’s “Cucumberized” JUnit to a production-ready level, while maintaining the advantage of an easy setup procedure and smoother learning curve. Using the existing Gherkin parser doesn't really break this objective much. This option is worth to be discussed.

And big thanks to Joshi Saurabh for providing this enhancement

[Feature Request] Add proper test report

Describe the feature you would like
Let's really add some proper test reporting:

  1. how many scenarios
  2. how many tests

However, no handling would be made for test failure, because test failure is simply an exception from a testing framework like JUnit's AssertionError.

Is your feature request to a problem or an existing bug? Please describe and link the bug here
N/A

If it is a feature from the official Cucumber, provide a link to it
N/A

Additional context
This is related to #26

[Bug]Error message is not accurate when a step definition is missing

Describe the bug or Question
When the framework is unable to match a statement from feature file to a step definition (most likely due to missing step def), the error message is not accurate as it refers to some other line in the feature file instead of the line that cause the issue.

(For bug report only) To Reproduce
For example if I have following scenario:

Scenario: Row 89
    Given The game starts with 1 player
    And The player names are the following 'Player1'
    When 'Player1' gets 'GOLD' fortune card
    And 'Player1' rolls the following 'MONKEY,MONKEY,MONKEY,SWORD,SWORD,SWORD,DIAMOND,PARROT'
    And 'Player1' ends turn
    Then Player scores are the following 'Player1 400'

And for example, if I have not defined a step-def for the line And The player names are the following 'Player1' I see the following stack-trace:

scs.comp5903.cucumber.model.exception.EasyCucumberException: EZCU013: Step definition not found for: WhenStep(stepString='Player1' gets 'GOLD' fortune card). Are you sure you implemented this step definition? Or did you forget to make the method public?

	at scs.comp5903.cucumber.builder.JFeatureBuilder.lambda$mapAllStepsToStepDefMethods$0(JFeatureBuilder.java:89)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at scs.comp5903.cucumber.builder.JFeatureBuilder.mapAllStepsToStepDefMethods(JFeatureBuilder.java:88)
	at scs.comp5903.cucumber.builder.JFeatureBuilder.build(JFeatureBuilder.java:46)
	at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:147)
	at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:68)

(If applicable) Stack Trace

logs

Pasted above

(If applicable) Screenshots
If applicable, add screenshots to help explain your problem.

(For bug report only) Expected behavior
The error message should mention Step definition not found for And The player names are the following 'Player1' instead of the line that is below that.

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Java version: Java 17
  • Maven/Gradle version: Gradle 7.4
  • IDE: IntelliJ Ultimate 2022.2.3

Anything else
N/A

[Bug/Question]The tool doesn't seem to ignore keywords in a multi-line description under Scenario

Describe the bug or Question
Tittle

(For bug report only) To Reproduce
Given a scenario, where a long description is broken down into multi-line texts

Scenario: Row 84 roll 2 skulls, 3 parrots, 3 coins,put 3 coins in chest
    then rerolls 3 parrots and get 2 diamonds 1 coin, put coin in chest (now 4)
    then reroll 2 diamonds and get 1 skull 1 coin, score for chest only = 400 + 200 = 600 AND report death
    Given players are initialized
    And dice are initialized
    When player 1 has fortunate card "chest"

The tool then asks me to implement step definition for then in the description.

(If applicable) Stack Trace

logs

Exception in thread "main" scs.comp5903.cucumber.model.exception.EasyCucumberException: EZCU013: Step definition not found for: ThenStep(stepString=reroll 2 diamonds and get 1 skull 1 coin, score for chest only = 400 + 200 = 600 AND report death). Are you sure you implemented this step definition? Or did you forget to make the method public?
at scs.comp5903.cucumber.builder.JFeatureBuilder.lambda$mapAllStepsToStepDefMethods$0(JFeatureBuilder.java:89)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at scs.comp5903.cucumber.builder.JFeatureBuilder.mapAllStepsToStepDefMethods(JFeatureBuilder.java:88)
at scs.comp5903.cucumber.builder.JFeatureBuilder.build(JFeatureBuilder.java:46)
at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:147)
at scs.comp5903.cucumber.EasyCucumber.build(EasyCucumber.java:68)

(For bug report only) Expected behavior
The tool should ignore whatever in the description
Environment (please complete the following information):

  • OS: [e.g. macOS 13, Windows Pro 11]
  • Java version: [e.g. Java 11, Java 17]
  • Maven/Gradle version: [e.g. maven 3.8.2, gradle 7.5.1]
  • IDE: [e.g. IntelliJ Ultimate 2022.2.2, Eclipse 2022.6]

Anything else
Add any other context about the problem or question here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.