examples/basic/plan.rb in stella-0.7.0.003 vs examples/basic/plan.rb in stella-0.7.0.004

- old
+ new

@@ -1,10 +1,11 @@ # 4f61ac3d5607139350b50335ca59a34d04b34ec7 desc "Business Finder Testplan" usecase 65, "Simple search" do + resource :search_terms, list('search_terms.csv') get "/", "Homepage" do wait 1..5 response 200 do status # => 200 @@ -14,12 +15,12 @@ end end get "/search", "Search Results" do wait 2..5 - param :what => 'Big' - param :where => '' + param :what => random(:search_terms) + param :where => random(['Toronto', 'Montreal']) response 200 do listing = doc.css('div.listing').first set :lid, listing['id'].match(/(\d+)/)[0] end end @@ -29,43 +30,35 @@ wait 1..8 # the one stored in the previous end # request. end -usecase "YAML API" do - resource :preset_listing_ids, list('listing_ids.csv') - - get "/listing/:lid.yaml", "Select listing" do - param :lid => random(:preset_listing_ids) - response 200 do - repeat 5 +usecase 10, "Self-serve" do + post "/listing/add", "Add a listing" do + wait 1..4 + param :name => random(8) + param :city => "Vancouver" + response 302 do + repeat 3 end end +end + +usecase "Listing API" do get '/listings.yaml', "View All" do response 200 do # doc contains the parsed YAML object listings = doc.collect! { |l|; l[:id]; } set :current_listing_ids, listings end end - get "/listing/:lid.yaml", "Select listing" do + get "/listing/:lid.yaml", "Select (sequential)" do param :lid => rsequential(:current_listing_ids) response 200 do repeat 7 end end end -usecase 10, "Self-serve" do - post "/listing/add" do - desc "Add a business" - wait 1..4 - param :name => random(8) - param :city => "Vancouver" - response 302 do - repeat 3 - end - end -end