Test your application by using real traffic from production
Tags: opensource, developer
Published: 2023-09-14 02:42:44

Regression testing is a type of software testing that investigates the validity of previously-tested software. It ensures the software still functions as expected after it has been modified and integrated with other software, tools, and interfaces.

[AREX](https://github.com/arextest) is an open-source automated regression testing platform, which allows one to record production traffic and replay it to testing environment. By comparing the recorded responses against replay, it can clarify the impact of code changes to realize efficient automated regression testing:

- **Save 99% man-cost on regression**: Our innovative record and replay approach eliminates the effort to write or maintain an automation suite. Testing without writing tests.
- **0 database contamination**: Mock external sub-calls in the requests to isolate the third-database called during replay, without causing any dirty data to the database or cache of the system.
- **High-speed regression testing across environments**: Automatically reproduces the production environment by mocking all the external dependencies. With just a single click to start, and the use of multi-threading and random execution, it achieves high-speed replay.

For QA engineers, they don't need to write or maintain regression suite by using AREX to record online traffic as test cases. For developers, it enables them to get quick feedback to debug failures.

## What is Developer Testing (DevTest)

Developer testing is the act of regression testing source code by developers after the development of new features - instead of relying entirely on a team of QA experts to carry out testing.
Here are some significant benefits with regard to developer testing:

1. Higher code quality because new code is tested early and often.
2. Shortened time to market for new features.
3. The cost of change rises exponentially the longer it takes to find and then remove a defect.

## How to do DevTest with AREX

Developers can use the standalone mode of AREX for quick self-testing of code changes before the test is submitted.

[AREX Standalone mode](https://github.com/arextest/arex-standalone) refers to the independent operation of AREX in a local environment without the need to build storage services or other service components.

### Install AREX on a Mac

Install AREX Standalone:

```
AREX_AGENT_MAJOR_VERSION=1.0.1 bash -c "$(curl https://raw.githubusercontent.com/arextest/deployments/dev/shell/arex.standlone.install.sh)"
```

As follows, the latest version of the executable file has been successfully downloaded and installed.

![installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slimww6hml82ywmgy6g7.png)

### Install on Windows

1. Download the [`arex-standalone-all.zip`](https://github.com/arextest/arex-standalone/releases) from "Assets" on the release page and unzip it.
2. Run the `arex-cli.bat` script under `arex-standalone-all` folder.

### Record

1. Before developing new features, start the stable version of the application, and run `./arex-cli.sh` to attach to the application which you want to test.
2. For the first time to use, you need manually perform some actions to the application, so that AREX can record these requests as test cases.

![ls](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4nzv2h89xhk8cmx49560.png)

Run `ls -o 3` to view the recorded requests of /biz/getOrderInfo interface:

![recorded interfaces](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lwj233xzzp9skejr8vo.png)

All requests are listed in the browser.

![recorded cases](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cca0m67pnt8evviu5m7.png)

Click `Detail` to view the details:

![recorded details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ak1vaswnvfcvjjwbeohk.png)

### Replay

When a new feature or change is expected to be tested, start the latest version of the application with new feature or changes, and run `./arex-cli.sh` to attach Agent to the application.

Replay the recorded cases in the testing environment. After replay, AREX will compare the recorded responses against replay.

![replay](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8v8vfk3sgkevqt41zwv.png)

Run watch to check the differences between the two requests.

![diff](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gg6trcu39qlui4t04ck.png)

This help devs to identifies issues early, which allows them quickly test changes or new feature.