Deployment of distributed test tools BEETLE.DT and http,sql,tcp pressure measurement

Source: Internet
Author: User
Tags mssql

Since BEETLE.DT is a distributed stress testing tool, it is not as simple to use as a common tool, as the tools involved in testing the management Center, node and management side, and so must be deployed to run. Next, if you install BEETLE.DT and perform simple http,sql and TCP-related stress tests.

Operating Environment requirements

The existing version of the BEETLE.DT can only be run on the basis of Windows+.net 4.5 (only support console mode test run) after the completion of the function will be the win service service and. NET core version of the extended development. The tool runs the main deployment of two major application services (compiled in the public directory) are: Test Management center and test run node, by configuring the relevant network information to ensure that the node and the center effectively interactive communication.

Test Management Center

Project Beetle.dtcenter is the operation of the Test Management Center, the center needs to configure two service addresses are node communication port and Management communication terminal, the corresponding port is 9091 and 9092; If you want to modify the service address and end through the configuration file modification (Beetle.DTCenter.exe)

  <appSettings>    <!--...-->    <add key= "server-host" value= "/> <add key=    " Server-port "Value=" 9091 "/>    <add key=" manager-host "value=" "/>    <add key=" Manager-port "value=" 9092 "/>    <!--...-->  </appSettings>
Node Service

Project Beetle.dtnode is a test node service, in addition to its own services, the node service includes the main purpose of beetle.dtprocess;beetle.dtprocess is to load run test cases; beetle.dtprocess does not need to configure any information. However, it must be stored in the corresponding directory of the Beetle.dtnode. Beetle.dtnode is mainly to configure the beetle.dtcenter corresponding Server-host and server-port, to confirm that the node can effectively point to the corresponding test center.

  <appSettings>    <!--...-->    <add key= "Server-host" value= "127.0.0.1"/> <add    key= " Server-port "value=" 9091 "/>    <!--...-->  </appSettings>
Management tools

When both the test center and the node are deployed, you can use the management tools to log in to the test center for the creation of test cases, file uploads, node monitoring and test runs, and other related operations. Open the Management tool and enter the management side of the service address, and then connect to the management side, you can create a test directory and upload files, after selecting the test directory and running the node, click the Test button to test the interface.

Click on the test interface to synchronize the test case can be synchronized to the selected node, and then enter the appropriate configuration information click to run the test case can be; During the test run, the following chart shows the concurrent results of the test request response over the current time period

After the test is complete, you can view the test situation by looking at the detailed report.

Http,sql and TCP Tests

Beetle.dt itself is just a test tool, so the tool is completely out of the picture without a test case. To give you a better understanding of the purpose of the tool, you have written several basic test cases that allow for simple stress testing of http,sql and TCP.

Writing test Cases

There is a variety of real business, and for simple test cases it is impossible to meet the needs of different businesses, so when using tools, you have to write test cases. Because of the need to conform to the tool's operational requirements, writing test cases also requires following the rules of the tool set , you must reference the Beetle.dtcore project when writing the test case, and then inherit the TestCase rewrite OnExecute write the code that needs to be tested, and if the test code is asynchronous, you need to rewrite the main method of execute, call the completed method manually to tell the tool what the test case Time to complete. Here are the implementation codes for several basic test cases

    • HTTP
public class Httpget:testcase<config>{public override string Name{get{return "Http_get";}} Private Long Mindex = 0;private list<string> murls = new list<string> ();p ublic override void Init () {base. Init (); Murls.addrange (this. Config.Urls.Split (';'));} public string GetUrl () {mindex++;return murls[(int) (mindex% murls.count)];} protected override void OnExecute () {System.Net.WebRequest WReq = System.Net.WebRequest.Create (GetUrl ()); System.Net.WebResponse Wresp = Wreq.getresponse (); System.IO.Stream Respstream = Wresp.getresponsestream (); using (System.IO.StreamReader reader = new System.IO.StreamReader (Respstream, Encoding.UTF8)) {reader. ReadToEnd ();}}} public class Config{public string Urls {get; set;}}
    • Sql
public class Mysqldriver:drivertemplate<mysqlconnection, Mysqlcommand, Mysqldataadapter, Mysqlparameter, Mysqlbuilder>{}public abstract class sqlbase:testcase<sqlconfig>{public override void Init () { Peanut.DBContext.SetConnectionString (DB. DB1, config.connection); base. Init ();} protected override void OnExecute () {base. OnExecute (); Peanut.sql SQL = Config.sql;sql. Execute ();}} public class mssql:sqlbase{public override void Init () {peanut.dbcontext.setconnectiondriver<peanut.mssql> (DB). DB1); base. Init ();} public override string Name{get{return "MSSQL";}} public class mysql:sqlbase{public override void Init () {peanut.dbcontext.setconnectiondriver<mysqldriver> (DB). DB1); base. Init ();} public override string Name{get{return "MySQL";}} public class Sqlconfig{public string Connection {get; set;} public string Sql {get; set;}}
    • Tcp
public class Sockettcputf:beetle.dtcore.testcase<tcpconfig>{public byte[] Mdata;private BeetleX.Clients.IClient mclient;public override void Init () {base. Init (); mdata = GetData (); mclient = BeetleX.ServerFactory.CreateTcpClient (Config.host, Config.port); Mclient.clienterror = Onneterror;mclient.receive = OnReceive;} private void OnReceive (IClient C, Ibinaryreader reader) {foreach (IBuffer item in reader). Getbuffers ()) {item. Free ();} Completed ();} private void Onneterror (IClient c, Exception E, String message) {completed (e);} Protected virtual byte[] GetData () {return Encoding.UTF8.GetBytes (config.data);} public override string Name{get{return "Tcp_utf_data";}} public override void Execute () {mclient.send (mdata);}} public class Sockettcphex:sockettcputf{public override string Name{get{return "Tcp_hex_data";}} protected override byte[] GetData () {return Enumerable.range (0, Config.Data.Length). Where (x = = x% 2 = = 0). Select (x = Convert.tobyte (Config.Data.Substring (x, 2), 16)). ToArray ();}} public class Tcpconfig{public string Host {get; set;} public int Port {get; set;} public string Data {get; set;}}

  

Github https://github.com/IKende/Beetle.DT/

< Span class= "pl-s" > < Span class= "PL-C1" > < Span class= "pl-k" >  


/span>

Deployment of distributed test tools BEETLE.DT and http,sql,tcp pressure measurement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.