Comments (5)
I have been thinking about this for some time and one of the possible solutions is to use a custom formatter, so you can get all the available steps, and where they are. Whenever I have time, I will test this idea, if you haven't found a solution already.
from behave.vim.
Very Interesting. I was thinking about something in the lines of behave --steps-catalog
or behave -d --show-source
to gather this information but I hadn't tried that yet.
Take a look at these options, they already show the steps and its locations.
from behave.vim.
This is the way I search steps
behave --steps-catalog <feature file/folder> | egrep "(Given|When|Then)" | awk '{$1=$1};1' | cut -d " " -f2- | uniq | grep fill
from behave.vim.
Hej folks,
do you think the steps.usage
formatter could be of any help? Example in the current repo:
$ behave --dry-run -f steps.usage --no-summary tests/fixtures
@given('I am using "{prg}"') # tests/fixtures/steps/steps.py:4
Given I am using "emacs" # tests/fixtures/test.feature:3
@step('I am '{perc}' '{mood}'') # tests/fixtures/steps/steps.py:9
And I am '100%' 'not happy' # tests/fixtures/test.feature:4
@when('I switch to "{prg}"') # tests/fixtures/steps/steps.py:14
When I switch to "vim" # tests/fixtures/test.feature:5
@then('I will be happy') # tests/fixtures/steps/steps.py:19
Then I will be happy # tests/fixtures/test.feature:6
which gives the following possibilites:
- Going from step to implementation
When invoked in a feature file, remember the current line, and find thepath:line
in thesteps.usage
output. Then jump to the corresponding implementation as given by the second column of the first line of the block. - Listing steps acc. to implementation
When invoked from inside a step implementation function, find the decorator line in the output ofsteps.usage
, and populate the qf list with the entries in the second column of the block.
Sooo my vimscript foo is not the best, but unless you say you'd have this implemented super-quickly, I'd attempt an implementation :)
What do you think about the approach? I use behave 1.2.6
from behave.vim.
Hi again, I have been looking for a solution. I implemented something for FZF.
@pylipp thanks to your comment I found the steps formatter.
behave features/ -d -f steps 2> /dev/null | \
awk -F " *# " '/\s*(Given|When|Then|\*)/ {print $1"\t"$2}' | \
fzf -d "\t" --with-nth=1 \
--bind 'enter:execute(echo {} | cut -f2 | pbcopy )' \
--bind 'tab:execute(echo {} | cut -f1 | awk "{\$1=\$1};1" | pbcopy )'
Tab copy the step name.
Enter copy the step location
Note: It is a bit slow... 😃
Note2: Grep could be used instead.
Note3: The output from awk could be saved to a file.
Note4: Added in fzf wiki
PD: I am working on a step formatter for Behave with the output of vim-grep, so I can remove the awk from the command.
from behave.vim.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from behave.vim.