Pro Yearly is on sale from $80 to $50! »

Have you ever tested your tests?

Have you ever tested your tests?

6c63aa49d093296885859211d1991962?s=128

Rafael Machado

November 09, 2019
Tweet

Transcript

  1. HAVE YOU EVER TESTED YOUR TESTS?

  2. Henrique Morbin iOS @ Consumer

  3. Rafael Machado iOS @ Driver

  4. AGENDA 1. SOFTWARE QUALITY & METRICS 2. CODE COVERAGE 3.

    MUTATION TESTING 4.MUTER: AUTOMATED MUTATION TESTING FOR SWIFT
  5. SOFTWARE QUALITY & METRICS

  6. CODE COVERAGE

  7. None
  8. class Tests: XCTestCase { func test_view() { let sut =

    ViewController(presenter: .dummy) XCTAssertNotNil(sut.view) } }
  9. 55% VALIDATION

  10. COVERAGE ISN’T EVERYTHING

  11. ?

  12. MUTATION TESTING

  13. HOW DOES IT WORK?

  14. None
  15. None
  16. None
  17. MUTATION SCORE = Mutants killed Total of mutants

  18. MUTATION OPERATORS

  19. None
  20. C# JAVASCRIPT JAVA PYTHON SWIFT C/C++ OBJECTIVE-C

  21. Muter Automated mutation testing for Swift

  22. DISCOVERY TESTS REPORT

  23. None
  24. $ muter init

  25. !// muter.conf.json { "executable": “/usr/bin/xcodebuild", "arguments": [ "-project", "ExampleApp.xcodeproj", "-scheme",

    "ExampleApp", "-sdk", "iphonesimulator", "-destination", "platform=iOS Simulator,name=iPhone 8", "test" ], "exclude": ["AppDelegate.swift"] }
  26. $ muter

  27. $ muter —output-xcode

  28. None
  29. $ muter —files-to-mutate "/Sources/**/*.swift"

  30. $ muter —files-to-mutate \ $(echo \"$(git diff "--name-only HEAD HEAD~1

    | tr '\n' ‘,')\")
  31. RECAP COVERAGE ISN’T EVERYTHING PAPERS HIGH COST MUTATION SCORE FEW

    OPERATORS ARE ENOUGH
  32. THANK YOU

  33. #VemProiFood