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

テスト駆動開発の過去・現在・未来 / History of TDD - XPJUG 2018 ...

Takuto Wada
September 08, 2018

テスト駆動開発の過去・現在・未来 / History of TDD - XPJUG 2018 Keynote

テスト駆動開発の過去・現在・未来
XP祭り2018 基調講演
2018/09/08
http://xpjug.com/xp2018-session-keynote/

Takuto Wada

September 08, 2018
Tweet

More Decks by Takuto Wada

Other Decks in Programming

Transcript

  1. assert(typeof item.id === 'strong') | | | | | |

    | false | | "foo" | Item{id:"foo",name:"bar"} "string" --- [string] 'strong' +++ [string] typeof item.id @@ -1,6 +1,6 @@ str -o +i ng 代表作は power-assert IUUQTHJUIVCDPNQPXFSBTTFSUKTQPXFSBTTFSU
  2. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ࡭ͱਓ
  3. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ5%%CZ&YBNQMF΁ͷಓͷΓ
  4. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯY651
  5. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ(004
  6. public void testUpdateEmployee() throws SQLException { MockStatement nameStatement = new

    MockStatement(); MockStatement detailsStatement = new MockStatement(); MockConnection connection = new MockConnection(); nameStatement.setExpectedUpdate(NAME_SQL); detailsStatement.setExpectedUpdate(DETAILS_SQL); connection.setExpectedCommitCalls(1); myEmployee.updateNameAndDetails(connection, nameStatement, detailsStatement); connection.verify(); nameStatement.verify(); detailsStatement.verify(); } l.PDLzͷ஀ੜ
  7. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ"HJMF5FTUJOH
  8. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ#%%
  9. #%%5JNFMJOF '*5CZ8BSE$VOOJOHIBN 'JU/FTTFCZ#PC.BSUJOଞ ʮ4UPSZ%SJWFO%FWFMPQNFOUʯCZ*OEVTUSJBM-PHJDɺ"HJMF%PY։ൃɺ
 ʰ%PNBJO%SJWFO%FTJHOʱग़൛ɺ+#FIBWF։ൃ։࢝ɺzTIPVMEzͷൃݟ +#FIBWFϦϦʔεɺ%BO $ISJT.BUUTͱz(JWFO8IFO5IFOzΛൃݟ ʮ#%%"OFXMPPLBUUFTUESJWFOEFWFMPQNFOUʯɺ34QFD։ൃ։࢝ ʮ*OUSPEVDJOH#%%ʯ 34QFDϦϦʔε

    FBTZC (SPPWZ ϦϦʔε $VDVNCFS͕34QFD͔Βಠཱ͠ɺϦϦʔε ʰ#SJEHJOHUIF$PNNVOJDBUJPO(BQʱग़൛ɺ4QPDLϦϦʔε 34QFDϦϦʔε ʰ5IF34QFD#PPLʱग़൛ɺ
 ʰ5IF$VDVNCFS#PPLʱग़൛ɺ
 ʰ4QFDJpDBUJPOCZ&YBNQMFʱग़൛
  10. public class FooTest extends TestCase { public void testIsASingleton() {}

    public void testAReallyLongNameIsAGoodThing() {} } Foo - is a singleton - a really long name is a good thing 5FTU%PY"HJMF%PY CZ$ISJT4UFWFOTPO IUUQBHJMFEPYTPVSDFGPSHFOFU ςετίʔυ͔ΒυΩϡϝϯτੜ੒
  11. IUUQTKCFIBWFPSHIUUQEIBUFOBOFKQEJHJUBMTPVM public class StackBehavior { public void shouldPopValuesInReverseOrder() throws Exception

    { stStack.push("test 1"); stStack.push("test 2"); Ensure.that(stStack.pop(), m.is("test 2")); Ensure.that(stStack.pop(), m.is("test 1")); } public void shouldLeaveValueOnStackAfterPeek() throws Exception { stStack.push("test 1"); stStack.push("test 2"); Ensure.that(stStack.peek(), m.is("test 2")); Ensure.that(stStack.pop(), m.is("test 2")); } } +#FIBWF։ൃ։࢝ CZ%BO/PSUI ˞ཌ೥ϦϦʔε lςετϝιου͸ʮTIPVMEʯͱ͍͏୯ޠͰ࢝Ίͳ͚Ε͹ͳΒͳ͍ͱ͍͏ ن໿͕ු͔ͼ·ͨ͠ɻ͜ͷจষςϯϓϨʔτɺ͢ͳΘͪͦͷΫϥε͕Կ ͔Λ͢Δ΂͖ͩͱ͍͏จষςϯϓϨʔτ͕ҙຯ͍ͯ͠Δͷ͸ɺݱࡏର৅ͱ ͳ͍ͬͯΔΫϥεʹର͢Δςετ͔͠ఆٛͰ͖ͳ͍ͱ͍͏͜ͱͰ͢z
  12. describe Stack, " (empty)" do before(:each) do @stack = Stack.new

    end it { @stack.should be_empty } it { @stack.should_not be_full } it "should add to the top when sent #push" do @stack.push "newly added top item" @stack.peek.should == "newly added top item" end end 34QFD։ൃ։࢝
  13. IUUQTDVDVNCFSJP Feature: <some terse yet descriptive text of what is

    desired> As a <role> I want <feature> So that <business value> Scenario: <some determinable business situation> Given <some precondition> And <some other precondition> When <some action by the actor> And <some other action> Then <some testable outcome is achieved> And <something else we can check happens too> $VDVNCFS͕34QFD͔Βಠཱ
  14. #language: ja フィーチャ: ログインしてユーザを識別できる ユーザとして、 ログイン機能などで自分の情報を識別したい。 なぜなら、メッセージなどを「自分のもの」として区別したいからだ。 シナリオ: ユーザ登録してログインする 前提"新規ユーザ登録"ページを表示している

    もし"ログイン名"に"moro"と入力する かつ"E メール"に"[email protected]"と入力する かつ"作成"ボタンをクリックする ならば"こんにちは moro さん"と表示されていること $VDVNCFS͕34QFD͔Βಠཱ IUUQTUBUTV[JOFDPNCPPLTDVLF
  15. 2007 2008 2009 2010 2002 2003 2004 2005 2006 2011

    2012 2013 2014 ෇࿥$ͷλΠϜϥΠϯ%))
  16. IUUQXXXCVUVODMFCPCDPN"SUJDMF46ODMF#PC5IF5ISFF3VMFT0G5EE  :PVBSFOPUBMMPXFEUPXSJUFBOZQSPEVDUJPODPEFVOMFTTJUJTUP NBLFBGBJMJOHVOJUUFTUQBTT  :PVBSFOPUBMMPXFEUPXSJUFBOZNPSFPGBVOJUUFTUUIBOJT TV⒏DJFOUUPGBJMBOEDPNQJMBUJPOGBJMVSFTBSFGBJMVSFT  :PVBSFOPUBMMPXFEUPXSJUFBOZNPSFQSPEVDUJPODPEFUIBOJT TV⒏DJFOUUPQBTTUIFPOFGBJMJOHVOJUUFTU

     ࣦഊ͢ΔϢχοτςετΛ੒ޭͤ͞ΔͨΊʹ͔͠ɺϓϩμΫτίʔυΛॻ ͍ͯ͸ͳΒͳ͍ɻ  ࣦഊͤ͞ΔͨΊʹ͔͠ɺϢχοτςετΛॻ͍ͯ͸ͳΒͳ͍ɻίϯύΠϧ Τϥʔ͸ࣦഊʹ਺͑Δɻ  ϢχοτςετΛ͚ͭͩ੒ޭͤ͞ΔҎ্ʹɺϓϩμΫτίʔυΛॻ͍ͯ͸ ͳΒͳ͍ɻ ˞5%%ͷܒ໤ීٴʹਚྗ͠ɺඇৗʹେ͖ͳޭ੷ͷ͋Δ6ODMF#PCΛ ͜ͷΑ͏ͳจ຺Ͱొ৔ͤ͞Δ͜ͱʹ͸ɺͱͯ΋ෳࡶͳࢥ͍͕͋Γ·͢
  17. l8IFOJUTUJNFUPXSJUFDPEF #%%JTOPEJ⒎FSFOUGSPN5%%8SJUF BGBJMJOHUFTU8BUDIJUGBJM8SJUFFOPVHIDPEFUPNBLFJUQBTT $MFBOVQZPVSNFTT SFGBDUPS  4PIPXJT#%%T5%%EJ⒎FSFOU *OBDPVQMFPGBSFBT  #%%HJWFTZPVBXFMMEFpOFETUBSUJOHQPJOU5IFFYBNQMFT

    DSFBUFECZUIFEFMJCFSBUFEJTDPWFSZQSPDFTT  5FTUTUIBUSFTVMUGSPN#%%BSFOPUVOJUUFTUT CVUIJHIMFWFMUFTUT UIBUJOUFSBDUXJUIUIFTZTUFNBUBNVDINPSFHSBOVMBSMFWFM *EPOUDPOTJEFSUPPMTMJLF34QFDUPCFB#%%UPPM*UIJOLPGJU NPSFBTBVOJUUFTUJOHUPPMUIBUJTHSFBUGPS5%%JOUIFTQJSJUPG #%%z IUUQTDVDVNCFSJPCMPHBTMBLTWJFXPGCEE ݁ہ5%%ͱ#%%͸Ͳ͏ҧ͏ͷ