Learn API Testing: Norms, Practices, and Guidelines for Building Effective Test Automation

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Explore software web application architecture, API testing, coding practices, and the standards for better API test automation development and management. This book focuses on aspiring software testing engineers currently working in API testing, and those starting their journey in the field of software testing.

You’ll begin with an introduction to API testing and software web applications involving APIs. The book then moves on to the authentication standards used in the software industry, and the tools, the frameworks, and the libraries used in API testing. As the book progresses, you’ll learn about the test pyramid, how to test an API, what makes a good test script, and various coding guidelines. Finally, you get to write your own API test script.  

Learn API Testing is your pathway to understanding a typical software web application, its requests and responses, and the properties of a good test script. 

What You’ll learn

  • Examine practices, standards, and guidelines for effective test automation
  • Work with different tools like RestAssured, Curl, and Postman
  • Understand API testing paradigm (internal/external APIs, CDCT)
  • Review a case study on the industrial software API testing process
  • Organize a test framework

Who This Book Is For

API testing aspirants, developers/architects, project managers, and non-technical team members who may want to understand how APIs are being tested.


Author(s): Jagdeep Jain
Edition: 1
Publisher: Apress
Year: 2022

Language: English
Commentary: Vector PDF
Pages: 245
Tags: Software Web Application Testing; API Testing; Coding Practices; Test Automation; Software Testing Engineers; RestAssured; cURL; Postman

Table of Contents
About the Author
About the Technical Reviewers
Acknowledgments
Introduction
Chapter 1: Introduction to API Testing
What Is API Testing?
Need
Types of API Testing
Advantages
Summary
Chapter 2: Web Application Architecture
Web Applications Defined
Monolithic vs. Microservices Architecture
Designing Test Strategies
RESTful Architecture
HTTP
Headers
Requests
Request Methods
Resource Addresses
Request Headers
Request Body
Response
Status Line
Response Header
Response Body
Response Codes
Summary
Chapter 3: Authentication
HTTP Authentication
Basic Authentication
Session-Based Authentication
Token/JWT-Based Authentication
OAuth2-Based Authentication
Authorization
RBAC
ABAC
Authentication and Authorization Services
Summary
Chapter 4: Tools, Frameworks, and Libraries
API Testing Tools
cURL
Authentication
POST
GET
PUT
DELETE
Postman
Workspace
Globals/Environments
Collection
Authentication
Parameters
Assertions
Requests
HTTP Methods
Authentication
Variables
Console
POST
GET
PUT
DELETE
RestAssured
Frameworks/Libraries
TestNG
Log4j
Jackson-Databind
HashMap
Assertj
Java Spring
Summary
Chapter 5: Test Pyramid
Black Box Testing
Grey Box Testing
White Box Testing
Test Pyramid
Summary
Chapter 6: Testing the API
Workflows/Use Cases/Test Script
Schema Validation
Test Coverage
Header Testing
Request Header
Correct Header
Missing Header
Incorrect Header
Unsupported Type
Response Header
Supported Type
Response Codes
Request Body
Format Unsupported
Special Characters
Very Long Strings
Invalid Method
Invalid Value
Incorrect Data Type
Empty Data/Object
Required Fields
Null
Redundant Fields
DELETE Already Deleted Entity
Duplicate Check
Response Body
Actual Data vs. Expected Data
Limit/Size/Pagination/Sorting
API Version Testing
Internal vs. External APIs
Consumer-Driven Contract Testing
Importance of Negative Testing
Summary
Chapter 7: A Good Test Script
Components of a Test Script
setup()
test()
teardown()
Guidelines
Single-Attempt Test
Document Test Objective
Keep It Small
Use assertj for Assertions
Use log4j
Order of Tests
No Interventions Between Test Steps
Avoid Hard Sleeps
Always Use Assertions
Do Not Overtest
Do Not Import a Test into Another Test
Test Boundaries
API Test Coverage
Provide Short Commands
Do not try{} catch{}
Summary
Chapter 8: Coding Guidelines
Coding Best Practices
Class Naming Conventions
Method Naming Conventions
Variable Naming Conventions
Constant Naming Conventions
Provide User Actions
Simplicity
Indentation
Test Assertions
Test Class Naming Conventions
Test Method Naming Conventions
Test Package Naming Conventions
Documentation
Summary
Chapter 9: Organize a Test Framework
Framework Requirements
Request
Response
Exception
Configuration
User Authentication
Processor
Model
Test Framework
Test Assertions
Logger
Util
Test Execution
Debug Config
Test Driver
Setting Up a Maven Project
Dependencies and Plugins
RestAssured
Log4j
TestNG
Spring Framework
Assertj
Jackson-Databind
Maven Compiler Plugin
Surefire Plugin
Java Code Formatting Plugin
Request
Response
Exceptions
Configuration
Properties File
Spring
Application Configuration
Application Context
Application Config
Complete URL For the Test Script
Test Data
JSON File
Payload for POST and PUT HTTP Methods
User Authentication
Processor
Model
Test Framework
Logger
Util
Test Execution
Debug Config
Test Driver
Summary
Untitled
Chapter 10: First Test Script
Developing Your First Test
Base Test
Authentication
Request Processor
Response Processor
First Test
Test Suite
TestNG XML
Executing a Test
Execute a Test Suite
Execute an Individual Test
Execution Results
TestNG Report
Logging
log().all()
Response Time
Debug
Summary
Chapter 11: API Documentation
Need
Swagger
Summary
Chapter 12: Case Study: Shopping Cart APIs
Feature List
QA Responsibility Matrix
Sprint #
Goal Setting
Sprint One
Sprint Guidelines
Definition of Done
Story Pointing
Backlog Grooming
Story Grooming
QA Tasks
Documentation
Test Environment
Setting Up the Application
QA Tools
Continuous Integration/Continuous Deployment
Targeted Features
API Endpoints
Unit Testing
Test Plan Development
Test Data Preparation
Manual Test Scripts
Postman
Test Automation
Test Suite
Parallel Test Execution
Test Execution
Front-End Team
Sprint Nth
Sprint Demo Feedback Testing
Hardening Sprint
Release Testing
Summary
Appendix A: Workstation Setup
Java
MacOS
Ubuntu
Linux
Windows
Maven
MacOS
Ubuntu
Linux
Windows
Maven Project
cURL
MacOS
Ubuntu
Linux
Windows
Postman
IDE
Tomcat
MacOS/Ubuntu/Linux
Windows
Appendix B: Contact Management Application
Swagger
Appendix C: Shopping Cart Application
Swagger
Index