{"id":19466649,"url":"https://github.com/sonertari/testproxy","last_synced_at":"2025-07-25T06:04:43.605Z","repository":{"id":57669561,"uuid":"195123751","full_name":"sonertari/TestProxy","owner":"sonertari","description":"Tool for end-to-end testing of proxy servers","archived":false,"fork":false,"pushed_at":"2022-12-24T08:26:56.000Z","size":237,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-19T07:04:07.101Z","etag":null,"topics":["development-tools","end-to-end","proxy-server","testing"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sonertari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-03T20:41:43.000Z","updated_at":"2024-12-03T08:25:56.000Z","dependencies_parsed_at":"2023-01-30T20:20:12.028Z","dependency_job_id":null,"html_url":"https://github.com/sonertari/TestProxy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sonertari/TestProxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonertari%2FTestProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonertari%2FTestProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonertari%2FTestProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonertari%2FTestProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonertari","download_url":"https://codeload.github.com/sonertari/TestProxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonertari%2FTestProxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260705804,"owners_count":23049488,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development-tools","end-to-end","proxy-server","testing"],"created_at":"2024-11-10T18:29:30.671Z","updated_at":"2025-06-19T07:04:35.964Z","avatar_url":"https://github.com/sonertari.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TestProxy - Tool for end-to-end testing of proxy servers\n[![Version](https://img.shields.io/crates/v/testproxy.svg)](https://crates.io/crates/testproxy)\n[![Build Status](https://travis-ci.com/sonertari/TestProxy.svg?branch=master)](https://app.travis-ci.com/github/sonertari/TestProxy)\n\nCopyright (C) 2019-2022, [Soner Tari](https://github.com/sonertari).\nhttps://github.com/sonertari/TestProxy\n\n## Overview\n\nTestProxy is designed to be used for end-to-end testing of any program, such \nas a proxy server, which runs in between a client and a server, and \ncommunicates with them over networking packets.\n\nA proxy server accepts connections from a client on the one side, and \ntransfers the packets between that client and a server on the other side (it \nmay or may not modify the packets it transfers). So, TestProxy acts as both \nthe client and the server to simulate this environment. It starts a manager \nthread to run the tests, and in turn the manager thread starts a client and a \nserver thread for each test. The manager sends commands to these client/server \npairs to execute the tests it is started for.\n\nThe [SSLproxy](https://github.com/sonertari/SSLproxy) project uses TestProxy\nin its end-to-end tests. See the testproxy test sets in the SSLproxy sources\nto learn how to use TestProxy.\n\n![Operation Diagram](examples/OperationDiagram.png)\n\nTestProxy test steps are composed of a test end, a command, and a payload. For \nexample, a test can instruct a client to send an HTTP request to the proxy \nserver under test using the `send` command with a payload such as `GET / \nHTTP/1.1\\r\\nHost: example.com\\r\\n\\r\\n`. The next step of the same test can \ninstruct the pairing server to receive this HTTP request from the proxy using \nthe `recv` command with the same payload `GET / HTTP/1.1\\r\\nHost: \nexample.com\\r\\n\\r\\n`, assuming the proxy is not expected to modify the \npayload. These send and receive steps of the test are called `states`, and are \nexecuted in the order they are numbered, as below.\n\n```\n\"states\": {\n  \"1\": {\n    \"testend\": \"client\",\n    \"cmd\": \"send\",\n    \"payload\": \"GET / HTTP/1.1\\r\\nHost: example.com\\r\\n\\r\\n\"\n  },\n  \"2\": {\n    \"testend\": \"server\",\n    \"cmd\": \"recv\",\n    \"payload\": \"GET / HTTP/1.1\\r\\nHost: example.com\\r\\n\\r\\n\",\n  }\n}\n```\n\nThis test becomes successful if both of these commands succeed, but it fails \nif either of the commands fails or the received payload does not match the \nexpected payload of the `recv` command. Such tests may contain assertions too. \nSee the sample tests under the `examples` folder in the sources to learn more \nabout possible assertions.\n\nSuch tests can be saved in a JSON file to form a test set. The protocol and \ntest ends of the test set are configured in the beginning of the file. The \ntest set can be executed using multiple configuration. For example, the \nfollowing test set specifies two configuration, which means that the tests in \nthe test set will be executed twice, once for each configuration. Note that \nthe first configuration is for TCP and the second is for SSL tests, and that \nthe client and the server ports are different in each configuration. The proxy \nserver under test should have been configured to accept connections on those \nclient ports and to forward packets to those server ports.\n\n```\n\"comment\": \"Tests for HTTP request/response\",\n\"configs\": {\n  \"1\": {\n    \"proto\": {\n      \"proto\": \"tcp\"\n    },\n    \"client\": {\n      \"ip\": \"127.0.0.1\",\n      \"port\": \"8181\"\n    },\n    \"server\": {\n      \"ip\": \"127.0.0.1\",\n      \"port\": \"9181\"\n    }\n  },\n  \"2\": {\n    \"proto\": {\n      \"proto\": \"ssl\",\n      \"crt\": \"server.crt\",\n      \"key\": \"server.key\"\n    },\n    \"client\": {\n      \"ip\": \"127.0.0.1\",\n      \"port\": \"8444\"\n    },\n    \"server\": {\n      \"ip\": \"127.0.0.1\",\n      \"port\": \"9444\"\n    }\n  }\n},\n\"tests\": {\n  \"1\": {\n    \"comment\": \"Sends an HTTP request\",\n    \"states\": {\n      ...\n    }\n  },\n  \"2\": {\n    \"comment\": \"Receives an HTTP response\",\n    \"states\": {\n      ...\n    }\n  }\n}\n```\n\nFurthermore, such test sets can be bundled to form a test harness. For \nexample, a sample test harness may be as follows:\n\n```\n{\n  \"comment\": \"Proxy end-to-end tests\",\n  \"testharnesses\": {\n    \"1\": {\n      \"comment\": \"HTTP tests\",\n      \"testsets\": {\n        \"1\": \"http_testset_1.json\",\n        \"2\": \"http_testset_2.json\"\n      }\n    }\n  }\n}\n```\n\nOne or more test harnesses can be saved in a JSON file. This is the file that \nthe testproxy executable should be started with using the `-f` option. For \nexample, the following is the screenshot of testproxy output when started with \na `testharness.json` file and the debug level of 3 (which is the default, but \nTestProxy can produce detailed debug logs and very verbose trace logs as well):\n\n![Sample Output](examples/SampleOutput.png)\n\nIn summary, the main test harnesses file may be composed of multiple test \nharnesses. Test harnesses may be divided into multiple test sets, which may be \ncomposed of tests defined in a test set file. Each test may contain multiple \nsteps called states, and may contain assertions.\n\nTestProxy runs multithreaded. Test harnesses are run serially, starting from \nthe first one, but TestProxy starts a manager thread for each test set in the \ntest harness. Manager thread runs the tests in its test set serially, but it \nstarts a client and a server thread for each test in the test set. Manager \nthread communicates with those client and server threads over messaging \nchannels, and expects execution results back.\n\nTestProxy currently supports the TCP and SSL protocols.\n\n## License\n\nTestProxy is provided under the GPLv3 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonertari%2Ftestproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonertari%2Ftestproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonertari%2Ftestproxy/lists"}