Ruby on Rails November 12, 2020

What's the hardest part of testing Rails apps?

Joe Masilotti @joemasilotti

When you are building your Rails apps what part of testing gets you hung up the most?

Feature tests? Unit tests? Getting CI working? JavaScript tests?

I'd love to hear where you struggle and help out if possible!

I've been doing Rails for ~7 years and testing for almost a decade.

  1. 1

    Not getting any customers looking at the value prop early enough because of spending too much time testing.

  2. 1

    End to end test are now feasible thank to cypress (and the excellent gem cypress-rails). I think the most difficult part is to know what to test, and how.

    1. 1

      I keep seeing this pop up - how does it compare to something like Capybara? What's the benefit over something tried and true?

      1. 1

        I tried Capybara and completely abandoned it. Capybara works pretty well for pages without JS, which means testing more HTML than functionalities. Capybara+Js is a nightmare to configure, both locally and on CI. Plus configuration could lead to brittle test. Cypress is a lot more robust, extremely easy to debug, agnostic to any JS fw used (or not).

    1. 1

      Ugh, amen! Have framework(s) are you using?

      I've had luck with headless Chrome, Capybara, and a gem that automatically keeps my binaries up to date. There's also some webmock configuration needed.

Recommended Posts