CodeFest 2012. Родионов А. — Тестирование Ruby (on Rails) приложений: стек, практики, шаблоны

  • Published on
    22-Jun-2015

  • View
    1.180

  • Download
    0

Embed Size (px)

Transcript

<ul><li> 1. Full-stacked Ruby (on Rails) testing RUBY (ON RAILS) :, , </li></ul> <p> 2. Freelance www.TopTal.com Watir-WebDriver, Page-Object, Ruby OnRails, NativeDriver Mozilla WebQA @p0deje https://github.com/p0deje p0deje@gmail.com 3. toptal 4. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 5. 6. class PublicControllerTest &lt; ActionController::TestCase # Replace this with your real tests. test the truth doassert true endend 7. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 8. Front-end RSpec - Rack-test Mock-Cucumber WebDriver 9. Front-end Scenario: Applying to job Given a new job is approved And I am logged in as developer user When I click Jobs link And I open this job And I apply to job Then I should see successfully apply to job message 10. Front-end Scenario Outline: Job termination Given a new job is And I am logged in as user When I open tab And I open this job And I job Then I should see Examples:| role | tab| job_status | action | message|| company | Jobs | created | remove | successful job deletion message|| company | Jobs | approved | cancel | successful job deletion message || company | Jobs | active | end | notice message The job was updated successfully. || admin | All Jobs | created | remove | successful job deletion message || admin | All Jobs | approved | cancel | successful job deletion message || admin | All Jobs | active | end | notice message The job was updated successfully. | 11. Front-end + DRY+ + , (-ATDD+ ? 12. Front-end Scenario: End active job Given a new job is active And I am logged in as company user When I open this job And I end job Then job status should be "On Notice" 13. Front-end Scenario: Ended job is active after page refresh Given a new job is active And I am logged in as company user When I open this job And I end job And I refresh page Then job status should be "On Notice" 14. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 15. Back-end http://watirmelon.com/2011/12/03/a-tale-of-three-ruby-automated-testing-apis-re 16. Back-end Capybara+ (i.e. + Rails- , APIWatir-WebDriver+ DOM-like API+ XPath, CSS 17. Back-end class HomePage &lt; Page # # Clicks Login link. # @return [LoginPage] # def click_login_linkmenu_div.link(text: Login).clickLoginPage.new end private def menu_div; browser.div(id: menu) endend # HomePage 18. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 19. page-objectclass HomePage &lt; Page # Elements link :login_link, id: login_linkend # HomePage&gt; page = HomePage.new # Click link&gt; page.login_link # Is link present on page?&gt; page.login_link? # Wait until link is shown, then click&gt; page.login_link_element.when_present.clickhttps://github.com/cheezy/page-object 20. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 21. DRY1. 22. DRY2. (polymorphous page objects) 23. DRY3. DSL 24. DRYclass JobListPage &lt; Page def jobs# ... end def job?(title)# ... end def job(title)# ... endend # JobListPage 25. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 26. CI CDSpecs (-)Features ( )Deploy 27. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 28. Selenium Grid 2 / parallel_tests , 29. 700 1. : 5 10 2. (Core Quad): 1 45 30. 1. e2. Front-end 3. Back-end 4. page-object5. DRY6. CI CD Jenkins7. 8. 31. 1. https://github.com/p0deje/action_mailer_cache_delive2. W3C3. , . https://github.com/p0deje/CodeFest-2012 32. ? @p0dejehttps://github.com/p0deje/CodeFest-2012</p>