Test-driven development in Android by Illia Kondratov
Introduction for people who never tried TDD or unit testing before, or struggle with some part of it. We’ll cover benefits, discuss best practices and see what people mean when they say “it’s better to have unit-tests here”.
assertTrue(x == y); 3) Evergreen tests 4) Test avalanche twice a week 5) Discussing private matters with your test 6) Reflection 7) Testing toString() 8) It’s hard to name the test
no code @Test public void testSqrtWith25 () { //PREPARE SomeObjectToTest object = new SomeObjectToTest() ; //PERFORM int result = object.sqrt( 25); //CHECK } public class SomeObjectToTest {}
() { //PREPARE SomeObjectToTest object = new SomeObjectToTest() ; //PERFORM int result = object.sqrt( 25); //CHECK } public class SomeObjectToTest { public int sqrt(int value) { return 0; } }
you change the rules the way it fits you 2) It’s not a silver bullet - it’s not making your code perfect instantly 3) It’s not a universal solution - it might be not required