@mokagio

Talking myself into the value of acceptance testing

Before we begin...

Acceptance Test

!=

Unit Test

DO. WRITE.

UNIT. TESTS.

Acceptance Test

!=

Automated Test

Having the intern make sure that when logging in with Facebook the profile picture is the set correctly

🏃

is a test for an acceptance criteria

⌘U, Xcode Bots, Travis CI, Jenkins, etc, can be used to run unit tests automatically

Automated Acceptance Tests

=

Acceptance tests run automatically

This talk is about (automated) acceptance tests

Content

😞

😊

👪

🚀

😞

Long to write

Slow to run

Expensive to maintain

Still need QA

Apple doesn't care

😊

"State-intense" & "many-branches" apps

Refactoring legacy spaghetti code

The client with the JIRA board and the acceptance criterias

👪

👍

big-medium teams with clear requirements and relaxed deadlines

👎

small/one man teams with green product and need for fast pace

Just try it out and see how it goes

🚀

UIAutomation

Apple UI Testing

Apple UI Testing

/**
 * When I tap the "say hello" button, I see a greetings alert.
 */
testSayHello() {
  let app = XCUIApplication()
  app.buttons["say hello"].tap()
  app.alerts["Hello"].collectionViews.buttons["Dismiss"].tap()
}

Apple UI Testing

/**
 * When I tap the "show elementes" button, I see the list with 
 * the elements of the periodic table.
 */
testShowElements() {
  let app = XCUIApplication()
  app.buttons["show elements"].tap()

  XCTAssertEqual(app.tables.count, 1)

  let table = app.tables.elementAtIndex(0)
  let periodicTableElementsCount: UInt = 118
  XCTAssertEqual(table.cells.count, periodicTableElementsCount)
}

KIF

KIF

describe(@"Main screen", ^{
  context(@"when I tap the 'say hello' button", ^{
    before(^{
      [tester tapViewWithAccessibilityLabel:kSayHello];
    });

    it(@"I see a greetings alert", ^{
      [tester waitForViewWithAccessibilityLabel:kHelloAlertTitle];
      [tester waitForViewWithAccessibilityLabel:kHelloAlertMessage];
      [tester waitForViewWithAccessibilityLabel:kHelloAlertButton];
    });
  });
});

Calabash

and

Appium

Were do I begin?

Add an acceptance test for the most important feature

Add an acceptance test for every new bug fix

"A bug is only a test that hasn't been written yet"

- I don't know who said this

Where to go from here

And remember...

DO. WRITE.

UNIT. TESTS.

Thanks

🎉