In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to carry out WebBenchmark dynamic data testing, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
For many WebApi management tools, the performance test of the interface takes fixed data for a circular test; this kind of test can only ensure the validity under the current data, but it is often necessary to stress test different data distribution in the performance test, which can more accurately reflect the processing capacity of the system under different data.
The WebBenchmark tool introduces the concept of value function, which is a series of data custom functions; through it, the performance test data can be covered more widely and better performance test results can be achieved. The tool provides some basic functions by default:
@ [date] returns the current date
@ [date (yyyy-MM-dd)] returns the date in the specified format
@ [date (HH:mm)] returns the time
@ [number] returns a random number
@ [number (1100)] returns a random number with a specified interval
@ [nextstr (userid)] randomly returns an item of data from a list of characters
@ [guid] get a guid value
These are some of the basic functions provided by the tool. In practical applications, you can also expand some of your own functions according to your needs. These functions can be directly defined in querystring,header or submitted data. After definition, these related values will obtain the corresponding data from the function every time you request. Next, let's introduce the use of functions:
Webapi definition
Here is a webapi project defined with aspcore to test the value function definition. Here is a simple webapi interface
[ApiController] [Route ("[controller]")] public class WeatherForecastController: ControllerBase {private static readonly string [] Summaries = new [] {"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"}
Private readonly ILogger _ logger
Public WeatherForecastController (ILogger logger) {_ logger = logger;} [HttpPost] public object Post ([FromBody] Property item) {return item;}
[HttpGet] public IEnumerable Get (int count=10) {var rng = new Random () Return Enumerable.Range (1, count) .Select (index = > new WeatherForecast {Date = DateTime.Now.AddDays (index), TemperatureC = rng.Next (- 20,55), Summary = Summaries [rng.Next (Summaries.Length)]}) .ToArray () }} public class Property {public string Name {get; set;}
Public string Value {get; set;}}
GET method test
Method provides a count parameter that returns the corresponding amount of data based on the parameter value. Next, let's take a look at how the content of this test is defined.
Define a count variable in the address parameter, and then generate a random number between 1 and 10 through @ [number (1Magne10)] in the value.
These are the two test results defined for this test, and you can see that the count value generated each time is different.
POST method
Value functions can be used not only on Url parameters and Header, but also on submitted parameters, including member properties of json.
You can introduce a value function anywhere in the submission. The above test is a random value in the value value.
You can see that the data submitted is different each time.
Nextstr function
This is a combined function whose arguments require a variable. Next, define the table quantity of a User list and randomly assign a user name when the data is submitted. First, you need to add a list variable to the list of variables
Next, you can't random this list variable through the nextstr function.
Then do a lot of tests.
In this way, the name and value values submitted each time are randomly generated by the function.
This is the end of the dynamic data testing on how to carry out WebBenchmark. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.