Mais conteúdo relacionado Semelhante a Automation test (20) Automation test2. 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)
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
10. Test is a feedback
mechanism
Run fast
Run after each modified
Run before check-in
…
14. Test behavior, not methods
One behavior, one test
Not one method many tests
One test one assert(*)
15. Test method name is
important
Test method is document
Give your intent:
testFindById is not a good name
should_find_agent_by_id is better
TestDox rule
17. Repeat run
Don’t modified database, transaction
Prepare data itself, or write fixture
18. Test code is as important as
product 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
22. Remember
Automated test can’t avoid bugs
Even it can’t help you find bugs
But it can avoid introduce bugs
But…
Notas do Editor 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 …