Server Response Modification

A cat replacing one file with another

Traffic Analyzers or sniffers allow you to intercept and modify the data that the server sends to the client (e.g., the browser) in response to a request.

The most popular sniffers for testing: Charles and Fiddler.

The browser's built-in DevTools also supports response rewriting:

Modifying Server Response with DevTools

DevTools Local Override

DevTools Local Override allows you to locally rewrite the body and headers of the server response.

  1. Open DevTools F12
  2. Go to the Network tab
  3. Refresh the page
  4. Right-click on the request
  5. Click Override content
    (Override headers for header changes)
  6. Select a folder to store the modified files
    (Select folder)
  7. Click “Allow”
  8. Edit the data
  9. Save changes
  10. Refresh the page
DevTools toggle device toolbar

Server Response Manipulation for UI Testing

Changing the server response helps to test UI scenarios in various situations:

  • When defects occur and the server returns incorrect data
  • When there is no access to data on the server
  • When it is difficult to prepare all necessary test data on the server

For example, let's take the profile of a cat named Whiskers.

Requirements

When the page loads, JavaScript sends a request, and the server returns Whiskers' data.

The response should contain the mandatory field furColor, which can have one of the following values: white, gray, orange, lightsteelblue, rosybrown.

Whiskers

Age: -

Favorite dish: -

The server response contains an error, please rewrite it using valid furColor values.

Save changes and refresh the page.

Task
Task available to premium users!
Sidebar arrow