Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Step locations #15

Open
mattwynne opened this issue Feb 19, 2015 · 3 comments
Open

Step locations #15

mattwynne opened this issue Feb 19, 2015 · 3 comments

Comments

@mattwynne
Copy link
Contributor

When Cucumber prints the scenario, it ideally needs a location for each step so it can print them to the user.

Example (imagined):

Scenario:
    Given the range is 1000m                       # features/step_definition/steps.tcl:2
    And Samantha is 1000m from Bob                 # features/step_definition/steps.tcl:5
      TODO (Tcl::Error)
      features/hear_shout.feature:8:in `And Samantha is 1000m from Bob'
    When Bob sends a message "hello"               # features/step_definition/steps.tcl:10
    Then Samantha should hear "hello"              # features/step_definition/steps.tcl:15
@d-led
Copy link

d-led commented Jan 14, 2016

see my comment in #25. In ::cucumber::_add_step:

  # an attempt at saving the source of the step definition
  # 3 in [info frame..] is a magic number that only works in this constellation of [source]s
  # haven't come up with a more robust way yet
  set location "[file tail [uplevel 3 {info script}]]:[dict get [info frame 3] line]"

  lappend STEPS [list $re $params $body $location]

@d-led
Copy link

d-led commented Mar 1, 2016

this works now in cucumber-tcl-wire and could be probably directly transfered into this repo. The magic numbers are now somewhat less magic and are robust against framelevel differences when sourcing the steps.

BTW, what is the workflow for developing this lib? rake → code → rake?

@mattwynne
Copy link
Contributor Author

Thanks @d-led! Yes, rake will run all the tests for both the Ruby and tcl parts of the codebase.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants