Note that there are some explanatory texts on larger screens.

plurals
  1. POSeed data in cucumber tests
    primarykey
    data
    text
    <p>I'm writing a web app which is used a SaS. Each customer has their own db and app directory so I have a rake task which creates all necessary minimum data (seed data) to run their website: default rights and roles, a superadmin user, a "us_states" table already populated, some local depots and terminals (it's a logistics app).</p> <p>I don't have any cucumber scenarios for it and I just started building some. I'm a beginner with cucumber.</p> <p>I first put that seed data task in a Given line, but that is pretty much is a given for all scenarios, and it doesn't make much sense to non-programmers who look at the scenarios (for humans, it is such a given that it doesn't need to be expressed consciously) so I moved it into hooks.rb.</p> <p>My first scenario looks like this: <code><pre> 1 Feature: Place an order 2 In order to keep orders in the database 3 As a admin 4 I want to place orders 5 6 Scenario: Using common legs 7 Given I have 1 customers 8 And I'm on the homepage 9 And I follow "Place an Order" 10 When I select the customer 11 And I select the SSLine 12 And I click "Use Common Legs" 13 Then I should see "PICKUP AT" 14 And I should see "DELIVER TO" or "LOAD AT" 15 And I should see EMPTY RETURN </pre></code></p> <p>My hooks.rb looks like this:</p> <pre><code>1 Before do 2 MinimumData.new('costi', '1234').populate #username and password 3 end </code></pre> <p>Questions:</p> <ol> <li>I don't want to run this MinimumData.populate task before each scenario because it takes 8 seconds. Should I make it run just once, globally? How?</li> <li>Do I have to cleanup the database with an After.do? I really don't want to do that, because I will duplicate the logic in the After.do, only with Model.delete_all statements. I noticed that after my first run, the test db has all that data still in. I can purge it with rake db:test:purge and the reinitialize it. Is that a good practice?</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload