Slide 1

Slide 1 text

New Features of XCTest on Xcode 6 Tsuyoshi Yamamoto

Slide 2

Slide 2 text

New Features w ඇಉظςετ༻ͷ"1* 9$5FTU&YQFDUBUJPOΫϥε FYQFDUBUJPO8JUI%FTDSJQUJPOͳͲͷ"1* ! w ύϑΥʔϚϯεଌఆ༻ͷ"1* NFBTVSF#MPDLT΍ɺ NFBTVSF.FUSJDTͳͲͷ"1*

Slide 3

Slide 3 text

APIs for Asynchronous Testing w 9$5FTU&YQFDUBUJPO ඇಉظͳৼΔ෣͍Λςετ͢Δͱ͖ɺ ظ଴௨Γʹ࣮ߦ͞Ε͔ͨΛධՁ͢ΔΫϥε ! GVMpMM͕ݺͼग़͞ΕΕ͹ظ଴௨Γͱ൑ఆ

Slide 4

Slide 4 text

APIs for Asynchronous Testing w XBJU'PS&YQFDUBUJPO8JUI5JNFPVU ඇಉظͳৼΔ෣͍Λ࣮ߦ͍ͯ͠Δؒɺ 3VO-PPQΛճ͠ଓ͚ͯXBJU͢ΔͨΊͷ"1* ! 9$5FTU&YQFDUBUJPO͕ظ଴௨Γʹಈ͍ͨͱ ൑ఆ͞ΕΔ͔ɺλΠϜΞ΢τ͢Δ·Ͱ଴ػ

Slide 5

Slide 5 text

Sample for Asynchronous Testing - (void)testDocumentOpening { XCTestExpectation *expect = [self expectationWithDescription:@“open”]; ! UIDocument *doc = ...; ! [doc openWithCompletionHandler:^(BOOL success) { XCTAssert(success); [expect fulfill]; } ! [self waitForExpectationsWithTimeout:5.0 handler:nil]; }

Slide 6

Slide 6 text

Sample for Asynchronous Testing - (void)testDocumentOpening { XCTestExpectation *expect = [self expectationWithDescription:@“open”]; ! UIDocument *doc = ...; ! [doc openWithCompletionHandler:^(BOOL success) { XCTAssert(success); [expect fulfill]; } ! [self waitForExpectationsWithTimeout:5.0 handler:nil]; }

Slide 7

Slide 7 text

Other Expectations XCTestCase+AsynchronousTesting.hʹɺ Convenience APIsͱͯ͠௥Ճ͞Ε͍ͯͨAPI ! - keyValueObservingExpectationForObject: keyPath: expectedValue: ! - keyValueObservingExpectationForObject: keyPath: handler: ! - expectationForNotification: object: handler:

Slide 8

Slide 8 text

APIs for Performance Testing w NFBTVSF#MPDL Ҿ਺ͱͯ͠౉͞Εͨଌఆ༻ͷ#MPDLTΛ ճ࣮ߦ͠ɺ#MPDLTશମͷ  ฏۉ࣮ߦ࣌ؒ  ࣮ߦ࣌ؒͷ͹Β͖ͭ౓߹͍ʢඪ४ภࠩʣ Λ#BTF-JOFͱൺֱ͠ɺ ςετͷ4VDDFTT'BJMVSFΛධՁ͢Δ ! #BTF-JOFύϑΥʔϚϯεධՁ࣌ͷج४ɻ ɹҎલ࣮ߦͨ͠ςετ݁ՌͳͲΛݩʹઃఆͰ͖Δ

Slide 9

Slide 9 text

Sample for Performance Testing - (void)testDocumentOpeningPerformance { TestTargetClass *target = [TestTargetClass new]; ! [self measureBlock:^{ [target openFile]; [target parse]; [target closeFile]; }]; }

Slide 10

Slide 10 text

Sample for Performance Testing - (void)testDocumentOpeningPerformance { TestTargetClass *target = [TestTargetClass new]; ! [self measureBlock:^{ [target openFile]; [target parse]; [target closeFile]; }]; }

Slide 11

Slide 11 text

Other Measurement w NFBTVSF.FUSJDT Ҿ਺ͱͯ͠౉ͨ͠ଌఆ༻#MPDLTͷ͏ͪɺ ܭଌ͍ͨ͠ՕॴΛίʔυͰࢦఆͰ͖Δɻ ! ଞͷ಺༰͸NFBTVSF#MPDLͱಉ͡

Slide 12

Slide 12 text

Sample for Performance Testing - (void)testDocumentOpeningPerformance { TestTargetClass *target = [TestTargetClass new]; ! [self measureMetrics: [[self class] defaultPerformanceMetrics] automaticallyStartMeasuring:NO forBlock:^{ [target openFile]; [self startMeasuring]; [target parse]; [self stopMeasuring]; [target closeFile]; }]; }

Slide 13

Slide 13 text

Sample for Performance Testing - (void)testDocumentOpeningPerformance { TestTargetClass *target = [TestTargetClass new]; ! [self measureMetrics: [[self class] defaultPerformanceMetrics] automaticallyStartMeasuring:NO forBlock:^{ [target openFile]; [self startMeasuring]; [target parse]; [self stopMeasuring]; [target closeFile]; }]; }

Slide 14

Slide 14 text

Happy Testing!! This Slide uses Azusa Template