試圖讓測試方案,其中用戶登錄(管理員),然後再創建用戶。黃瓜中的情景會話不堅持
在日誌中我可以看到,控制進到登錄頁面,然後管理員用戶登錄時,當控制重定向到另外的用戶創建頁面登錄過濾得到暫停,改變運行回到登錄頁面。
新手黃瓜這樣的代碼是不是在質量好,所以登錄的用戶服務測試的任何指導,將有助於
這裏是我的scnario
Feature: Create user from LMS
In order to create lms user with multiple groups
As a author
I want to create lms user with multipl groups
Scenario: Add new user with multiple groups
Given the following user information
And I am logged in as author "gulled" with password "thebest"
When I request for new lms user creation
Then the new user "user1" should be created
這裏是deffinitions
Given /^the following user information$/ do
# Factory(:login)
# Factory(:author)
end
Given /^I am logged in as author "([^"]*)" with password "([^"]*)"$/ do |username, password|
visit "account/login"
fill_in "loginfield", :with => username
fill_in "password", :with => password
click_button "submit_button"
end
When /^I request for new lms user creation$/ do
visit "/author_backend_lms/new_user"
fill_in "login_first_name", :with => ""
fill_in "login_last_name", :with => ""
fill_in "login_login", :with => ""
fill_in "login_email", :with => ""
fill_in "login_password_confirmation", :with => ""
click_button "create_user_form_submit_button"
end
Then /^the new user "([^"]*)" should be created$/ do |user_login|
login = Login.find_by_login user
assert_no_nil login, "Record creation failed"
end
在「請求新的LMS用戶創建」控制重定向回登錄頁面時,嘗試訪問LMS用戶創建頁面。
這裏是我的測試寶石列表
gem "capybara", "1.1.1"
gem "cucumber", "1.1.0"
gem "cucumber-rails", "0.3.2"
是改變代碼的指導,但仍然失敗,在第一步用戶在獲取記錄並在「何時」下執行的認證系統引發錯誤 處理AuthorBackendContentController#index [GET] {「action」=>「index」,「controller」=>「author_backend_content」} 重定向到http://www.example.com/account/login 過濾器鏈停止爲[:login_required] rendered_or_redirected。 [http://www.example。com/author_backend_content] 請求頁面:獲取http://www.example.com/account/logi – Gull
'重定向到example.com/account/login' =>看起來用戶登錄沒有成功。你使用'save_and_open_page'來調試這個問題嗎? –
是使用它,並在每一步它保持(顯示)登錄頁面。 – Gull