API Level Regression
Testing: a Field Report
Leonhard Holzer & Kurt Ranalter
SFScon 2018
Mission statement
• Software company from Bruneck-Brunico
• BI, quality control & production planning tools
• Customers: automotive industry, local business
• Agile, CI/CD: continuous integration & delivery
• One of our aims is to deliver high quality SW
• Testing is crucial to avoid breaking functionality
• But testing is not for free, it costs time and effort
• Apit: our API level regression testing framework
API level regression testing 2SFScon 2018
Example application
API level regression testing 3SFScon 2018
Issues & challenges
• Page dependencies
• PNL & balance → cash flow
• Accruals → PNL & balance
• Input dependencies
• Drilldowns & data aggregation
• Aggregated row ↔ data row
(→) depending on reference column
• TY column ↔ month column
(→) based on month, working days
API level regression testing 4SFScon 2018
Behind the scenes
Post request Get request
SFScon 2018 API level regression testing 5
Architecture & testing
• Focus on testing business logic
• End-to-end testing not really an option
• Usual solution: unit & integration tests
• Requires extensive setup and mocking
• Why not make use of REST API?
• Simulate usage as in end-to-end testing
• Business logic considered as black box
• Not a substitute but complementary
SFScon 2018 API level regression testing 6
Apit DSL for requests
Post request Apit test case
SFScon 2018 API level regression testing 7
How does it work?
• In a nutshell
1. Add framework as library
2. Read and parse config files
3. Run as JUnit5 dynamic tests
• Build pipeline
1. DB/auth as docker container
2. Tests just run as maven goals
API level regression testing 8SFScon 2018
Concluding remarks
• Design decisions & supported features
• Exploit framework to generate necessary test data
• Actual/expected as JSON (WIP: git to track changes)
• Payloads from file instead of coding it into config
• Parameters for testing in multiple environments
• Quick & easy to use but still powerful
• No need for mocking, relatively simple to maintain
• Good integration with respect to our build pipeline
API level regression testing 9SFScon 2018
That‘s it, thanks!
www.abuscom.com
info@abuscom.com
API level regression testing 10SFScon 2018

SFScon18 - Kurt Ranalter - Leonhard Holzer - API level regression testing: a field report

  • 1.
    API Level Regression Testing:a Field Report Leonhard Holzer & Kurt Ranalter SFScon 2018
  • 2.
    Mission statement • Softwarecompany from Bruneck-Brunico • BI, quality control & production planning tools • Customers: automotive industry, local business • Agile, CI/CD: continuous integration & delivery • One of our aims is to deliver high quality SW • Testing is crucial to avoid breaking functionality • But testing is not for free, it costs time and effort • Apit: our API level regression testing framework API level regression testing 2SFScon 2018
  • 3.
    Example application API levelregression testing 3SFScon 2018
  • 4.
    Issues & challenges •Page dependencies • PNL & balance → cash flow • Accruals → PNL & balance • Input dependencies • Drilldowns & data aggregation • Aggregated row ↔ data row (→) depending on reference column • TY column ↔ month column (→) based on month, working days API level regression testing 4SFScon 2018
  • 5.
    Behind the scenes Postrequest Get request SFScon 2018 API level regression testing 5
  • 6.
    Architecture & testing •Focus on testing business logic • End-to-end testing not really an option • Usual solution: unit & integration tests • Requires extensive setup and mocking • Why not make use of REST API? • Simulate usage as in end-to-end testing • Business logic considered as black box • Not a substitute but complementary SFScon 2018 API level regression testing 6
  • 7.
    Apit DSL forrequests Post request Apit test case SFScon 2018 API level regression testing 7
  • 8.
    How does itwork? • In a nutshell 1. Add framework as library 2. Read and parse config files 3. Run as JUnit5 dynamic tests • Build pipeline 1. DB/auth as docker container 2. Tests just run as maven goals API level regression testing 8SFScon 2018
  • 9.
    Concluding remarks • Designdecisions & supported features • Exploit framework to generate necessary test data • Actual/expected as JSON (WIP: git to track changes) • Payloads from file instead of coding it into config • Parameters for testing in multiple environments • Quick & easy to use but still powerful • No need for mocking, relatively simple to maintain • Good integration with respect to our build pipeline API level regression testing 9SFScon 2018
  • 10.