简体   繁体   中英

Cucumber Step definition for android

I am completely new to calabash or cucumber. Can Anyone help me in writing calabash cucumber Step definition for entering username and password from a table?

I need to do something like this:

Scenario Outline: check for Login

Then I enter <username> into input field number 1
Then I enter <pass> into input field number 2
Then I press "Login"
Then I should see <msg> 
Then I wait for 2 seconds 

Examples:
| username | pass| msg|
| hekidh@gmail.com | pass1212 | Incorrect Username and/or password|
| sdgh@gmail.com | first212 | Incorrect Username and/or password|
| xyx@gmail.com | second1234 | Incorrect Username and/or password|
| abc@gmail.com | qwerty | success |

For doing this I need to write step definition but I don't know how to write it and where to write it?

I saw step_defination.rb file in feature folder so do I need to write the definition in that file or need to create another file?

First, inside features folder, create new folder step_definitions then inside this folder create new file login_steps.rb and now inside login_steps.rb you can create your's step definitions. To get snippets, you can execute cucumber --dry-run and copy paste result to login_steps.rb .

cucumber --dry-run will find all steps without step definitions and will return snippets that you can use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM