开发者

Easiest way to get basic integration coverage in rails?

开发者 https://www.devze.com 2023-03-23 08:06 出处:网络
I\'m taking over an application.It has no testing. I\'m looking for the bare minimum integration testing I can start with to have at least something to yell at me if I break something.

I'm taking over an application. It has no testing.

I'm looking for the bare minimum integration testing I can start with to have at least something to yell at me if I break something.

I was thinking:

  • Load small sql d开发者_JS百科ump
  • Given a list of URL
  • Request URL and ensure a successful response

Searching for something like this has been fruitless.

Any pointers to something like this?

Or, how would you implement something like this quick 'n dirty to get beginning coverage?


I used basic rspec integration testing:

# login factories, etc
context "Login" do
  it "works" do
    visit '/'
    page.should have_content "Login: "
    fill_in 'login', :with => @user.login
    click_button 'Login' 
    page.should have_content @user.name
  end
end

By creating the integration test, it forced me to make the necessary factories, so I could get an idea of the coupling for each page. Bonus: it made it easier to split the models up later when I added unit testing.

0

精彩评论

暂无评论...
验证码 换一张
取 消