Aleh Struneuski
Automated testing of
rest endpoints
in a less coded way
2CONFIDENTIAL
AGENDA
What is testing of REST web-services?1
Ways used to automate testing of REST web-services.2
Building your own test framework to create automated tests in the less coded way.3
Comparing test cases written in the less coded approach with others.4
What is testing of REST web-services?
4CONFIDENTIAL
TEST DATA
• ACCEPT
• USER AGENT
• ETC.
HEADERS3
1
• HOST
• PORT
• PATH
• QUERIES
• GET
• POST
• PUT
• DELETE
• ETC.
2
URL
HTTP METHOD
5CONFIDENTIAL
TYPES OF CHECKS
• JSON (specific key has an appropriate value)
• XML (specific node has appropriate attributes and value)
3
1
• 1XX
• 2XX
• 3XX
• 4XX
• 5XX
• CONTENT-TYPE
• LOCATION
• ETC.
2
HTTP STATUS CODE
RESPONSE HEADERS
RESPONSE BODY
Ways used to automate
testing of REST web-services
7CONFIDENTIAL
WAYS USED TO AUTOMATE TESTING OF REST WEB-SERVICES
Use products that are available on the market1
Create automated tests by using libraries that were initially designed for it2
Build your own test framework based on a http client from scratch3
8CONFIDENTIAL
WAYS USED TO AUTOMATE TESTING OF REST WEB-SERVICES
LEVEL OF EFFORT TO
START CREATING TESTS
LEVEL OF EFFORT TO
MAKE AUTO TESTS
LEVEL OF EFFORT TO TAILOR
SOMETHING TO YOUR NEEDS
Use products that are available
on the market
LOW HIGH LOW
Create automated tests by
using a library that was initially
designed for it
LOW HIGH MEDIUM
Build your own test framework
based on a http client
HIGH LOW HIGH
9CONFIDENTIAL
BUILDING YOUR OWN TEST FRAMEWORK
Creating automated tests cases by writing their scenarios and execution logic together in
java classes;
1
Creating automated tests cases by writing their scenarios and execution logic separately;2
Choosing the second point allows to create automated tests without coding in the future.
There are two questions:
• How to generalize execution logic?
• How to represent a format of writing tests?
10CONFIDENTIAL
REPRESENTATION OF A TEST CASE IN THE CODED LESS WAY
Comparing test cases
written in the less coded approach
to others
12CONFIDENTIAL
REST ASSURED VS. THE LESS CODED APPROACH
1
2
The test created by using the library that was initially designed for automated testing of web-services1
The test created by using the less coded approach2
13CONFIDENTIAL
REST TEMPLATE VS. THE LESS CODED APPROACH
The test created by using the library that was initially designed for automated testing of web-services1
The test created by using the less coded approach2
CONCLUSION
15CONFIDENTIAL
CONCLUSION
Real-world example of using this approach1
When/Where it can be applied2
THANK YOU!
aleh_struneuski@epam.com

Automation testing of REST endpoints in a less coded way

  • 1.
    Aleh Struneuski Automated testingof rest endpoints in a less coded way
  • 2.
    2CONFIDENTIAL AGENDA What is testingof REST web-services?1 Ways used to automate testing of REST web-services.2 Building your own test framework to create automated tests in the less coded way.3 Comparing test cases written in the less coded approach with others.4
  • 3.
    What is testingof REST web-services?
  • 4.
    4CONFIDENTIAL TEST DATA • ACCEPT •USER AGENT • ETC. HEADERS3 1 • HOST • PORT • PATH • QUERIES • GET • POST • PUT • DELETE • ETC. 2 URL HTTP METHOD
  • 5.
    5CONFIDENTIAL TYPES OF CHECKS •JSON (specific key has an appropriate value) • XML (specific node has appropriate attributes and value) 3 1 • 1XX • 2XX • 3XX • 4XX • 5XX • CONTENT-TYPE • LOCATION • ETC. 2 HTTP STATUS CODE RESPONSE HEADERS RESPONSE BODY
  • 6.
    Ways used toautomate testing of REST web-services
  • 7.
    7CONFIDENTIAL WAYS USED TOAUTOMATE TESTING OF REST WEB-SERVICES Use products that are available on the market1 Create automated tests by using libraries that were initially designed for it2 Build your own test framework based on a http client from scratch3
  • 8.
    8CONFIDENTIAL WAYS USED TOAUTOMATE TESTING OF REST WEB-SERVICES LEVEL OF EFFORT TO START CREATING TESTS LEVEL OF EFFORT TO MAKE AUTO TESTS LEVEL OF EFFORT TO TAILOR SOMETHING TO YOUR NEEDS Use products that are available on the market LOW HIGH LOW Create automated tests by using a library that was initially designed for it LOW HIGH MEDIUM Build your own test framework based on a http client HIGH LOW HIGH
  • 9.
    9CONFIDENTIAL BUILDING YOUR OWNTEST FRAMEWORK Creating automated tests cases by writing their scenarios and execution logic together in java classes; 1 Creating automated tests cases by writing their scenarios and execution logic separately;2 Choosing the second point allows to create automated tests without coding in the future. There are two questions: • How to generalize execution logic? • How to represent a format of writing tests?
  • 10.
    10CONFIDENTIAL REPRESENTATION OF ATEST CASE IN THE CODED LESS WAY
  • 11.
    Comparing test cases writtenin the less coded approach to others
  • 12.
    12CONFIDENTIAL REST ASSURED VS.THE LESS CODED APPROACH 1 2 The test created by using the library that was initially designed for automated testing of web-services1 The test created by using the less coded approach2
  • 13.
    13CONFIDENTIAL REST TEMPLATE VS.THE LESS CODED APPROACH The test created by using the library that was initially designed for automated testing of web-services1 The test created by using the less coded approach2
  • 14.
  • 15.
    15CONFIDENTIAL CONCLUSION Real-world example ofusing this approach1 When/Where it can be applied2
  • 16.

Editor's Notes

  • #2 I'm going to talk about one of some ways that can be used to automate testing of REST endpoints. Let’s get started!
  • #16 look terrible