JMeter Test Explorer (JTE) is a Visual Studio extension which allows users to discover JMX files from the current solution, execute them directly from Visual Studio and view the results. JMeter Test Explorer can be used to analyze and measure the performance/load and functional behavior of web applications, web services, and REST APIs. With this addon, now developers can test the changes without leaving Visual Studio and capture the results for future comparisons. Prerequisites The two main prerequisites needed are:
JMeter Test Explorer Plugin WorkflowJMeter Test Explorer plugin for Visual Studio executes the JMX files created for performing Load and Performance Testing of the Services (mainly Web Applications). JMX files need to be included in the Solution project after which the plugin will scan the entire solution for existing JMX files and provide you option for directly executing the tests. On execution, the results are displayed on the window inside the Visual Studio as well the CSV of the output is generated in the path where the input JMX file is present. The output CSV files can then be used for a variety of purposes. Please find below diagram displaying the overall workflow of the plugin. SetupTo setup JMeter Test Explorer please follow below steps:
JMeter Test Explorer Plugin FeaturesJMeter Test Explorer comes with features which makes it visually interactive to configure and use it. This section will describe the feature which comes with the plugin. Each section in the image below is assigned a numeral. Working/Description of each is detailed after the image.
DemoFor demonstrating the actual use of JMeter Test Explorer, we have used Swagger Petstore as sample API. To check out more about Swagger pet store please visit below link: https://petstore.swagger.io/ And if you want to get the source code and run this solution locally, you can get it from below Github repositoryhttps://github.com/swagger-api/swagger-codegen/tree/master/samples/server/petstore/aspnetcore Visual Studio Solution OverviewTo mimic the actual use case behavior copy the Visual Studio Solution(JMXTest) given in the repository above and open it. Below is the image displaying the Solution structure: API and JMX Files DescriptionSwagger pet store solution has 3 API controllers :
We have created JMXs for testing out these controllers. JMX files that we will be using here is created in the hierarchical structure. Below is the expanded view of JMeter tests folder. All the test cases will be tested for the globally available endpoint (https://petstore.swagger.io/v2) in the JMX files,
JMeter Test ExplorerJMeter Test Explorer scans through the solution and creates the same hierarchical structure for the JMXs as present in the folder. In general, the logical hierarchical arrangement for a JMX is in the below format: For more information regarding the JMX and its components, please visit URL: https://jmeter.apache.org/usermanual/test_plan.html In the plugin, user can see this arrangement in the below structure: User Actions: a. Run Test: Runs the test plan as configured at that state. b. Open in JMeter: Will open the JMeter Application GUI with the JMX file against which it is clicked. c. Enable/Disable: Sets the enable attribute to true or false for either thread group or sampler. d. Set User Defined Variables: This can be used to set values to user-defined variables defined in the JMX. These variables are prefixed by ${__P in the file. An example of it is given below Once this icon is clicked, a form window will open with default value populated in it. User can change these values and Save it in the file directly from the form. And new changes will start reflecting. This form window will look like below: e. When Run Test action is performed on the test plan,the process in the background will start executing the test plan and will display the result in the window. f. A new action item is also visible at the rightmost corner with a green tick. On clicking this Output CSV generated is brought to the front in the application supported for reading CSV files by the system (MS Excel, Notepad++). The output file name is in the format {OriginalFileName}-output-{DateTime}.csv and this file is saved in the same location as the test plan JMX file. An example of it can be viewed in the below image. You can down load the working VS project from here. https://github.com/emtecinc/JMeter-Test-Runner g. This output result can be used by the user for further purpose. User can validate if their services are up and running, analyze performance and load test result of this test, publish results, etc. NOTE: JMeter Test Explorer is supported and tested on Visual Studio version 17(Professional & Enterprise). For earlier versions,the behavior may change while work is under progress to make it fully functional on earlier versions as well. |