# How It Works?

HyperTest operates in two modes: RECORD & REPLAY.\
The test case generation happens in RECORD mode and the Test Run is called the REPLAY.

There are 3 major components at play here:

* SDK: Facilitates capturing incoming/outgoing traffic by instrumenting libraries thus generating test cases and mocks, also it provides appropriate mocks in REPLAY mode.
* CLI: Runs Test by spinning up your app in isolation by injecting required mocks, replay's recorded traffic, and generates the report.
* HyperTest Server: Serves the HyperTest Dashboard and stores all the test cases and results.

<figure><img src="/files/sZq5HJLOkzq8a2BYh0aj" alt=""><figcaption></figcaption></figure>

### Real World Scenario:

With HyperTest SDK integration in place, when a Client makes an API call to the UI Gateway Service it in turn makes some requests to external services to give a response.

All the outbound calls to the downstream services such as Redis or Catalog Services are being recorded by HyperTest SDK with their responses to be mocked during REPLAY.\
\
The Catalog service is also instrumented with the SDK it captures the Incoming Request from Gateway Service and records it as a test case with its mocks.

### Testing:

Whenever a Test is Initiated by HT CLI, it spawns a new process of the Application Under Test and supplies the mocks required for boot via SDK.

After successfully starting the App it starts running the same requests(Test Cases) with the mocks and generates a regression report which can be accessed by the Dashboard.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v2.hypertest.co/overview/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
