Skip to content

Latest commit

ย 

History

History
175 lines (88 loc) ยท 2.54 KB

What's New in Testing.md

File metadata and controls

175 lines (88 loc) ยท 2.54 KB

@ WWDC 18

Code Coverage

Code Coverage

  • Xcode 9.3
  • Performance and accuracy
  • Target selection
  • xccov
  • Source editor

Time to Load

๋งŽ์ด ๋งŽ์ด ์ค„์Œ!

File Size

๋งŽ์ด ๋งŽ์ด ์ค„์Œ!

Target Selection

  • Code Coverage
    • Enabled for all targets
    • Enabled for selected targets
    • Disabled

xccov

  • Command line tool
  • Output formats
    • Human-readable
    • Machne-parseable (JSON)
  • View coverage data

Coverage Data

image

code coverage๊ฐ€ enabled๋œ ์ƒํƒœ์—์„œ xcode๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด ์œ„์™€ ๊ฐ™์ด ๋‘ ๊ฐœ์˜ ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

  • Derived data
  • Result bundle

Xcode๋ฅผ ์ด์šฉํ•ด์„œ ์–ด๋–ค ํƒ€๊ฒŸ์„ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๊ฐ€ ์–ผ๋งŒํผ ์ปค๋ฒ„ํ•˜๊ณ  ์žˆ๋Š”์ง€ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๋‹ค.

Test selection and ordering

Test Selection

  • Not all tests are equal
    • 1000 unit tests
    • 10 UI tests
  • Different tests in different situations
    • Pre-commit
    • Nightly

Test selection with Schemes

  • "Tests to skip"
    • Automatically includes new tests
  • "Tests to run"
    • Explicit opt-in for tests

Test Ordering

  • Alphabetical
    • Default
    • Deterministic
    • Can hide implicit dependencies
  • Randomized
    • Nondeterministic
    • Can uncover implicit dependencies

Parallel Testing

image

image

image

Parallel Destination Testng - ํ•œ๊ณ„ ์กด์žฌ!

  • Only beneficial if testing on multipl destinations
  • Only available from xcodebuild

Parallel Distributed Testing

image

Testiing Architecture

Your App + Test Bundle = Runner

image

Classes Execute in Parallel

  • Hidden dependencies between tests iin a class
  • Avoid unnecessary +setUp and +tearDown computation

Parallel Testing on Simulator

  • Original simulator is not used duriing testing
  • Separate data containers

image

Demo Recap

  • Enabling parallelization
  • Viewing results in the test log and test report
  • Multiple instances of a Mac app running unit tests
  • Multiple simulator clones running UI tests

xcodebuild

  • Override the number of workers
-parallel-testing-worker-count n
  • Force parallel testing on or off
-parallel-testing-enabled YES | NO

Tips and Tricks

  • Consider splitting a long running class into two classes
  • Put performance tests into their own bundle, with parallelization disabled
  • Understand which tests are not safe for parallelization