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

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Automation test



Published in Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    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 …


  • 1. Automation Test 余昭辉 2011.10
  • 2. I’m a… Developer(C#, Java, Scala…) Blogger( 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(“”) driver.findElement(“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