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

Better AppStore rating

Khoa Pham
February 06, 2020

Better AppStore rating

- Automate screenshot capturing
- AppStore review
- BDD testing with Spek
- Automate with Puma

Khoa Pham

February 06, 2020
Tweet

More Decks by Khoa Pham

Other Decks in Programming

Transcript

  1. BETTER
    APPSTORE
    RATING

    View full-size slide

  2. ABOUT
    > Khoa Pham
    > https://onmyway133.github.io/

    View full-size slide

  3. AGENDA
    > AppStore rating
    > Automate screenshot
    > Advertisements

    View full-size slide

  4. RATING AND REVIEW

    View full-size slide

  5. RATING AND REVIEW
    > Rate 1 to 5 stars
    > Optionally write a review
    > Specific to each country on the App Store
    > Can reset summary rating when submit new version
    release
    > Past written reviews remain

    View full-size slide

  6. ASK
    import StoreKit
    SKStoreReviewController.requestReview()

    View full-size slide

  7. TRACK USER REVIEW?
    > Use provided dialog
    > Can request max 3 times a year
    > Out of process, not available to view debugging or
    other inspections

    View full-size slide

  8. TIPS
    > Respond to reviews
    > Prioritize reviews
    > Choose when to ask
    > Link to AppStore review page
    > A/B testing

    View full-size slide

  9. RESPOND TO REVIEWS

    View full-size slide

  10. DEMO RATING
    > Feature toggling
    > Dependency injection
    > Conditions
    > Periodic
    > Unit Testing

    View full-size slide

  11. SPEK
    https://github.com/onmyway133/Spek
    BDD function builder testing framework in Swift

    View full-size slide

  12. SPEK
    import XCTest
    @testable import Spek
    final class SpekTests: XCTestCase {
    func testExample() {
    var left = 1
    var right = 1
    spec {
    Describe("math") {
    BeforeEach {
    left = 2
    }
    Describe("basic") {
    BeforeEach {
    right = 3
    }
    AfterEach {
    }
    It("adds correctly") {
    XCTAssertEqual(left + right, 5)
    }
    It("multiplies correctly") {
    XCTAssertEqual(left * right, 6)
    }
    }
    }
    }
    }
    }

    View full-size slide

  13. AUTOMATE SCREENSHOTS

    View full-size slide

  14. SCENARIOS
    n languages * m screen sizes

    View full-size slide

  15. XCATTACHMENT
    func takeScreenshot(_ name: String) {
    let screenshot = XCUIScreen.main.screenshot()
    let attachment = XCTAttachment(screenshot: screenshot)
    attachment.lifetime = .keepAlways
    attachment.name = name
    add(attachment)
    }

    View full-size slide

  16. UITESTS SCHEME
    > Run and Test actions
    > Application data
    > Routing App Coverage File
    > Application language
    > Application region

    View full-size slide

  17. LAUNCH ARGUMENTS
    final class ScreenshotUITests: XCTestCase {
    var app: XCUIApplication!
    override func setUp() {
    continueAfterFailure = false
    app = XCUIApplication()
    app.launchArguments.append("--uitesting")
    app.launch()
    }
    }

    View full-size slide

  18. XCRESULT
    Xcode 11 release notes
    The format of result bundles changed in Xcode 11. A result
    bundle is an asset produced by Xcode 11 with the
    xcresult file extension that contains information about
    the build, tests, code coverage, and more

    View full-size slide

  19. XCRESULTTOOL
    xcresulttool get --format json --path ./Example.xcresult

    View full-size slide

  20. TESTING IN XCODE 11
    WWDC 2019 Testing in Xcode
    > Test plan
    > Gather screenshots for localization

    View full-size slide

  21. DEMO UITESTS
    > XCTContext
    > Swizzle
    > Parallel on multiple simulators

    View full-size slide

  22. PUMA
    https://github.com/pumaswift/Puma

    View full-size slide

  23. PUMA SCREENSHOT TASK
    Screenshot {
    $0.configure(
    projectType: .project("TestApp"),
    appScheme: "TestApp",
    uiTestScheme: "TestAppUITests",
    saveDirectory: Directory.downloads.appendingPathComponent("PumaScreenshots").path
    )
    $0.add(scenarios: [
    .init(
    destination: .init(
    name: Destination.Name.iPhone11,
    platform: Destination.Platform.iOSSimulator,
    os: Destination.OS.iOS13_2_2
    ),
    language: Language.en_US,
    locale: Locale.en_US
    ),
    .init(
    destination: .init(
    name: Destination.Name.iPhone11Pro,
    platform: Destination.Platform.iOSSimulator,
    os: Destination.OS.iOS13_2_2
    ),
    language: Language.ja,
    locale: Locale.ja
    )
    ])
    }

    View full-size slide

  24. BUILD TOOL WITH PUMA
    swift package init --type executable
    swift package generate-xcodeproj
    swift build
    swift run

    View full-size slide

  25. READ MORE
    > Ratings, Reviews, and Responses

    View full-size slide

  26. THANKS
    May your code continue to compile

    View full-size slide