Your SlideShare is downloading. ×
Automation test
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Automation test

2,096

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,096
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • If you modified some code, ensure you don’t break the test, if you break some tests, please fix it as quick as possible. You mustn’t leave the fail test to …
  • Transcript

    • 1. Automation Test 余昭辉 2011.10
    • 2. I’m a… Developer(C#, Java, Scala…) Blogger(http://yuyijq.cnblogs.com) Microsoft MVP(C#)I like… CLR, JVM OO, Design Pattern, Clean Code Agile(TDD, Code Review, Pair Programming, etc)
    • 3. Tools
    • 4. jUnit Test Fixture  BeforeClass, AfterClass, Before, After, assumeThat, Group Tests Extensions  DbUnit, jsonAssert Hamcres  Matchers  More expression  Friendly assert result
    • 5. Mock Mockito jMock easyMock MockObjects
    • 6. Spring test MockHttpServletRequest MockHttpServletResponse MockHttpSession MockServletConfig MockServletContext … ModelAndViewAssert
    • 7. Selenium + WebDriver driver.get(“http://www.qunar.com”) driver.findElement(By.id(“login”)).click(); …
    • 8. BDD(Cucumber) How to manage test cases? The relation between test cases and test code. QA and Dev
    • 9. Principles
    • 10. Test is a feedbackmechanism Run fast Run after each modified Run before check-in …
    • 11. Test triangle Functional TestsIntegration TestsUnit Tests
    • 12. State-based assert overbehavior-based assert assertThat(service.findById(1),is(expected)) verify(service,times(1)).findById(1);
    • 13. assertThat over assertXxx Self description Different parameter type
    • 14. Test behavior, not methods One behavior, one test Not one method many tests One test one assert(*)
    • 15. Test method name isimportant Test method is document Give your intent:  testFindById is not a good name  should_find_agent_by_id is better  TestDox rule
    • 16. Test data builder Agent agent = new AgentBuilder().build();
    • 17. Repeat run Don’t modified database, transaction Prepare data itself, or write fixture
    • 18. Test code is as important asproduct code We should extract duplicate code to method We should use good names …
    • 19. Add test at: If you want to add println to get debug info If you find a bug, write a test first
    • 20. Test as singal It’s very difficult to test Three steps:  Given  When  Then Test private methods
    • 21. Demo
    • 22. Remember Automated test can’t avoid bugs Even it can’t help you find bugs But it can avoid introduce bugs But…
    • 23. Thank you

    ×