You need to sign in to do that
Don't have an account?
Rahul_sg
Automating Salesforce testing by using Ruby CUCUMBER
Hello There!
We have started automating our sfdc scripts using Ruby, Watir & Cucumber. The scripts are working fine in our dev sandbox.
Currently we are referencing the records using record name/Id but we afraid once we refresh our sandbox from the production our scripts will stop working.
Can someone please share best practices using the Ruby cucumber tool to 1) generate test records 2) Reference test records in scripts?
Thanks!
We have started automating our sfdc scripts using Ruby, Watir & Cucumber. The scripts are working fine in our dev sandbox.
Currently we are referencing the records using record name/Id but we afraid once we refresh our sandbox from the production our scripts will stop working.
Can someone please share best practices using the Ruby cucumber tool to 1) generate test records 2) Reference test records in scripts?
Thanks!
Essentially, I recommend you write a helper class for your Cucumber scripts that utilize the restforce gem (https://github.com/ejholmes/restforce) to create your own test data, before you run your tests. Essentially, i do something like this:
I'll give it a try & will update you.
Below is my code :
-------------------------------------------------------------
require 'watir'
browser = Watir::Browser.new :chrome
browser.goto 'login.salesforce.com'
browser.text_field(id: 'username').set 'Hello World!'
browser.text_field(id: 'password').set 'Hello World!'
sleep 5
--------------------------------------------------------
Feature: Testing login
Scenario: Want to login into sfdc
Given Open chrome browser
And Enter the url login.salesforce.com
When I keyin userid and pwd
Then click Submit
Execution : Cucumber sfdc_login.feature
Filename : sfdc_login.rb
Given("Open chrome browser") do
# pending # Write code here that turns the phrase above into concrete actions
end
Given("Enter the url login.salesforce.com") do
# pending # Write code here that turns the phrase above into concrete actions
@browser.goto "login.salesforce.com"
end
When("I keyin userid and pwd") do
# pending # Write code here that turns the phrase above into concrete actions
@browser.text_field(:id=>'username').set "testuser"
@browser.text_field(:id=>'password').set "pwd"
end
Then("click Submit") do
# pending # Write code here that turns the phrase above into concrete actions
sleep 5
end
Please help.
Regards,
Dhananjey.
require 'watir'
browser = Watir::Browser.new :chrome
browser.goto 'login.salesforce.com'
browser.text_field(id: 'username').set 'Hello World!'
browser.text_field(id: 'password').set 'Hello World!'
sleep 5
As soon as the chrome is launched it is asking for the verfication code even before going to "login.salesforce.com". It might be because of the "Data:" protocol. What should I do to avoid the verification code. I have followed all the standard SFDC articles with respected to avoid the acitivation code , but in vain.
Please help.