Skip to content

[Breakpoint] #6 Unit Test for Breakpoint Service #223

@NghiaTranUIT

Description

@NghiaTranUIT

Description

It's time to write Unit Tests for the Breakpoint Service to verify it covers all user-case

⚠️ Ping @NghiaTranUIT to get the sample of BreakpointServiceTests file

In general, it's similar to #209:

  1. Start the Core
  2. Setup Breakpoint Rule with the given criteria
  3. Make a request to httpbin.org
  4. Modify the Request/Response data
  5. Verify the HTTPBin Body that the Request is updated by Breakpoint
  6. Verify the Response to verify the Header, Status Code, and body is updated by Breakpoint

Unit Test cases: Continue logic

1: Request Breakpoint on GET - HTTPS - Update Query Tab

Given:

  • Create a Breakpoint Rule (Request Only)
  • Make a GET https://httpbin.org/get Request
  • Modify the Header and Query tab.

Expected:

  • New Header and Query are in the Response Body

2: Request Breakpoint on GET - HTTPS - Update query from URL

Given:

  • Create a Breakpoint Rule (Request Only)
  • Make a GET https://httpbin.org/get Request, Modify the Header, and Query from the URL, e.g https://httpbin.org/get?id=123

Expected:

  • New Header and Query are in the Response Body

3: Request Breakpoint on POST JSON

  • Given: Make a POST httpbin.org Request, Modify the Header, and Query and JSON Body. Create a Breakpoint Rule (Request Only)
  • Expected: New Header and Query and the body are in the Response Body

4: Request Breakpoint on POST Form - Update by Body Tab

  • Given: Make a POST httpbin.org Request, Modify the Header, and Query and Form Body (in the Body Tab). Create a Breakpoint Rule (Request Only)
  • Expected: New Header and Query and the body are in the Response Body

5: Request Breakpoint on POST Form - Update by Form Tab

  • Given: Make a POST httpbin.org Request, Modify the Header, and Query and Form Body (in the Form Tab). Create a Breakpoint Rule (Request Only)
  • Expected: New Header and Query and the body are in the Response Body

6: Request Breakpoint and change the Method and URL

  • Given: Make a GET https://httpbin.org/get Request, Modify Method = POST, URL = https://httpbin.org/post?id=123, add some JSON Body. Create a Breakpoint Rule (Request Only)
  • Expected: There is a Query (id=123), and URL = "https://httpbin.org/post?id=123" and the JSON Body are in the Response Body

7: Request Breakpoint - Change different URL

  • Given: Make a GET httpbin.org Request => Update URL to www.google.com Create a Breakpoint Rule (Request Only)
  • Expected: The Response Body is not from httpbin.org, it's a google HTML

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request✅ DoneTicket is resolved

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions