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

6 years of test automation
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

6 Years of Test Automation

  • @mikeb2701
slide-2
SLIDE 2

Assumptions

  • Testing is important
  • Automating testing is important
slide-3
SLIDE 3

Types of tests

  • Static Analysis
  • Unit Testing
  • Integration Testing
  • Acceptance Testing
  • Performance Testing
  • Testing in Live
  • Exploratory Testing
slide-4
SLIDE 4

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

slide-5
SLIDE 5

Writing Acceptance Tests

slide-6
SLIDE 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");

slide-7
SLIDE 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");

slide-8
SLIDE 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");

slide-9
SLIDE 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");

slide-10
SLIDE 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");

slide-11
SLIDE 11

DSL

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

Drivers

slide-12
SLIDE 12

Time Travel

slide-13
SLIDE 13

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

slide-14
SLIDE 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");
slide-15
SLIDE 15

Pro-Tip:

Isolate as much as possible

slide-16
SLIDE 16

Simple DSL

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

slide-17
SLIDE 17

Acceptance Testing (Running)

slide-18
SLIDE 18

RTA Parallel Sequential Sequential Sequential RTA RTA RTA Scotty Romero Server Jenkins

slide-19
SLIDE 19
slide-20
SLIDE 20
slide-21
SLIDE 21

Intermittency

avp.wikia.com

slide-22
SLIDE 22

Sources of Intermittency

  • Bad code (under test)
  • Bad test
  • Environmental
slide-23
SLIDE 23

Just Fix It!

slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28
slide-29
SLIDE 29

Acceptance Test DB

slide-30
SLIDE 30
slide-31
SLIDE 31
slide-32
SLIDE 32

Wrap-Up

  • Write them well
  • Run them often
  • Keep them green
slide-33
SLIDE 33

Thank you

Q&A