Slide 1

Slide 1 text

Copyright (C) DeNA Co.,Ltd. All Rights Reserved. iOS Test Night #7 2018/03/26 (Mon) 
 ࡉপ ༞հ@DeNA 4XJGUʹ͓͚Δ .PDLϥΠϒϥϦͷ׆༻ 1

Slide 2

Slide 2 text

˙:VTVLF)PTPOVNBʢ!UPCJʣ • ॴଐ ⁃ %F/"ɹ48&5άϧʔϓɹςετج൫νʔϜ ⁃ ςετٕज़ͷௐࠪɺࣾ಺πʔϧ։ൃ • 'BWPSJUF ⁃ • ۙگ ⁃ USZ4XJGU"GUFS5BMLTEBZͰൃදʢ4XJGU1.Ͱ࡞Δ$-*ʣ ⁃ ,PUMJOΛ৮͚ͬͯͨͲɺ4XJGUͷྑ͞ʹ΋࠶ͼؾ͖ͮ࢝ΊΔ ⁃ 4XJGUͷ.PDLϥΠϒϥϦʹՄೳੑΛײ͡Δɹˡ͍·͜͜ 8IP Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 2

Slide 3

Slide 3 text

ࠓ೔࿩͢͜ͱ 3 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 4

Slide 4 text

4XJGUʹ͓͚Δ .PDLϥΠϒϥϦͷ׆༻ 4 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 5

Slide 5 text

ΞδΣϯμ 5 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • .PDLͱ͸ • 4XJGUʹ͓͚Δ.PDLࣄ৘ • .PDLΛࣗ෼Ͱ࡞Δ • 044ϥΠϒϥϦͷ঺հ • ϥΠϒίʔσΟϯάʢ࣌ؒ͋Ε͹ʂʣ • ·ͱΊ

Slide 6

Slide 6 text

.PDLͱ͸ʁ 6 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 7

Slide 7 text

Mockͱ͸ʁ 7 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • ຊ෺Ͱ͸ͳِ͍෺ͷΦϒδΣΫτʢςετμϒϧͱ΋ʣ • ୯ମςετ΍ಈ࡞֬ೝͰར༻ • ྫ • "1*͕ະ׬੒
 ˠμϛʔϨεϙϯεΛฦ͢.PDL • ґଘؔ܎͕ෳࡶͳςετ
 ˠґଘΦϒδΣΫτΛ.PDLʹมߋ

Slide 8

Slide 8 text

Mockͷར༻ྫ 8 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Waiter CockProtocol RealCock ΢ΣΠλʔ ྉཧਓ1SPUPDPM ྉཧਓ

Slide 9

Slide 9 text

Mockͷར༻ྫ 9 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Waiter CockProtocol RealCock ୯ମςετ͍ͨ͠ʜ ͚Ͳ࣮૷Ͱ͖ͯͳ͍ʜ

Slide 10

Slide 10 text

Mockͷར༻ྫ 10 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Waiter CockProtocol MockCock ςετ༻ͷِΦϒδΣΫτ

Slide 11

Slide 11 text

MockͰԿ͕Ͱ͖Δʁ 11 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • ͋Δ"1*ݺͼग़࣌͠ʹɺ೚ҙͷ஋Λฦ͢ • ಈ࡞֬ೝ༻ͷ"1*Ϩεϙϯε • ྫ֎తͳΤϥʔ • ݺͼग़݁͠Ռͷ֬ೝ • ͋Δϝιου"͕ݺͼग़͞Ε͔ͨ • ʻճ਺ʼ͸ਖ਼͍͔͠ʁ • ʻҾ਺ʼ͸ਖ਼͍͔͠ʁ

Slide 12

Slide 12 text

ͳͥMockΛ࢖͏͔ʁ 12 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • ࣮ΦϒδΣΫτ͕ଘࡏ͠ͳ͍ • ࣮૷த • ࣮ΦϒδΣΫτΛར༻͢Δͱ͕͔͔࣌ؒΔ • ௨৴࣌ؒ • σʔλϕʔε΁ͷΞΫηε • ґଘؔ܎Λ੾Γ཭͍ͨ͠৔߹ • ୯ମςετ

Slide 13

Slide 13 text

͜͜·Ͱ 13 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • .PDLʹِ෺ͷΦϒδΣΫτ • Կ͕Ͱ͖Δʁ • ೚ҙͷ஋Λฦ͢ • ݺͼग़݁͠Ռͷ֬ೝ • ͳͥར༻͢Δʁ • ࣮ΦϒδΣΫτ͕ଘࡏ͠ͳ͍ • ࣮ΦϒδΣΫτͩͱ͕͔͔࣌ؒΔ • ୯ମςετ UIFO3FUVSO 7FSJGZ

Slide 14

Slide 14 text

4XJGUʹ͓͚Δ .PDLࣄ৘ 14 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 15

Slide 15 text

0CKFDUJWF$࣌୅ 15 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 16

Slide 16 text

Objective-C ࣌୅ 16 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • 0CKFDUJWF$ • ಈతϥϯλΠϜʢ0CKFDUJWF$3VOUJNFʣ • .FUIPE4XJ[[MJOH • .FUIPE.JTTJOH ɹɹˠϝλϓϩάϥϛϯάʢࠇຐज़ʣͷ׆༻ • 0$.PDL • 0CKFDUJWF$ʹ͓͚ΔσϑΝΫτϥΠϒϥϦ • ݴޠϥϯλΠϜΛϑϧ׆༻

Slide 17

Slide 17 text

4XJGU࣌୅ 17 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 18

Slide 18 text

Swift ࣌୅ɹংষ 18 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • 4XJGU • ੩తϥϯλΠϜ • ϦϑϨΫγϣϯ"1*ʢಡΈऔΓઐ༻ʣ • 0CKFDUJWF$ϥϯλΠϜͷ׆༻͸ݶఆత
 ˠϝλϓϩάϥϛϯάʢࠇຐज़ʣͷ׆༻ • 0$.PDL • ݴޠϒϦοδͰ࢖༻Ͱ͖Δʢͦͷ༐ؾ͕͋Ε͹ʣ • 0$.PDL͕4XJGUΛ׬શαϙʔτ͢Δ͜ͱ͸ͳ͍ ެࣜ'"2ΑΓҙ༁

Slide 19

Slide 19 text

Swift ࣌୅ɹͦΕ͔Β… 19 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • ॳظͷΞϓϩʔν • .PDL͸खಈ࡞੒ • 3FUVSO7FSJGZΛαϙʔτ͢Δ044 • 4XJGU.PDLɹ⭐ • .PDL'JWFɹ⭐ • %PCCZɹ⭐ ɹˠ͍ͣΕ΋4XJGUYͰϝϯς͕ࢭ·Δ

Slide 20

Slide 20 text

Swift ࣌୅ɹͦͯ͠… 20 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • 88%$ • 1SPUPDPM0SJFOUFE1SPHSBNNJOH͕ఏএ
 ˠ͞Βʹ.PDL͕ॏཁʹʜʁ • ৽͍͠Ξϓϩʔνొ৔ʂ • $VDLPP • .PDLΛࣗಈੜ੒ • .PDLJUP +BWB ΠϯεύΠΞ ɹɹˠ͋ͱͰݟ͍ͯ͘

Slide 21

Slide 21 text

.PDLͷࣗ࡞ 21 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 22

Slide 22 text

Ϋϥεਤ 22 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. Waiter CockProtocol MockCock ͜ͷ.PDLΛࣗ࡞͢Δ

Slide 23

Slide 23 text

ϓϩμΫτίʔυ 23 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 24

Slide 24 text

ϓϩμΫτίʔυ 24 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. protocol CockProtocol { func cockRamen(bowls: Int, soup: Soup) -> [Ramen] } enum Soup { case ে༉ case ຯḩ } struct Ramen { var soup: Soup } struct Waiter { let cock: CockProtocol // ґଘΦϒδΣΫτ func order() -> [Ramen] { return cock.cockRamen(bowls: 2, soup: .ে༉) } } ͜ΕΛ.PDLʹ͢Δ

Slide 25

Slide 25 text

.PDLίʔυ 25 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 26

Slide 26 text

Mockίʔυ 26 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class MockCock: CockProtocol { var cockRamenCallCount: Int = 0 var cockRamenLastBowls: Int = 0 var cockRamenCallReturn: [Ramen] = [] var cockRamenLastSoup: Soup = .ে༉ func cockRamen(bowls: Int, soup: Soup) -> [Ramen] { // ݺͼग़͠ճ਺ͷه࿥ cockRamenCallCount += 1 // Ҿ਺ͷه࿥ cockRamenLastBowls = bowls cockRamenLastSoup = soup // ೚ҙͷ஋Λฦ͢ return cockRamenCallReturn } } ݺͼग़࣌͠ͷ৘ใΛه࿥ ઃఆ͞Εͨ໭Γ஋Λฦ͢

Slide 27

Slide 27 text

୯ମςετίʔυ 27 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 28

Slide 28 text

୯ମςετίʔυ 28 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } }

Slide 29

Slide 29 text

୯ମςετίʔυ 29 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } } ᶃDPDL3BNFO ͕ݺ͹Εͨ࣌ʹ ͜ͷ஋Λฦ͢Α͏ʹઃఆ

Slide 30

Slide 30 text

୯ମςετίʔυ 30 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } } ᶄPSEFS ͷݺͼग़݁͠Ռʹ͍ͭͯ ظ଴ͨ݁͠Ռ͔ݕূ

Slide 31

Slide 31 text

୯ମςετίʔυ 31 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } } ᶅ$PDLΦϒδΣΫτͷϝιου͕ ҙਤͨ͠௨Γʹݺͼग़͞Ε͔ͨݕূ

Slide 32

Slide 32 text

.PDLΛؚΊͨ ςετίʔυશମ 32 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 33

Slide 33 text

͜Ε͘Β͍ͳΒଥڠ͢Δʁ 33 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class MockCock: CockProtocol { var cockRamenCallCount: Int = 0 var cockRamenLastBowls: Int = 0 var cockRamenCallReturn: [Ramen] = [] var cockRamenLastSoup: Soup = .ে༉ func cockRamen(bowls: Int, soup: Soup) -> [Ramen] { cockRamenCallCount += 1 cockRamenLastBowls = bowls cockRamenLastSoup = soup return cockRamenCallReturn } } class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } }

Slide 34

Slide 34 text

͜Ε͘Β͍ͳΒଥڠ͢Δʁ 34 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class MockCock: CockProtocol { var cockRamenCallCount: Int = 0 var cockRamenLastBowls: Int = 0 var cockRamenCallReturn: [Ramen] = [] var cockRamenLastSoup: Soup = .ে༉ func cockRamen(bowls: Int, soup: Soup) -> [Ramen] { cockRamenCallCount += 1 cockRamenLastBowls = bowls cockRamenLastSoup = soup return cockRamenCallReturn } } class WaiterTests: XCTestCase { func test_order() { let mock = MockCock() mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)] let results = Waiter(cock: mock).order() XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) XCTAssertEqual(mock.cockRamenCallCount, 1) XCTAssertEqual(mock.cockRamenLastBowls, 2) XCTAssertEqual(mock.cockRamenLastSoup, .ে༉) } } ྫྷ੩ʹߟ͑Δͱ… ɾ1 Protocol ɾ1 Method ͦΕͳͷʹ͜ͷίʔυྔʁ

Slide 35

Slide 35 text

ࣗ࡞.PDLͷײ૝ 35 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 36

Slide 36 text

ࣗ࡞Mockͷײ૝ 36 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • ࣗ࡞.PDL • ࡞Δͷࣗମ͸೉͘͠ͳ͍ • ͨͩϘΠϥʔϓϨʔτ͕ଟ͍PS[ • ࡞Δͷ͕໘౗ͩͱ • .PDLࣗମʹόάΛ࢓ࠐΉ • ςετ͕ࡶʹͳΔ • ςετʹର͢ΔϞνϕʔγϣϯ%PXO ɹˠྑ͘ͳ͍ํ޲ʹߦ͘ͷ͸໨ʹݟ͍͑ͯΔ

Slide 37

Slide 37 text

4XJGUͷ .PDLϥΠϒϥϦ 37 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 38

Slide 38 text

Swift ͷ MockϥΠϒϥϦ 38 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ˒ छผ Swift Ұݴ Cuckoo 711 ࣗಈੜ੒ 4.0 ɾMockitoΠϯεύΠΞʢࣅͯΔʣ
 ɾSourceKittenΛར༻ SwiftyMocky 301 ʏ 4.0 ɾSwiftyͳAPI
 ɾSourceryΛར༻ͯ͠ੜ੒ Mockit 66 αϙʔτܥ 4.0 ɾMockitoΠϯεύΠΞ
 ɾ·ͩൃల్্ʁ Dobby 151 ʏ 2.x ɾࠓޙ΋ϝϯς͞Εͳͦ͏ʁ MockFive 201 ʏ 2.x ʏ SwiftMock 223 ʏ 2.x ʏ

Slide 39

Slide 39 text

.PDLJU 39 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 40

Slide 40 text

Mockit 40 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • αϒΫϥεԽʹΑΔ.PDLͷαϙʔτ • 1SPUPDPM͸αϙʔτ͍ͯ͠ͳ͍ʁ • .PDLͷ਽ܗ͸ࣗ࡞ • গͳ͍ίʔυྔͰ.PDLΛ࣮ݱ • ՝୊ • Τϥʔ࣌ʹςετίʔυʹϚʔΧʔ͕෇͔ͳ͍ • ·ͩൃల్্ͱ͍͏ʢݸਓͷʣҹ৅ ࠓޙʹظ଴ͯ͠ʢ͈́

Slide 41

Slide 41 text

$VDLPP 41 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 42

Slide 42 text

Cuckoo 42 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • .PDLJUPΠϯεύΠΞ • ͔ͳΓࣅ͍ͯΔҹ৅ • ࣗಈੜ੒ • ϑΝΠϧΛࣗ෼Ͱࢦఆ͢Δඞཁ͋Γ

Slide 43

Slide 43 text

Cuckoo 43 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = MockCockProtocol() stub(mock) { stub in when(stub.cockRamen(bowls: any(), soup: any())) .thenReturn([Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)]) } // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) verify(mock).cockRamen(bowls: equal(to: 2), soup: equal(to: .ে༉)) } ࣗಈੜ੒͞Εͨ.PDL

Slide 44

Slide 44 text

Cuckoo 44 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = MockCockProtocol() stub(mock) { stub in when(stub.cockRamen(bowls: any(), soup: any())) .thenReturn([Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)]) } // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) verify(mock).cockRamen(bowls: equal(to: 2), soup: equal(to: .ে༉)) } DPDL3BNFO ͕ݺͼग़͞Εͨ࣌ͷ μϛʔͷ໭Γ஋Λઃఆ DPDL3BNFO ͷݺͼग़͠Ҿ਺͕ ҙਤͨ͠΋ͷ͔ݕূʢWFSJGZʣ

Slide 45

Slide 45 text

Cuckoo 45 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = MockCockProtocol() stub(mock) { stub in when(stub.cockRamen(bowls: any(), soup: any())) .thenReturn([Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)]) } // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) verify(mock).cockRamen(bowls: equal(to: 2), soup: equal(to: .ে༉)) } .PDLJUPϥΠΫͳ"1* .BUDIFSΛ࠾༻

Slide 46

Slide 46 text

4XJGUZ.PDLZ 46 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 47

Slide 47 text

SwiftyMocky 47 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • .PDLJUPϥΠΫ • ߟ͑ํ͸ࣅ͍ͯΔ • 4XJGUZͳ"1* • ίʔυิ׬͕ޮ͖΍͍͢"1*ઃܭ • ࣗಈੜ੒ • NPDLZZNM͔Βੜ੒ • ϑΝΠϧ؂ࢹΛαϙʔτ • 4PVSDFSZΛ಺෦తʹར༻

Slide 48

Slide 48 text

SwiftyMocky 48 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = CockProtocolMock() mock.given(.cockRamen(bowls: .any, soup: .any, willReturn: [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)])) // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) mock.verify(.cockRamen(bowls: .value(2), soup: .value(.ে༉))) } } ࣗಈੜ੒͞Εͨ.PDL

Slide 49

Slide 49 text

SwiftyMocky 49 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = CockProtocolMock() mock.given(.cockRamen(bowls: .any, soup: .any, willReturn: [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)])) // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) mock.verify(.cockRamen(bowls: .value(2), soup: .value(.ে༉))) } } DPDL3BNFO ͕ݺͼग़͞Εͨ࣌ͷ μϛʔͷ໭Γ஋Λઃఆ DPDL3BNFO ͷݺͼग़͠Ҿ਺͕ ҙਤͨ͠΋ͷ͔ݕূʢWFSJGZʣ

Slide 50

Slide 50 text

SwiftyMocky 50 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. class WaiterTests: XCTestCase { func test_order() { // ४උ let mock = CockProtocolMock() mock.given(.cockRamen(bowls: .any, soup: .any, willReturn: [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)])) // ݺͼग़͠ let results = Waiter(cock: mock).order() // ݕূ XCTAssertEqual(results.count, 2) XCTAssertTrue(results.contains { $0.soup == .ে༉ }) XCTAssertTrue(results.contains { $0.soup == .ຯḩ }) mock.verify(.cockRamen(bowls: .value(2), soup: .value(.ে༉))) } } ิ׬͠΍͍͢ ิ׬͠΍͍͢

Slide 51

Slide 51 text

ϥΠϒίʔσΟϯά ʢ࣌ؒͳ͚Ε͹࠙਌ձͰʂʣ 51 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 52

Slide 52 text

·ͱΊ 52 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

Slide 53

Slide 53 text

·ͱΊ 53 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. • .PDL • ୯ମςετͳͲͰ࢖͑Δِ෺ͷΦϒδΣΫτ • ͢΂ͯࣗ࡞͢Δͷ͸ίετ • 4XJGU • ಈతϥϯλΠϜΛར༻ͨ͠.PDL͸೉͍͠ • खಈPSίʔυੜ੒ʹͳΔ • 044 • ίʔυੜ੒͕ओྲྀʹͳΓͦ͏ʁʁ

Slide 54

Slide 54 text

&OKPZUFTUXJUI.PDL 54 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.