Introduction
Introduction to APIs
- What Is a Web Application?
- Google Is an Example of a Web Application
- What Is an API?
- What Is an HTTP Request?
- What Is a URL?
- What Are HTTP Verbs?
- What Is an HTTP Response?
- What Is an HTTP Status Code?
- What Are Payloads?
- What Is JSON?
- What Is XML?
- What Are HTTP Headers?
- What Is Authentication?
- What Is REST?
- What Tools Are Used for Accessing an API?
- Example APIs
- Recommended Reading
- Summary
Introducing Tracks Case Study
- Support Page
- How to Use This Case Study
- Source Code Location
- Case Study Contents Overview
- Why Test Tracks?
- What Is Tracks and GTD?
- Summary
Installing Tracks
- Official Tracks Install
- Pre-Built Virtual Machines
- Using Virtual Machines
- Summary
A Tour of Tracks
- Why Learn the GUI If We Are Testing the API?
- Login
- Home Screen
- Starred Screen
- Projects
- Admin
- Basic Functions to Use and Check in the API
- Summary
The Tracks REST API
- What Is a REST API?
- Tracks REST API Documentation
- API Doc Examples
- General HTTP REST Return Codes
- Summary
Using a Proxy to View GUI Traffic
- Why?
- How?
- Viewing Traffic
- Implications
- Summary
Using a Proxy and Fuzzer to Create Users
- Tools
- Capture and Resend the Create User Request
- We Learned
- Using OWASP ZAP Proxy
- Capture Traffic in ZAP and Use the Fuzzer
- Multiple Users Created
- Quick Tip - Creating Data in a Spreadsheet
- Summary
Case Study Example Using cURL on Tracks
- What Is cURL?
- Case Study Details
- Installing cURL
- Reading the Examples in Tracks Documentation
- Try the Tracks API Examples
- Tracks
GETAPI Calls - Adding Data
- Amending Data
- Deleting Data
- Additional References
- Summary
Exploring the Tracks API with cURL Through a Proxy
- Using a Proxy with cURL
- For Debugging
- For Exploration
- For Simple Scope Coverage
- Summary
cURL Summary
Exploring Tracks API with Postman REST Client
- The GUI
- Issue Requests
- Postman Collections
- Environment Variables
- Authentication
- Using Postman Through a Proxy
- Recreate cURL Requests in Postman
- Summary
How to Use the Source Code
- Source Code Location
- How to Use the Source Code
- Summary
Starting to Automate
- Why Explore First?
- Choosing a Java Library
- REST Assured Overview
- REST Assured Related Reading
- Summary
The Case Study Overview - Testing Tracks v 2.3.0
- The Tools
- Code Location
- The Approach
- What I Automated
- Summary
The Case Study Creating Users with ‘App as API’
- Creating a User In Tracks via the API
- Does This Mean We Have to Stop Automating Here?
- How to Create a User
- ‘App as API’
- Investigating How to Treat the APP as API
- What Requests Do I Need?
- How Do We Do That?
TracksAppAsApi- Login Via “App as API”
- Summary
The Case Study - Create Random Users Utility @Test
- A Utility
@TestCase - The Main Utility
@TestMethod - Configuring the
@TestUser Creation Utility - Local Abstractions Overview
- Summary
The Case Study - API Abstraction
- Overview of the API Abstractions
TracksApiEndPointsExplainedTracksApi- Domain Objects
- Summary
The Case Study - Sending HTTP Calls using REST Assured
HttpMessageSender- Summary
The Case Study - the Test Code Explored
- What Makes It ‘test’?
TestEnvDefaults- Synchronisation
- Synchronisation with
Wait TracksResponseProcessor- Summary
The Case Study - the Authentication @Test Methods Explored
- Evolving the Authentication Tests
AuthenticationTest- Final Test
- Summary
The Case Study - the Project @Test Methods Explored
- Create Project
- Amend
- Delete
- Summary
The Case Study - the Task @Test Methods Explored
- Supporting Private Methods
- Create
- Delete
- Summary
REST Assured JSON and XML Processing
- Code Example Location
- What Is XML?
- What Is JSON?
- REST Assured JSON and XML Parsing
- XML Attributes with GPath
JsonPathandXmlPath- Parsing from File or String
- Parsing from URI
- Deserialization to Objects
- Deserialization in Practice
- Serialization in Practice
- More Information
- Summary
Summary of REST Assured
- Adding REST Assured with Maven
- Setting a Proxy for REST Assured
- Sending Message with REST Assured
given,when,then- Using
givento Set the Message Details - Using
whento Make HTTP Requests - Using
thento Process Response - Basic Example
- Assertions Using
bodyinthen - JsonPath and XmlPath
- Serialization and Deserialization
- Summary
Suggested Exercises
- Installation Exercises
- Coding Exercises
- Refactor and Expand
- Summary
Future Refactoring
- Instead of Returning a
ResponseObject - What Would You Do?
- Refactoring Resources
- Summary
Conclusions and Summary
- Next Steps
- Reminder of the Non-Obvious
- App as API
- REST Assured Wrapped with Abstractions
- Test Data Creation Through Web Scraping
- Random Test Data Creation
- Extensive Abstraction Creation
- Summary
Appendix - Random Data Creation for v 2.3.0 Testing
- Symbol Replacement
- Interface
TestDataRetriever RandomFoodBackedDataRetriever- Generating a Project Name or TODO
- Summary
Appendix - Other REST GUI Clients
- Chrome Applications
- Desktop Applications
- Firefox Plugin
- IDE and Editor Plugins
Appendix - HTTP Debug Proxy and Proxy Support Tools
Appendix - Creating Random Data for Tracks v 2.2.0 Testing
- Approach
- Scraping Data Support Classes
- Scraping Data Code
- Testing the Utility
@TestClass - Setup Data with the Utility
@TestClass
Exploring Tracks API with Postman REST Client
- Using Postman Through a Proxy
- Shared Cookie Jar Gotcha
