Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDD anti patterns - episode 6 - with Ignacio Saporitti and Pablo Díaz

TDD anti patterns - episode 6 - with Ignacio Saporitti and Pablo Díaz

In this talk we are going to introduce two new TDD anti-patterns that came in our experience practicing TDD in different projects: The jumper and The flash.

Marabesi

May 26, 2022
Tweet

More Decks by Marabesi

Other Decks in Programming

Transcript

  1. TDD - EP 6 codurance.com Testing anti-patterns - The One,

    The Peeping Tom, The jumper and The flash
  2. Matheus Marabesi Hello there, you can call me Marabesi, But

    my name is Matheus Marabesi, I work at Codurance as a Software Craftsperson. I enjoy talking about anything related to: testing, patterns and gamification. You can find me at @MatheusMarabesi or https://marabesi.com Codurance Crafting Code
  3. 1. Intro - Recap 2. The One 3. The Peeping

    Tom 4. The Flash 5. The Jumper 6. Wrapping up Crafting code Agenda
  4. 1. Intro - Recap 2. The One 3. The Peeping

    Tom 4. The Flash 5. The Jumper 6. Wrapping up Crafting code Agenda
  5. The Liar The Giant The Mockery The Inspector Generous Leftovers

    The Local Hero The Nitpicker The Secret Catcher The Dodger The Loudmouth Anti patterns The Greedy Catcher Excessive Setup The Sequencer Hidden Dependency The Enumerator The Stranger The Operating System Evangelist Success Against All Odds The Free Ride The One The Peeping Tom The Slow Poke James Carr - TDD Anti-Patterns
  6. The Liar 4 The Giant 5 The Mockery 1 The

    Inspector 7 Generous Leftovers 5 The Local Hero 7 The Nitpicker 8 The Secret Catcher 7 The Dodger 8 The Loudmouth 8 Anti patterns The Greedy Catcher 7 Excessive Setup 3 The Sequencer 7 Hidden Dependency 2 The Enumerator 8 The Stranger 7 The Operating System Evangelist 8 Success Against All Odds 5 The Free Ride 8 The One 7 The Peeping Tom 7 The Slow Poke 6
  7. Anti patterns - Survey takeaways 1. Survey notes: Javascript, PHP

    and Java were the most used programming languages 2. Survey notes: Practitioners usually informally learn TDD 3. The anti patterns covered were related to test last 4. Subjects we touched around testability: SOLID, Object calisthenics, Non-determinism and the test pyramid 5. Examples are from open source projects and also extraction from real code bases
  8. 2. Anti-patterns - Episode 6 The One, The Peeping Tom,

    The jumper and The flash Getting started
  9. The Liar The Giant The Mockery The Inspector Generous Leftovers

    The Local Hero The Nitpicker The Secret Catcher The Dodger The Loudmouth Anti patterns The Greedy Catcher Excessive Setup The Sequencer Hidden Dependency The Enumerator The Stranger The Operating System Evangelist Success Against All Odds The Free Ride The One The Peeping Tom The Slow Poke James Carr - TDD Anti-Patterns
  10. The Liar 4 The Giant 5 The Mockery 1 The

    Inspector 7 Generous Leftovers 5 The Local Hero 7 The Nitpicker 8 The Secret Catcher 7 The Dodger 8 The Loudmouth 8 Anti patterns The Greedy Catcher 7 Excessive Setup 3 The Sequencer 7 Hidden Dependency 2 The Enumerator 8 The Stranger 7 The Operating System Evangelist 8 Success Against All Odds 5 The Free Ride 8 The One 7 The Peeping Tom 7 The Slow Poke 6
  11. 2. The One - 🏆 7 A combination of several

    patterns, particularly TheFreeRide and TheGiant, a unit test that contains only one test method which tests the entire set of functionality an object has. A common indicator is that the test method is often the same as the unit test name, and contains multiple lines of setup and assertions. Crafting code
  12. 2. The One - 🏆 7 A combination of several

    patterns, particularly TheFreeRide and TheGiant, a unit test that contains only one test method which tests the entire set of functionality an object has. A common indicator is that the test method is often the same as the unit test name, and contains multiple lines of setup and assertions. Crafting code
  13. 2. The One - 🏆 7 A combination of several

    patterns, particularly TheFreeRide and TheGiant, a unit test that contains only one test method which tests the entire set of functionality an object has. A common indicator is that the test method is often the same as the unit test name, and contains multiple lines of setup and assertions. Crafting code
  14. The giant A unit test that, although it is validly

    testing the object under test, can span thousands of lines and contain many many test cases. This can be an indicator that the system under tests is a God Object. Crafting code
  15. namespace PhpOffice\PhpWord\Shared; class ConverterTest extends \PHPUnit\Framework\TestCase { public function testUnitConversions()

    { $values = array(); $values[] = 0; // zero value $values[] = rand(1, 100) / 100; // fraction number $values[] = rand(1, 100); // integer foreach ($values as $value) { $result = Converter::cmToTwip($value); $this->assertEquals($value / 2.54 * 1440, $result); $result = Converter::cmToInch($value); $this->assertEquals($value / 2.54, $result); PHPUnit - PHPOffice/Word
  16. namespace PhpOffice\PhpWord\Shared; class ConverterTest extends \PHPUnit\Framework\TestCase { public function testUnitConversions()

    { $values = array(); $values[] = 0; // zero value $values[] = rand(1, 100) / 100; // fraction number $values[] = rand(1, 100); // integer foreach ($values as $value) { $result = Converter::cmToTwip($value); $this->assertEquals($value / 2.54 * 1440, $result); $result = Converter::cmToInch($value); $this->assertEquals($value / 2.54, $result); PHPUnit - PHPOffice/Word
  17. namespace PhpOffice\PhpWord\Shared; class ConverterTest extends \PHPUnit\Framework\TestCase { public function testUnitConversions()

    { $values = array(); $values[] = 0; // zero value $values[] = rand(1, 100) / 100; // fraction number $values[] = rand(1, 100); // integer foreach ($values as $value) { $result = Converter::cmToTwip($value); $this->assertEquals($value / 2.54 * 1440, $result); $result = Converter::cmToInch($value); $this->assertEquals($value / 2.54, $result); PHPUnit - PHPOffice/Word
  18. namespace PhpOffice\PhpWord\Shared; class ConverterTest extends \PHPUnit\Framework\TestCase { public function testUnitConversions()

    { $values = array(); $values[] = 0; // zero value $values[] = rand(1, 100) / 100; // fraction number $values[] = rand(1, 100); // integer foreach ($values as $value) { $result = Converter::cmToTwip($value); $this->assertEquals($value / 2.54 * 1440, $result); $result = Converter::cmToInch($value); $this->assertEquals($value / 2.54, $result); PHPUnit - PHPOffice/Word
  19. namespace PhpOffice\PhpWord\Shared; class ConverterTest extends \PHPUnit\Framework\TestCase { public function testUnitConversions()

    { $values = array(); $values[] = 0; // zero value $values[] = rand(1, 100) / 100; // fraction number $values[] = rand(1, 100); // integer foreach ($values as $value) { $result = Converter::cmToTwip($value); $this->assertEquals($value / 2.54 * 1440, $result); $result = Converter::cmToInch($value); $this->assertEquals($value / 2.54, $result); PHPUnit - PHPOffice/Word
  20. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  21. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  22. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  23. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  24. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  25. $result = Converter::cmToPixel($value); $this->assertEquals($value / 2.54 * 96, $result); $result

    = Converter::cmToPoint($value); $this->assertEquals($value / 2.54 * 72, $result); $result = Converter::cmToEmu($value); $this->assertEquals(round($value / 2.54 * 96 * 9525), $result); $result = Converter::inchToTwip($value); $this->assertEquals($value * 1440, $result); $result = Converter::inchToCm($value); $this->assertEquals($value * 2.54, $result); $result = Converter::inchToPixel($value); $this->assertEquals($value * 96, $result); PHPUnit - PHPOffice/Word
  26. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  27. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  28. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  29. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  30. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  31. $result = Converter::inchToPoint($value); $this->assertEquals($value * 72, $result); $result = Converter::inchToEmu($value);

    $this->assertEquals(round($value * 96 * 9525), $result); $result = Converter::pixelToTwip($value); $this->assertEquals($value / 96 * 1440, $result); $result = Converter::pixelToCm($value); $this->assertEquals($value / 96 * 2.54, $result); $result = Converter::pixelToPoint($value); $this->assertEquals($value / 96 * 72, $result); $result = Converter::pixelToEmu($value); $this->assertEquals(round($value * 9525), $result); PHPUnit - PHPOffice/Word
  32. $result = Converter::degreeToAngle($value); $this->assertEquals((int) round($value * 60000), $result); $result =

    Converter::angleToDegree($value); $this->assertEquals(round($value / 60000), $result); } } PHPUnit - PHPOffice/Word
  33. public void testFlightMileage_asKm2() throws Exception { // set up fixture

    // exercise constructor Flight newFlight = new Flight(validFlightNumber); // verify constructed object assertEquals(validFlightNumber, newFlight.number); assertEquals("", newFlight.airlineCode); assertNull(newFlight.airline); // set up mileage newFlight.setMileage(1122); // exercise mileage translator int actualKilometres = newFlight.getMileageAsKm(); // verify results int expectedKilometres = 1810; assertEquals( expectedKilometres, actualKilometres); // now try it with a canceled flight newFlight.cancel(); try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) { assertEquals( "Cannot get cancelled flight mileage", Assertion Roulette - xUnit
  34. public void testFlightMileage_asKm2() throws Exception { // set up fixture

    // exercise constructor Flight newFlight = new Flight(validFlightNumber); // verify constructed object assertEquals(validFlightNumber, newFlight.number); assertEquals("", newFlight.airlineCode); assertNull(newFlight.airline); // set up mileage newFlight.setMileage(1122); // exercise mileage translator int actualKilometres = newFlight.getMileageAsKm(); // verify results int expectedKilometres = 1810; assertEquals( expectedKilometres, actualKilometres); // now try it with a canceled flight newFlight.cancel(); try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) { assertEquals( "Cannot get cancelled flight mileage", Assertion Roulette - xUnit
  35. public void testFlightMileage_asKm2() throws Exception { // set up fixture

    // exercise constructor Flight newFlight = new Flight(validFlightNumber); // verify constructed object assertEquals(validFlightNumber, newFlight.number); assertEquals("", newFlight.airlineCode); assertNull(newFlight.airline); // set up mileage newFlight.setMileage(1122); // exercise mileage translator int actualKilometres = newFlight.getMileageAsKm(); // verify results int expectedKilometres = 1810; assertEquals( expectedKilometres, actualKilometres); // now try it with a canceled flight newFlight.cancel(); try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) { assertEquals( "Cannot get cancelled flight mileage", Assertion Roulette - xUnit
  36. public void testFlightMileage_asKm2() throws Exception { // set up fixture

    // exercise constructor Flight newFlight = new Flight(validFlightNumber); // verify constructed object assertEquals(validFlightNumber, newFlight.number); assertEquals("", newFlight.airlineCode); assertNull(newFlight.airline); // set up mileage newFlight.setMileage(1122); // exercise mileage translator int actualKilometres = newFlight.getMileageAsKm(); // verify results int expectedKilometres = 1810; assertEquals( expectedKilometres, actualKilometres); // now try it with a canceled flight newFlight.cancel(); try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) { assertEquals( "Cannot get cancelled flight mileage", Assertion Roulette - xUnit
  37. public void testFlightMileage_asKm2() throws Exception { // set up fixture

    // exercise constructor Flight newFlight = new Flight(validFlightNumber); // verify constructed object assertEquals(validFlightNumber, newFlight.number); assertEquals("", newFlight.airlineCode); assertNull(newFlight.airline); // set up mileage newFlight.setMileage(1122); // exercise mileage translator int actualKilometres = newFlight.getMileageAsKm(); // verify results int expectedKilometres = 1810; assertEquals( expectedKilometres, actualKilometres); // now try it with a canceled flight newFlight.cancel(); try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) { assertEquals( "Cannot get cancelled flight mileage", Assertion Roulette - xUnit
  38. try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) {

    assertEquals( "Cannot get cancelled flight mileage", e.getMessage()); } } Assertion Roulette - xUnit
  39. try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) {

    assertEquals( "Cannot get cancelled flight mileage", e.getMessage()); } } Assertion Roulette - xUnit
  40. try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) {

    assertEquals( "Cannot get cancelled flight mileage", e.getMessage()); } } Assertion Roulette - xUnit
  41. try { newFlight.getMileageAsKm(); fail("Expected exception"); } catch (InvalidRequestException e) {

    assertEquals( "Cannot get cancelled flight mileage", e.getMessage()); } } Assertion Roulette - xUnit
  42. The Free Ride Rather than write a new test case

    method to test another feature or functionality, a new assertion rides along in an existing test case. Crafting code
  43. public class ToolLocationTest { @Rule public JenkinsRule j = new

    JenkinsRule(); @Test public void toolCompatibility() { Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(); assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); Java - Jenkins
  44. public class ToolLocationTest { @Rule public JenkinsRule j = new

    JenkinsRule(); @Test public void toolCompatibility() { Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(); assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); Java - Jenkins
  45. public class ToolLocationTest { @Rule public JenkinsRule j = new

    JenkinsRule(); @Test public void toolCompatibility() { Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(); assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); Java - Jenkins
  46. public class ToolLocationTest { @Rule public JenkinsRule j = new

    JenkinsRule(); @Test public void toolCompatibility() { Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(); assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); Java - Jenkins
  47. public class ToolLocationTest { @Rule public JenkinsRule j = new

    JenkinsRule(); @Test public void toolCompatibility() { Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations(); assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); Java - Jenkins
  48. public class ToolLocationTest { @Test @LocalData public void shouldBeCompatibleWithMaven() {

    Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); } @Test @LocalData public void shouldBeCompatibleWithAnt() { Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); } @Test @LocalData Java - Jenkins
  49. public class ToolLocationTest { @Test @LocalData public void shouldBeCompatibleWithMaven() {

    Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); } @Test @LocalData public void shouldBeCompatibleWithAnt() { Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); } @Test @LocalData Java - Jenkins
  50. public class ToolLocationTest { @Test @LocalData public void shouldBeCompatibleWithMaven() {

    Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations(); assertEquals(1, maven.length); assertEquals("bar", maven[0].getHome()); assertEquals("Maven 1", maven[0].getName()); } @Test @LocalData public void shouldBeCompatibleWithAnt() { Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(); assertEquals(1, ant.length); assertEquals("foo", ant[0].getHome()); assertEquals("Ant 1", ant[0].getName()); } @Test @LocalData Java - Jenkins
  51. @Test @LocalData public void shouldBeCompatibleWithJdk() { JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations();

    assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs()); assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing assertEquals("FOOBAR", jdk[0].getHome()); assertEquals("FOOBAR", jdk[0].getJavaHome()); assertEquals("1.6", jdk[0].getName()); } } Java - Jenkins
  52. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  53. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  54. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  55. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  56. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  57. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  58. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  59. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  60. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  61. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  62. it('Page.Events.RequestFailed', async () => { const { page, server, isChrome

    } = getTestState(); await page.setRequestInterception(true); page.on('request', (request) => { if (request.url().endsWith('css')) request.abort(); else request.continue(); }); const failedRequests = []; page.on('requestfailed', (request) => failedRequests.push(request)); await page.goto(server.PREFIX + '/one-style.html'); expect(failedRequests.length).toBe(1); expect(failedRequests[0].url()).toContain('one-style.css'); expect(failedRequests[0].response()).toBe(null); expect(failedRequests[0].resourceType()).toBe('stylesheet'); if (isChrome) expect(failedRequests[0].failure().errorText).toBe('net::ERR_FAILED'); else expect(failedRequests[0].failure().errorText).toBe('NS_ERROR_FAILURE'); expect(failedRequests[0].frame()).toBeTruthy(); }); Javascript/Typescript - Puppeteer
  63. 3. The Peeping Tom - 🏆7 A test that, due

    to shared resources, can see the result data of another test, and may cause the test to fail even though the system under test is perfectly valid. This has been seen commonly in fitnesse, where the use of static member variables to hold collections aren’t properly cleaned after test execution, often popping up unexpectedly in other test runs. Also known as TheUninvitedGuests Crafting code
  64. 3. The Peeping Tom - 🏆7 A test that, due

    to shared resources, can see the result data of another test, and may cause the test to fail even though the system under test is perfectly valid. This has been seen commonly in fitnesse, where the use of static member variables to hold collections aren’t properly cleaned after test execution, often popping up unexpectedly in other test runs. Also known as TheUninvitedGuests Crafting code
  65. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  66. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  67. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  68. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  69. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  70. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  71. public class MySingleton{ private static MySingleton instance; private String property;

    private MySingleton(String property) { this.property = property; } public static synchronized MySingleton getInstance() { if (instance == null) { instance = new MySingleton(System.getProperty("com.example")); } return instance; } public Object getSomething() { return this.property; } } Java - Singleton
  72. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  73. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  74. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  75. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  76. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  77. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  78. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  79. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton ✅
  80. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton
  81. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton ❌
  82. class MySingletonTest { @BeforeEach public void resetSingleton() throws SecurityException, NoSuchFieldException,

    IllegalArgumentException, IllegalAccessException { Field instance = MySingleton.class.getDeclaredField("instance"); instance.setAccessible(true); instance.set(null, null); } } Java - Singleton
  83. class MySingletonTest { @BeforeEach public void resetSingleton() throws SecurityException, NoSuchFieldException,

    IllegalArgumentException, IllegalAccessException { Field instance = MySingleton.class.getDeclaredField("instance"); instance.setAccessible(true); instance.set(null, null); } } Java - Singleton
  84. class MySingletonTest { @BeforeEach public void resetSingleton() throws SecurityException, NoSuchFieldException,

    IllegalArgumentException, IllegalAccessException { Field instance = MySingleton.class.getDeclaredField("instance"); instance.setAccessible(true); instance.set(null, null); } } Java - Singleton
  85. class MySingletonTest { @BeforeEach public void resetSingleton() throws SecurityException, NoSuchFieldException,

    IllegalArgumentException, IllegalAccessException { Field instance = MySingleton.class.getDeclaredField("instance"); instance.setAccessible(true); instance.set(null, null); } } Java - Singleton
  86. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton ✅
  87. import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class MySingletonTest { @Test public

    void somethingIsDoneWithAbcIsSetAsASystemProperty(){ System.setProperty("com.example", "abc"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("abc"); } @Test public void somethingElseIsDoneWithXyzIsSetAsASystemProperty(){ System.setProperty("com.example", "xyz"); MySingleton singleton = MySingleton.getInstance(); assertThat(singleton.getSomething()).isEqualTo("xyz"); } } Java - Singleton ✅
  88. The Liar 4 The Giant 5 The Mockery 1 The

    Inspector 7 Generous Leftovers 5 The Local Hero 7 The Nitpicker 8 The Secret Catcher 7 The Dodger 8 The Loudmouth 8 Anti patterns The Greedy Catcher 7 Excessive Setup 3 The Sequencer 7 Hidden Dependency 2 The Enumerator 8 The Stranger 7 The Operating System Evangelist 8 Success Against All Odds 5 The Free Ride 8 The One 7 The Peeping Tom 7 The Slow Poke 6
  89. The Liar 4 The Giant 5 The Mockery 1 The

    Inspector 7 Generous Leftovers 5 The Local Hero 7 The Nitpicker 8 The Secret Catcher 7 The Dodger 8 The Loudmouth 8 Anti patterns The Greedy Catcher 7 Excessive Setup 3 The Sequencer 7 Hidden Dependency 2 The Enumerator 8 The Stranger 7 The Operating System Evangelist 8 Success Against All Odds 5 The Free Ride 8 The One 7 The Peeping Tom 7 The Slow Poke 6
  90. • The One ◦ Anti patterns can be mixed between

    each other ◦ In open source projects it is usually a mix • The Peeping Tom What we covered
  91. • The One ◦ Anti patterns can be mixed between

    each other ◦ In open source projects it is usually a mix • The Peeping Tom ◦ Once again, avoid global state What we covered
  92. 4. The flash ⚡ Developers that gets blocked trying to

    practice TDD, and before splitting up the test in smaller chunks, they are thinking about all the edge cases that the test would cover. This can lead to another anti patterns itself. Crafting code
  93. Test methods should be easy to read, pretty much straight

    line code. If a test method is getting long and complicated, then you need to play "Baby Steps." Kent Beck - TDD by example
  94. 5. The jumper The practice of trying to follow the

    test driven development approach, but jumping up to the next steps of the flow before completing the one before. Crafting code
  95. Tdd loop here (and potentially share the xp meetup) Trying

    to make it "perfect" from the start Get blocked by not knowing what to code
  96. Tdd loop here (and potentially share the xp meetup) -

    Refactor on the red - Changing class name - Fixing styles (any kind of style) - Changing files that are not related to the test Trying to make it "perfect" from the start Get blocked by not knowing what to code
  97. Tdd loop here (and potentially share the xp meetup) -

    Refactor on the red - Changing class name - Fixing styles (any kind of style) - Changing files that are not related to the test Trying to make it "perfect" from the start Get blocked by not knowing what to code
  98. Tdd loop here (and potentially share the xp meetup) Not

    trusting the hard coded ("I know it will pass")
  99. • The One • The Peeping Tom • The flash

    • The jumper What we covered
  100. Matheus Marabesi Hello there, you can call me Marabesi, But

    my name is Matheus Marabesi, I work at Codurance as a Software craftsperson. I enjoy talking about anything related to: testing, patterns and gamification. You can find me at @MatheusMarabesi or https://marabesi.com Codurance Crafting Code