HttpTest4Net is a C #-based and HTTP stress testing tool that allows you to perform a simple stress test on HTTP services. although. NET also integrates stress testing projects, but it is difficult to perform high concurrency stress testing on PCs with low configuration because of the resources occupied by, in addition, it is very troublesome to install a huge tool like. using HttpTest4Net, you only need to configure the parameters to perform stress tests on the existing HTTP service and obtain a detailed summary of the test results.
Function
- Provides a test method for the total test time or the total number of requests.
- Supports stress testing and transfer time for multiple users.
- Supports basic GET and POST tests.
- Provides the function of saving and loading test cases.
- Provides custom writing test cases to be loaded into the tool.
- The test summary function is provided to view the test results in real time and the distribution of the completed results.
Define test cases
The tool only provides basic GET and POST test cases, but these two tests may not meet the requirements in some scenarios. Therefore, the work provides the function of customizing test cases, developers may implement HttpTest4Net. interfaces. the IUrlTester interface implements more complex test cases. Compiled test cases only need to be compiled into DLL and placed in the directory where the test tool runs. the following is the POST test case implementation code provided by the component:
02 |
public class PostUrlTester:IUrlTester |
04 |
public PostUrlTester() |
15 |
public string PostData |
21 |
public string Encoding |
27 |
public System.Net.HttpWebRequest CreateRequest() |
29 |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); |
30 |
request.Method = "POST"; |
31 |
request.ContentType = "application/x-www-form-urlencoded; charset="+Encoding; |
32 |
byte[] data = System.Text.Encoding.GetEncoding(Encoding).GetBytes(PostData); |
33 |
request.ContentLength = data.Length; |
34 |
Stream myStream = request.GetRequestStream(); |
35 |
myStream.Write(data, 0, data.Length); |
Graphic tool usage
Download (runtime environment. NetFramework 4.0)