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

1 test 1 assert ?

PoohSunny
September 30, 2017

1 test 1 assert ?

TDDBC Tokyo 2017-09 でのLTスライドです。 https://tddbc.connpass.com/event/65484/

PoohSunny

September 30, 2017
Tweet

More Decks by PoohSunny

Other Decks in Technology

Transcript

  1. 3

  2. γϯάϧΞαʔγϣϯ9 • ࿑ಇ࣌ؒܭࢉͷςετ // then assertEquals(720, result.getWorkTime()); • ٳܜ࣌ؒܭࢉͷςετ //

    then List<Integer> breakTimeList = result.getBreakTimeList(); assertEquals(2, breakTimeList.size()); assertEquals(60, breakTimeList[0]); assertEquals(45, breakTimeList[1]); 9 http://xunitpatterns.com/Principles%20of%20Test%20Automation.html#Single Condition Test 9
  3. ಡΈ΍͍͢ܗʹ ϦϑΝΫλϦϯά • ྫ͑͹JUnit5 + AssertJΛར༻ // then List<Integer> breakTimeList

    = result.getBreakTimeList(); assertThat(breakTimeList).hasSize(2).containsExactly(60, 45); 12
  4. ಡΈ΍͘͢ͳΒͳ͍Α͏ͳΒ ΋͠ಡΈ΍͘͢ͳΒͳ͍ͳΒɺγϯάϧΞαʔγ ϣϯਥʹͳΔͭ΋Γ͸ͳ͍Α — Principle: Verify One Condition per Test

    11 11 http://xunitpatterns.com/Principles%20of%20Test%20Automation.html#Single Condition Test ΑΓҙ༁ 16