https://github.com/sbimochan/har-diff
Generate data differences from HTTP archive files
https://github.com/sbimochan/har-diff
frogtoberfest hacktoberfest
Last synced: 5 months ago
JSON representation
Generate data differences from HTTP archive files
- Host: GitHub
- URL: https://github.com/sbimochan/har-diff
- Owner: sbimochan
- License: mit
- Created: 2024-04-11T16:30:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T17:35:48.000Z (over 1 year ago)
- Last Synced: 2025-04-19T21:13:40.755Z (about 1 year ago)
- Topics: frogtoberfest, hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# API Response Validator Tool
## Overview
The API Response Validator Tool is a command-line utility designed to facilitate comparing API responses between two versions of your backend infrastructure. It helps ensure that the changes made in the database infrastructure do not inadvertently affect the API responses. The tool generates and compares mock API responses, providing insights into any discrepancies between the versions of HTTP Archive (HAR).
## Application
If you're migrating your database engine and want to assure that beside any dialects or database engines you want the data response to be exact same, you can use this tool. No need to tally all the data manually. Spin off two frontend apps using two different database engines (old and new). Open them in two browser tabs, Fire up your network tab, navigate to all the features you want to test. Download HAR(Http Archive) files from each tab naming source.har and target.har. Next steps below.
## Installation
To install the API Response Validator Tool, follow these steps:
1. Clone this repository to your local machine.
2. Install the necessary dependencies by running `npm install`.
3. Ensure that you have Node.js and git installed on your machine.
4. Install `har-to-mocks`
```bash
npm install -g @sbimochan/har-to-mocks
```
## Usage
### Generating Mock API Responses
Before comparing the API responses, you need to generate mock responses . Follow these steps:
1. Ensure that you have the necessary configuration files for the source and target versions (e.g., `source.har` and `target.har`).
2. Download and put the HAR file over here between two versions of app. Check youtube video how to export HAR from network tab
### Comparing API Responses
Once the mock API responses are generated, you can compare them to identify any differences. Follow these steps:
1. Run the following command to compare the API responses:
```
npm run diff
```
This command will compare the mock responses generated for the source and target versions. Any differences in the responses will be highlighted, providing insights into the impact of database infrastructure changes on API responses.
### Viewing Differences in VS Code
To view the differences in the API responses directly in VS Code's source control:
1. Ensure that you have the Git extension installed in VS Code.
2. After running the comparison command, open the VS Code source control view.
3. You should see the changes in the `source` and `target` folders, indicating the differences between the API responses of the two versions.
### Final step
After being satisfied with the result, hit
```
npm run flush
```
## Contributing
Contributions to the API Response Validator Tool are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on GitHub.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
---