ArtOfCode- / SCOT

Disaster response and relief management for volunteer teams.
GNU Affero General Public License v3.0
5 stars 4 forks source link

Behavioral tests with Cucumber -- what needs testing? #105

Open EMCain opened 6 years ago

EMCain commented 6 years ago

I'm planning to add some behavioral tests in the coming week.

Is there any functionality that's been having issues lately, or that is especially critical to avoid regressions in? Please leave a comment here describing it (or point me to a recent issue or PR related to that issue). I will reach out with questions if I need clarification.

ArtOfCode- commented 6 years ago

Everything, ideally :)

Most important at the moment is anything relating to broadcasts and translations requests, particularly broadcast script generation.

EMCain commented 6 years ago

I finally got the first behavioral test to run and pass! Yay!

I was having trouble for a long time because I didn't realize you need to do rails generate cucumber:install

see https://cucumber.io/docs/reference/rails

You can try running the tests on my branch if you want:

https://github.com/EMCain/SCOT/tree/add_cucumber_tests

do

$ bundle install
$ bundle exec cucumber

right now one test is passing and one is failing, and both have a bunch of undefined sections. I need to figure out how to mock a logged-in user next.

EMCain commented 6 years ago

Last time I was having trouble with getting login sessions to persist in the tests. This time I am going to try using Warden

https://github.com/hassox/warden/wiki/

https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara

ArtOfCode- commented 6 years ago

Devise is the gem that manages user authentication; it's based on Warden, so you may have hit a good solution there :)

EMCain commented 6 years ago

oh, thanks! I'll look into it.