- Just executing test-case is not worthy, It need to be verified that changes has been reflected or not in-order to make it pass or fail. E.g. If tester enters wrong password on login page it should show error message and tester has to verify that error message has been shown or not.
- If an automation script executed some test-case then there should be code/step for verification of that test-case i.e. assertion of test-case.
- selenium-cucumber provides some predefined assertion steps. Using these steps automation tester can verify/assert test-case.
- Assertion steps include:
- Steps For Asserting Element Text
- Steps For Asserting Element Attribute
- Steps For Asserting Element Accesibility
- Steps For Asserting Element Visibility
- Steps For Asserting Checkbox
- Steps For Asserting Dropdown List
- Steps For Asserting Radio Button
- Steps For Asserting Links
- Steps For Asserting Javascript Pop-Up Alert
- Steps For Asserting Difference in images
- Example
feature: Gmail Login As a user I should able to login into Gmail. scenario: I login with invalid credentials Given I open "http://www.gmail.com" And I enter username "wrong_username@gmail.com" And I enter password "wrong_password" when I click button "signIn" Then element having id "errormsg_0_Passwd" should be present Then element having id "errormsg_0_Passwd" should have text as "The email or password you entered is incorrect."
-
Join 285 other subscribers
- My Tweets
-
Our blog posts
- Windows Desktop App Automation using Selenium-Cucumber February 6, 2017
- Selenium 3.0 & Gecko Driver January 10, 2017
- Practice is key to success… June 16, 2015
- Introducing Android Web & App Automation February 2, 2015
- Locating elements of Android application February 2, 2015
Hi @Sameer, How can I run js on custom_steps.rb
Then (/^I scroll the page$/) do
js = <<JS
window.scrollTo(100,900);
JS
$driver.execute_script js
end
LikeLike
simply use step in feature file as
Then I scoll the page
LikeLike
Hi Sameer, Thanks for your reply, but I add the scripts in custom_steps.rb, It prompt
“syntax error, unexpected end-of-input, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END js = <<JS ^ (SyntaxError) “
LikeLike
Then (/^I scroll the page$/) do
$driver.execute_script(“window.scrollTo(100,900);”)
end
This will work
LikeLike
Great Sameer! Thank you very much!
LikeLike