Command Line Execution

So far we have been executing our features/scenarios using PyCharm Editor and it is definitely a great way to have everything at one place. However below are some situations where you might find command line beneficial:

1) I am a command line person and I feel more comfortable and in control with cmd/shell

2) As we continue into Advanced tutorial, one of the goals of Continuous Test Automation is to align with CI servers like Jenkins, Hudson etc. If we are able to execute via. cmd, then its a great way to be aligned and when ready, we just have to plugin to the CI job (of course with some tweaks)

3) The world of scripting opens up for us if we go the route of command line and especially in pre-prod , prod and remote environments, cmd is the way to go. Also if someone is interested only in execution (and not necessarily development of scripts for eg. product managers, business analysts), then all we have to do is to zip up the project and send it across with the script to set up environment and we can easily showcase what we do 

4) Some of us would like to develop scripts in Sublime Text Editor and execute in command line thus not needing Rubymine (I would however advise not to go this route unless you have very minimal scripts and your project is probably a quick win and not something that you have to maintain and develop continuously)

Below are some of the options where we can execute using command line:

1) Execute all features

behave features OR behave (from the project directory)

cmd_all_features

2) Execute a specific feature

behave features\switch_commands.feature

cmd_specific_feature

3) Execute a specific scenario

behave features\switch_commands.feature:9  (The ‘9’ is the line number. We can use any line # from the beginning of the scenario to the ending line # of the scenario)

 

cmd_line_number

 

cmd_line_number_scenario

 

 

4) Execute all features belonging to tag @slow and @beta3

behave features –tags @slow –tags@beta3

cmd_and_tags