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

Commit Code With Confidence

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Commit Code With Confidence

So you wrote some awesome lines of code and you're ready to commit the changes. How do you know if it breaks code you wrote last year or that your teammate wrote yesterday? How confident are you that it will not break anything in your app or in a dependency? Testing is a great way to be confident in your own code and avoid nightmares of your code breaking production.

Testing comes up often in discussions about software engineering, but when, how, and why should it be implemented? Often, the amount of testing depends on the stage of the software application and the development team. How many active users does the app have? How large is the development team? Is the app in international markets with multiple language localizations? With each increasing stage of an app and growth of the development team, automated testing becomes ever more important to ensure a quality product.

This talk will use Lookout's iOS product as an example, but the principles and learnings can be applied to any software stack.

Avatar for Stephanie Shupe

Stephanie Shupe

March 17, 2016

Other Decks in Programming

Transcript

  1. dictionary.com the means by which the presence, quality, or genuineness

    of anything is determined; a means of trial. #define testing
  2. dictionary.com the means by which the presence, quality, or genuineness

    of anything is determined; a means of trial. #define testing
  3. dictionary.com the means by which the presence, quality, or genuineness

    of software is determined; a means of trial. #define software testing
  4. wikipedia.org it requires a tester to play the role of

    an end user, and use most of all features of the application to ensure correct behavior. #define manual testing
  5. wikipedia.org it requires a tester to play the role of

    an end user, and use most of all features of the application to ensure correct behavior. #define manual testing
  6. wikipedia.org the tester often follows a written test plan that

    leads them through a set of important test cases. #define manual testing
  7. wikipedia.org the tester often follows a written test plan that

    leads them through a set of important test cases. #define manual testing
  8. wikipedia.org the use of special software to control the execution

    of tests and the comparison of actual outcomes with predicted outcomes #define automated testing
  9. wikipedia.org the use of special software to control the execution

    of tests and the comparison of actual outcomes with predicted outcomes #define automated testing
  10. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency
  11. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency iOS Server Android Web 
  12. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug
  13. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug www.slwoods.co.uk
  14. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug • Handles error scenarios
  15. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug • Handles error scenarios WHAT HAPPENS IF MY METHOD IS CALLED WITH THE WRONG PARAMETERS?
  16. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug • Handles error scenarios • Actually works as expected
  17. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug • Handles error scenarios • Actually works as expected SENDS DATA TO CORRECT SERVER 
  18. BE CONFIDENT THAT YOUR CODE • Doesn’t break pre-existing code

    • Doesn’t break a localization • Doesn’t break a dependency • Doesn’t add a bug • Handles error scenarios • Actually works as expected • Will continue to work as expected
  19. Unit Testing describe(@"+isExpired:", ^{ context(@"when date occurred in past", ^{

    beforeEach(^{ subject = [NSDate dateWithTimeIntervalSinceNow:-10]; }); it(@"should return expired", ^{ [[theValue([NSDate isExpired:subject]) should] beYes]; }); }); context(@"when date occurs in future", ^{ beforeEach(^{ subject = [NSDate dateWithTimeIntervalSinceNow:1000000]; }); it(@"should return not expired", ^{ [[theValue([NSDate isExpired:subject]) should] beNo]; }); }); });
  20. Integration Testing context(@"when a request is made with malformed data",

    ^{ it(@"should return an error", ^AsyncBlock { Request *request = [Request new]; ... expect(error).toNot.beNil(); expect(httpResponse.statusCode).to.equal(500); [client enqueueRequest:request]; }); });
  21. Testing @Lookout • Part of our code review process •

    Devs write tests with code changes • Automation engineers write UI automation tests
  22. Testing @Lookout • All automated test suites run • before

    code can be pushed to master • after merge to master