testing 101
TRANSCRIPT
TESTING 101ELANGO BALUSAMY
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
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
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)
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)
TESTING 101
UNIT TESTING IN SMART FOLIOSTEST DATA
TEST SETUPASSERTION
TESTING 101
INTEGRATION TESTING IN SMART FOLIOS
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)
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)
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.