jrwdunham / tegere Goto Github PK
View Code? Open in Web Editor NEWTeGere! = Behave! — a Gherkin library for Clojure
License: Eclipse Public License 2.0
TeGere! = Behave! — a Gherkin library for Clojure
License: Eclipse Public License 2.0
Imagine referencing spec-defined data structures in the Gherkin feature and describing, in human-readable language, the properties or constraints that must hold when certain user actions occur.
Within a step, you should be able to call execute-steps
and supply a string of step texts that should be executed.
It would be nice to be able to run a testing system built on TeGere from the command-line with faster feedback. Of course, in Clojure we can execute Gherkin features from the REPL. However, consider the case where you want to test that the CLI for your TeGere system works correctly because you are going to run it in a CI workflow. It's not nice to wait 5-10 seconds between running clj -m vbit.core --tags=...
and seeing output.
Options:
We want to know how long it took to run all matching features/scenarios (i.e., tests).
The grammar should be expanded to recognize these constructs. See https://cucumber.io/docs/gherkin/reference/.
You should be able to write scenarios like the following, but currently you cannot:
Given a monkey
#When I give him a banana
Then he is happy
But he doesn't eat it
And he looks at me quizzically
I'm finding your parser very useful, thank you. There is a thing I'll want to add, and that is the ability to read Background
sections. If you have advice -- I've written a modest amount of Clojure, but I've read very little -- let me know and I will try and submit code.
Potentially also allow callers to redirect stdout to a logger. (Though that responsibility might better be left to the external calling system.)
It should be possible to add tabular (or freeform string) data to arbitrary Gherkin steps. This feature reduces the probability of ad hoc hidden configuration in the Clojure step logic and/or repeated values in a Scenario Outline Examples table.
It is tedious to have to manually connect each step text/definition, e.g., "Given app has a resource with attribute value", to its execution semantics, e.g., (confirm-existence-of-or-create context resource :attribute value)
. It should be possible to devise a "step grammar" (CFG) that parses step texts (instead of using simple regular expressions) and maps them to expected function names and definitions. This could be a real "value add" to Gherkin from the Clojure/Instaparse side of things.
Imagine this step:
When the button is pressed repeatedly with a 2 second delay
and these step functions:
(When "the button is pressed {method}" (fn [ctx method] ...))
(When "the button is pressed {method} with a {delay} delay" (fn [ctx method delay] ...))
Currently, both step functions have regexes that will match the step. However, the one that is chosen is arbitrary (determined by hashmap key ordering, I believe).
Some more principled method should be implemented for determining a single match. I propose, at least for the interim, that we simply choose the step with the longest regex, i.e., the second in the above example.
There might be benefits to parsing the Gherkin DSL to an in-memory data structure that is queryable via Datalog. For example, this may make filtering scenarios based on user-supplied and/or
flags easier as well as facilitate the counting of which scenarios passed, failed, were skipped, etc. See https://github.com/jpmonettas/clindex for ideas.
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.