2018 NTT DATA Corporation 24112018 Test Framework as

















- Slides: 17
© 2018 NTT DATA Corporation
24/11/2018 Test Framework as a Microservice Calin Dinis Test Automation Engineer @ NTT DATA © 2018 NTT DATA Corporation
Agenda • • • Let’s go Selenium Too much initialization Spring Boot to the rescue Enemies at the gates (external systems) Humble beginnings (mock microservices) One mock fits all (Mock. Server) The new and revised Test Framework Farewell Selenium. Hello REST API! JUnit feels so basic. I turned myself into a Cucumber! Test data with Flyway © 2018 NTT DATA Corporation
Intro © 2018 NTT DATA Corporation
Let’s go Selenium • Page class abstracts away the Web. Driver for child pages • Web. Driver is initialized once and not passed around in constructors • Awaitility is a cool tool © 2018 NTT DATA Corporation 5
• Too much initialization • Every Object needs to be initialized explicitly • Order of initialization in tester’s responsibility • Web. Driver configuration is in the Test’s responsibility © 2018 NTT DATA Corporation 6
Spring Boot to the rescue • Initialization of objects taken care of by Spring Boot • Configuration handled via application properties files • @Post. Construct for one-time initialization tasks © 2018 NTT DATA Corporation 7
Enemies at the Gates (External Systems) © 2018 NTT DATA Corporation
Humble beginnings (mocked microservices) • Mocks for every external system • Happy flow covered by default • Fault injection • Customized response injection © 2018 NTT DATA Corporation 9
One mock fits all (Mock. Server) • One mock instance for all external systems • DSL-like for configuring expectations and responses • Mock. Server library (opensource) © 2018 NTT DATA Corporation 10
The new and revised Test Framework • Spring Boot Application • Deployable unit • Runs in the virtual cluster of the Backend being tested • Rest endpoint for starting test execution © 2018 NTT DATA Corporation 11
Farewell Selenium. Hello REST API! • Selenium tests are a, very slow, magical thing • Rest API tests, not magical, but very fast • Rest API offers more than just Frontend uses © 2018 NTT DATA Corporation 12
JUnit feels so basic. I turned myself into a Cucumber • Self explanatory test-cases • Spring Boot Context and Cucumber Runtime • The feature files on the classpath © 2018 NTT DATA Corporation 13
Test data with Flyway • One mock instance for all external systems • DSL-like for configuring expectations and responses • Mock. Server library (opensource) © 2018 NTT DATA Corporation 14
Q&A on QA © 2018 NTT DATA Corporation 15
References • Mock. Server http: //www. mock-server. com/ • Awaitility https: //github. com/awaitility • Cucumber https: //www. baeldung. com/cucumber-rest-api-testing • Cucumber Spring Boot Integration https: //www. baeldung. com/cucumber-spring-integration • Flyway callbacks https: //flywaydb. org/documentation/callbacks. html • Spring Boot Tests https: //docs. spring. io/spring-boot/docs/current/reference/html/boot-features-testing. html • Selenium Web. Driver https: //www. seleniumhq. org/docs/03_webdriver. jsp • Test. Rest. Template https: //www. baeldung. com/spring-boot-testresttemplate © 2018 NTT DATA Corporation 16
© 2018 NTT DATA Corporation