6 years of test automation
play

6 Years of Test Automation @mikeb2701 Assumptions Testing is - PowerPoint PPT Presentation

6 Years of Test Automation @mikeb2701 Assumptions Testing is important Automating testing is important Types of tests Static Analysis Unit Testing Integration Testing Acceptance Testing Performance Testing


  1. 6 Years of Test Automation � @mikeb2701

  2. Assumptions • Testing is important • Automating testing is important

  3. Types of tests • Static Analysis • Unit Testing • Integration Testing • Acceptance Testing � • Performance Testing • Testing in Live • Exploratory Testing

  4. An acceptance test may only drive and assert behaviour in the system through interfaces available to the system’s users.

  5. Writing Acceptance Tests

  6. @RunWith(AcceptanceTestRunner.class) @Multithreaded @AcceptanceTest(id = 29, flavour = {Flavour.PLACE_ORDER, Flavour.API}) public class PlaceOrderAcceptanceTest extends DslTestCase { � @Before public void beforeEveryTest() { � adminAPI.createInstrument("name: instrument”, "orderQuantityIncrement: 0.1”,…); registrationAPI.createUser("user", "balance: 100000"); mtfMemberAPI.createMtfMemberAndFixSession("marketMaker"); publicAPI.login("user"); mtfFixAPI.login(“marketMaker"); } // end � @Test public void shouldRejectOrderIfNotLoggedIn() { publicAPI.logout(); publicAPI.placeOrder(“instrument", "side: buy", "quantity: 1.2”, "timeInForce: ImmediateOrCancel”, "unauthorised: true"); �

  7. @RunWith(AcceptanceTestRunner.class) @Multithreaded @AcceptanceTest(id = 29, flavour = {Flavour.PLACE_ORDER, Flavour.API}) public class PlaceOrderAcceptanceTest extends DslTestCase { � @Before public void beforeEveryTest() { � adminAPI.createInstrument("name: instrument”, "orderQuantityIncrement: 0.1”,…); registrationAPI.createUser("user", "balance: 100000"); mtfMemberAPI.createMtfMemberAndFixSession("marketMaker"); publicAPI.login("user"); mtfFixAPI.login(“marketMaker"); } // end � @Test public void shouldRejectOrderIfNotLoggedIn() { publicAPI.logout(); publicAPI.placeOrder(“instrument", "side: buy", "quantity: 1.2”, "timeInForce: ImmediateOrCancel”, "unauthorised: true"); �

  8. @RunWith(AcceptanceTestRunner.class) @Multithreaded @AcceptanceTest(id = 29, flavour = {Flavour.PLACE_ORDER, Flavour.API}) public class PlaceOrderAcceptanceTest extends DslTestCase { � @Before public void beforeEveryTest() { � adminAPI.createInstrument("name: instrument”, "orderQuantityIncrement: 0.1”,…); registrationAPI.createUser("user", "balance: 100000"); mtfMemberAPI.createMtfMemberAndFixSession("marketMaker"); publicAPI.login("user"); mtfFixAPI.login(“marketMaker"); } // end � @Test public void shouldRejectOrderIfNotLoggedIn() { publicAPI.logout(); publicAPI.placeOrder(“instrument", "side: buy", "quantity: 1.2”, "timeInForce: ImmediateOrCancel”, "unauthorised: true"); �

  9. @RunWith(AcceptanceTestRunner.class) @Multithreaded @AcceptanceTest(id = 29, flavour = {Flavour.PLACE_ORDER, Flavour.API}) public class PlaceOrderAcceptanceTest extends DslTestCase { � @Before public void beforeEveryTest() { � adminAPI.createInstrument("name: instrument”, "orderQuantityIncrement: 0.1”,…); registrationAPI.createUser("user", "balance: 100000"); mtfMemberAPI.createMtfMemberAndFixSession("marketMaker"); publicAPI.login("user"); mtfFixAPI.login(“marketMaker"); } // end � @Test public void shouldRejectOrderIfNotLoggedIn() { publicAPI.logout(); publicAPI.placeOrder(“instrument", "side: buy", "quantity: 1.2”, "timeInForce: ImmediateOrCancel”, "unauthorised: true"); �

  10. @RunWith(AcceptanceTestRunner.class) @Multithreaded @AcceptanceTest(id = 29, flavour = {Flavour.PLACE_ORDER, Flavour.API}) public class PlaceOrderAcceptanceTest extends DslTestCase { � @Before public void beforeEveryTest() { � adminAPI.createInstrument("name: instrument”, "orderQuantityIncrement: 0.1”,…); registrationAPI.createUser("user", "balance: 100000"); mtfMemberAPI.createMtfMemberAndFixSession("marketMaker"); publicAPI.login("user"); mtfFixAPI.login(“marketMaker"); } // end � @Test public void shouldRejectOrderIfNotLoggedIn() { publicAPI.logout(); publicAPI.placeOrder(“instrument", "side: buy", "quantity: 1.2”, "timeInForce: ImmediateOrCancel”, "unauthorised: true"); �

  11. DSL Drivers LoginPanel Driver BalancesPanel Driver Selenium Test TradingUI InstrumentPanel Driver PublicAPI JavaAPI Driver XML/HTTP AdminAPI AdminAPI Driver QuickFIX MtfFixDriver MtfMemberAPI

  12. Time Travel

  13. Time Travel To Time Test Machine Get Current Time Delta Time Service Service Service Service Service

  14. @RunWith(AcceptanceTestRunner.class) @AcceptanceTest(id = 5194, flavour = {Flavour.PLACE_ORDER, Flavour.API}) @Multithreaded(tardis = true) public class CancelAndReplaceAcceptanceTest extends DslTestCase { @Before public void setUp() { dsl.forceToUtcTimeZone(); dsl.enableTimeMachine(); � dsl.createTimePoint("name: origin”, "value: <next weekday>"); dsl.createTimePoint("name: marketOpen", "value: origin plus 1 weekdayCalendarOpenOffset”); � dsl.waitUntil("marketOpen");

  15. Pro-Tip: Isolate as much as possible

  16. Simple DSL https://github.com/LMAX-Exchange/Simple-DSL

  17. Acceptance Testing (Running)

  18. Jenkins Romero Scotty Server Parallel RTA Sequential RTA Sequential RTA Sequential RTA

  19. Intermittency avp.wikia.com

  20. Sources of Intermittency • Bad code (under test) • Bad test • Environmental

  21. Just Fix It!

  22. Acceptance Test DB

  23. Wrap-Up • Write them well • Run them often • Keep them green

  24. Thank you Q&A

Recommend


More recommend