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 Slide

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

    View Slide

  3. AGENDA
    > AppStore rating
    > Automate screenshot
    > Advertisements

    View Slide

  4. RATING AND REVIEW

    View 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 Slide

  6. ASK
    import StoreKit
    SKStoreReviewController.requestReview()

    View 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 Slide

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

    View Slide

  9. RESPOND TO REVIEWS

    View Slide

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

    View Slide

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

    View 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 Slide

  13. AUTOMATE SCREENSHOTS

    View Slide

  14. SCENARIOS
    n languages * m screen sizes

    View 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 Slide

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

    View 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 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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View 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 Slide

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

    View Slide

  25. READ MORE
    > Ratings, Reviews, and Responses

    View Slide

  26. THANKS
    May your code continue to compile

    View Slide