← Back to Upcase

Complex setup before feature/acceptance test


(Frank) #1

Hi All,

I am writing an app right now that involves quite a bit of setup. Essentially I would like to test users performing some actions on books. However “publishing” of a book involves quite a lot of steps. Currently I have about 3 sidekiq jobs that need to run sequentially before publish. Here are things I tried:

  1. bypassing the sidekiq (i.e. call perform directly on the workers), but the tests are still somewhat slow.
  2. put setup in before(:all) but then I need to worry about dependencies.

Are there other ways to approach to this type of integrated testing?

(BTW, this is not directly related, but recently I’ve also been writing a few things in Go on the backend. Gosh, I’ve been so spoiled by Ruby. There is really no excuse not to write tests in Ruby. But Go really is much much much faster to run. And compiled binaries are much easier to setup to run as well.)

Frank


(Ben Orenstein) #2

In scenarios like this, I think it’s okay to access the database directly to set things up for integration tests.

I try to avoid direct db access like this in integration tests, but I’ll do it when setting up dependencies like this are particularly difficult/slow through the UI.