testing 101

10
TESTING 101 ELANGO BALUSAMY

Upload: elango-balusamy

Post on 16-Apr-2017

40 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Testing 101

TESTING 101ELANGO BALUSAMY

Page 2: Testing 101

TESTING 101

WHAT ARE WE COVERING TODAY

▸ Why do we have to automate testing

▸ What are the qualities of a good test

▸ What are the different types of testing methods

▸ Real tests

▸ Strategy for legacy applications

Page 3: Testing 101

TESTING 101

WHY DO WE HAVE TO AUTOMATE TESTING ?

▸ Repetitive and causes fatigue

▸ Time consuming

▸ Developers are usually gentle on what they have developed

▸ Under delivery pressure

Page 4: Testing 101

TESTING 101

QUALITIES OF A GOOD TEST

▸ Repeatable: Able to run it several times with ease

▸ Easily Understandable: Don’t put too much logic in test => 1+2 = 3

▸ Specific: A failure should indicate a narrow spectrum where things could have gone wrong

▸ Fast: Gives feedback within minutes (and not hours)

Page 5: Testing 101

TESTING 101

TYPES OF TESTS

▸ Unit TestingSmallest function tested in isolation(public methods in a class)

▸ Integration/Acceptance TestingFunctionality as seen by end user(features - Bonds, OCBC, Real Estate, Sync)

Page 6: Testing 101

TESTING 101

UNIT TESTING IN SMART FOLIOSTEST DATA

TEST SETUPASSERTION

Page 7: Testing 101

TESTING 101

INTEGRATION TESTING IN SMART FOLIOS

Page 8: Testing 101

TESTING 101

INTEGRATION TEST SETUP

▸ Launch script

▸ Set environment to “testing”

▸ Use test database from Tests folder

▸ Use Api-data from different folder

▸ Kills existing server and test runtime (if running)

▸ Start server

▸ Insert seed data (user, daily exchange rates and equity master)

▸ Run test

▸ Clean up (delete test db, reset environment to development)

Page 9: Testing 101

TESTING 101

WHAT MAKES AN INTEGRATION TEST

▸ Feature test written in English sentences(feature_name.feature)

▸ Map the sentences to method calls in python (testing.py)

▸ Launch Browser

▸ Background (test data and test setup)

▸ Login

▸ Scenario (assertion)

Page 10: Testing 101

TESTING 101

STRATEGY FOR LEGACY APPLICATIONS

▸ Start adding integration tests to cover key flows

▸ All new features should have associated integration tests. This will be ensured as part of code review.

▸ Integrate integrations tests with code review process

▸ Dev team to take ownership of tests and not rely on one person.