I am building a set of automated regression tests in ruby using rspec and capybara. To give you an idea of a test, imagine logging in to a website, adding a new data item with all of its fields, saving it, validating the new row, updating the row, changing fields, and updating/validating that.
For example:
describe "auto regression test #1", :type => :feature, js: true do
it "should add and update my data" do
# login
# go to page
# press new button
# fill in fields
# etc.
end
end
This is a simplified version and there may be many things going on within the "it". At first I was thinking that I should just separate out the single test into multiple cases but then I would have to login and get back to the page (which I assume is extra time I don't need to waste in my automated tests - agree?).
Nonetheless, I'd like to log what I am doing such that it shows up in Browserstack Automate logging tab. Currently what's in there is related to selenium operations or screenshots. I would like to have some custom logging. The reason being is that when my test fails I currently get a stack trace - line number (which is great) along with the test that fails. Since my test includes lots of functionality (since I don't want rspec to log in over and over again) if the tests fails and someone is looking at Browserstack to see where it failed it is difficult to know where the logic failed without some additional custom logging. How can I put in custom logging so I can see the text in browserstack? (or do I have this all wrong and I should really separate out my tests into small pieces even with the re-logging in issue)?