ajwah / ex_cucumber Goto Github PK
View Code? Open in Web Editor NEWElixir implementation of Cucumber to facilitate BDD using feature files.
License: Apache License 2.0
Elixir implementation of Cucumber to facilitate BDD using feature files.
License: Apache License 2.0
I tried the following:
23 @shortdoc "Run cucumber framework"
24 @impl Mix.Task
25 def run(opts) do
26 Code.compiler_options(ignore_module_conflict: true)
27 IEx.Helpers.r(ExCucumber.Config)
28 IEx.Helpers.r(ExCucumber)
29 IEx.Helpers.r(ExCucumber.Gherkin.Keywords)
30
31 Code.compiler_options(ignore_module_conflict: false)
32
33 Mix.Task.run("app.start")
34 _ = opts(opts)
35
36 report =
37 "#{ExCucumber.Config.feature_dir()}/**/*.exs" # HERE
38 |> Path.wildcard()
39 |> Enum.reduce(Report.new(), fn e, a = %Report{} ->
40 try do
41 Code.compile_file(e)
42 Report.record(a, :passed)
43 rescue
44 error in @cucumber_related_error_types -> Report.record(a, %{file: e, er
ror: error})
45 end
46 end)
47
48 report.failed
49 |> Enum.each(&(Messages.render(&1.error, false) |> IO.inspect()))
50
51 IO.puts("""
52 Total: #{report.total}
53 Passed: #{report.passed}
54 Failed: #{Enum.count(report.failed)}
55 """)
56 end
57
58 defp opts(opts) do
59 opts
60 # |> OptionParser.parse
61 end
In order to load features within feature_dir
. However, I was naive. I had to tell @feature
the relative path since
147 defmacro __after_compile__(env, _) do
148 quote do
149 custom_param_types = ExCucumber.CustomParameterType.Loader.run(@custom_param
_types)
150 @feature
151 |> ExCucumber.Config.feature_path()
152 |> ExCucumber.Gherkin.run(
153 __MODULE__,
154 unquote(Macro.escape(env)).file,
155 @cucumber_expressions_parse_tree,
156 custom_param_types
157 )
158 end
159 end
uses the feature_path()
.
So, I was wondering since I'm still new to Elixir and that piece of code looks like the inscriptions in the spaceship at Roswell, what changes will be needed to be done in order to just tell @feature
the file name and internally ex_cucumber
will know to look for the file the current dir?
Again, thanks for the great work!
Hi,
Thanks for your work on ex_cucumber
.
I'm just coming to it for the first time, and struggling to understand why I have to manually download the gherkin-languages.json
file, even though it's included in the sources of this library and of my_ex_gherkin
. Can the library not just use its built-in version by default?
Having to hunt down a json file in some external repository is quite jarring to the onboarding experience, and having that file copied into the consuming app's repository just adds clutter.
@Ajwah in the HexDocs you mentioned this
I just one to confirm something: I got the idea somehow that once you defined the Scenario Outline, all the cases defined in the data table will be tested, however, I think i got the wrong idea. Can you clarify this? ๐๐ป thanks a bunch, this is lib is effing amazing.
The @feature
attribute forces tight coupling of step definitions to a specific feature file, which is a documented Cucumber Anti-Pattern.
Is it possible to remove this limitation, so the steps can be resolved from arbitrary elixir scripts inside a designated step definitions directory?
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.