我正在尝试编写测试狮身人面像搜索的测试。我需要用户将一些参数传递给 api,并基于该参数 shpinx 来执行搜索。
我有以下3个测试
在 test_helper.rb 我已经设置好了一切
require 'factory_girl'
require 'thinking_sphinx/test'
ThinkingSphinx::Test.init
.........
class ActiveSupport::TestCase
self.use_transactional_fixtures = false
self.use_instantiated_fixtures = false
fixtures :all
还有我的测试
test "should 1st test" do
ThinkingSphinx::Test.start
# uthenticatoin and creating records in databese with Factory Girl
ThinkingSphinx::Test.index
get "some/path", {params}, @headers
assert_response :success
end
test "should 2nd test" do
# uthenticatoin and creating records in databese with Factory Girl
ThinkingSphinx::Test.index
get "some/path", {params}, @headers
assert_response :success
# other assertions
end
test "should 3rd test" do
# uthenticatoin and creating records in databese with Factory Girl
ThinkingSphinx::Test.index
get "some/path", {params}, @headers
assert_response :success
# other assertions
ThinkingSphinx::Test.stop
end
我不知道为什么我的测试不是按照编写的顺序运行,而是第 2、第 3、第 1 个如何让测试按照编写的顺序运行。我正在使用基本的 Rails Test::Unit。由于测试细节,订单对我来说很重要。谢谢。