How to run a single row of a Cucumber scenario outline example table in RubyMine?

六眼飞鱼酱① 提交于 2019-12-12 14:33:54

问题


I'm running tests using RubyMine (forced upon me).

I have some features that use the Scenario Outline and Example format.

Is there a way I can run only a certain row from the Example table?

Example:

 Examples:
  | user_row | row1 | row2 |
  | 1        | 2    | 4    |
  | 51       | 51   | 97   |
  | 98       | 98   | 147  |

I only want to run the test from the 2nd row (user_row 51).

I can't seem to find anything with the help in RubyMine for this.


回答1:


Cucumber itself does support running a single example. RubyMine doesn't support it in a nice way, but you can do it with a little extra effort.

To run a single Cucumber example from the command line:

cucumber -f features/your.feature:##

where ## is the line number (over the entire file, not just within the example table) of the example that you want to run.

Disappointingly, RubyMine's Cucumber runner doesn't allow you to run a single line of a Cucumber example: invoking the "Run context configuration" command (control-shift-R in the Mac keymap I'm using) on an example row runs the whole file (it doesn't even just run that scenario), and there's no way to add a line number to a Cucumber run configuration (if you add it to the end of the file name you get an error).

However, you can manually create a generic run configuration which runs a single example:

  • Run → Edit Configurations
  • Click + and choose Gem Command
  • Enter "Gem name" "cucumber", "Executable name" "cucumber", and "Arguments" "features/your.feature:##" (with the appropriate line number in place of ##).
  • Hit OK
  • To run that configuration, click the Run button or type control-R. To debug, click the Debug button or type control-D.

Someone has already filed a request for this feature to be explicitly supported with JetBrains which you can vote for.



来源:https://stackoverflow.com/questions/35651067/how-to-run-a-single-row-of-a-cucumber-scenario-outline-example-table-in-rubymine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!