SpiraTest integration with JMeter

03 Mar, 2019 | 5 minutes read

Introduction

This article describes how you can use SpiraTest or SpiraTeam (in this article SpiraTest will be used ) together with RemoteLaunch to schedule and remotely launch instances of JMeter and have the testing results be transmitted back to SpiraTeam. This allows you to extend your SpiraTest’s testing management capabilities to include automated JMeter performance tests.

Set Up the Environment and Test Scripts

In order to integrate JMeter with SpiraTest, you will need to install Inflectra RemoteLaunch application. In short, RemoteLaunch application enables integration of SpiraTest with other testing tools allowing SpiraTest to orchestrate your testing activities, both manual and automated in one place. Typical installation location of RemoteLaunch is C:\Program Files\Inflectra\Spira RemoteLaunch, however if you want to install it on other location please make a note of that location since this information will be needed in further configurations.

Spira RemoteLaunch has its own License key needed for using the program. You cannot use your existing SpiraTest key in Spira RemoteLaunch. Upon the first launch of the program, you will be asked to update your license information.

As the first step in setting up environment,  download JMeterEngine.zip file from Inflectra’s website https://www.inflectra.com/SpiraTeam/Downloads.aspx:


 download JMeterEngine.zip file from Inflectra's website

Extract the downloaded zip file, and copy the JMeter2AutomationEngine.dll file into the extensions folder where RemoteLaunch has been installed:

After adding the necessary .dll file under the extensions in RemoteLaunch, the next step is to configure SpiraTest to use this file. For that purpose, login in SpiraTest as Administrator and navigate to Test Automation Link under Integration section:

 login in SpiraTest as Administrator and navigate to Test Automation Link under Integration section

After clicking the Test Automation link, a Test Automation Engines page is displayed that lists all tools that can be integrated with SpiraTest:


 a Test Automation Engines page is displayed that lists all tools that can be integrated with SpiraTest

After clicking the Edit button for JMeter test engine, we can see the configuration for this engine. The token should be unique for each automation engine, and also it is used by Remote Launch which engine to use for the particular Test Case execution. Please note that for JMeter, the token is JMeter2 and refers to the JMeter2AutomationEngine.dll file that was copied under the extensions folder in RemoteLaunch.


for JMeter, the token is JMeter2 and refers to the JMeter2AutomationEngine.dll file that was copied under the extensions folder in RemoteLaunch

In order for a particular Test Case in SpiraTest to be executed automatically it should be linked to the Automation Engine that will execute it. For that purpose navigate to Testing > Test Case and open the Test Case. In the Automation section, populate the Automation Engine field with JMeter, in our case, Script Type should be selected as Linked, because the JMeter engine supports only linked automated tests (i.e. tests that are located on a particular location on the machine, and not uploaded on SpiraTest). Finally, the field File Name should be populated with path to the JMeter script that needs to be executed with the Test Case.


the field File Name should be populated with path to the JMeter script that needs to be executed with the Test Case

Configuring Automation Hosts and Test Sets

In order SpiraTest to trigger automated tests, the so-called Automation Hosts, a separate Automation Host should be configured for each computer that is going to run an automated test case.

To configure Automation Host in SpiraTest, navigate to Testing > Automation Host page that lists all configured hosts. After clicking on the New Host button at the top of the page, in the new appeared row populate Name and Token. The name can be set to anything meaningful, but the Token field must be set to the same token that is specified in the RemoteLaunch application on that specific machine. In this case, Token is set to JMeterTest. Finally, set Active field to Yes and click Save button to finish configuration of the host.


 Token is set to JMeterTest

In order Test Cases to be automatically executed from Spira test,  Test Set of those Test Cases needs to be created, and for the Test Set an Automation Host needs to be configured. In this case, Test Set was created named as “JMeter-Automation-Test”. Please note that Type is set to Automated, while Automation Host is configured to value “TestingJMeter” which is the name of the host that was configured in the previous step.


Type is set to Automated, while Automation Host is configured to value "TestingJMeter" which is the name of the host that was configured in the previous step

Configure RemoteLaunch and start the tests

Start the RemoteLaunch application from its installation location
In the JMeter Location field, enter the location to the JMeter bin folder
In Automation Host Token, enter the same Token used for configuring the host that was also associated with the TestSet that should be executed
After starting the TestSet and tests are executing you will see a Windows command prompt open as JMeter executes the tests included in the TestSet

Once the configuration of SpiraTest is completed, we are ready to configure RemoteLaunch and trigger the tests from SpiraTest. Start the RemoteLaunch application from its installation location:

Open Remote Launch application, and select “Setup: Apache JMeter 2.x Automation Engine” tab. In the JMeter Location field, enter the location to the JMeter bin folder:

Under Client Setup tab, in Server URL enter the address of SpiraTest, and for the fields Username and Password enter the administrator’s credentials for your SpiraTest. In Automation Host Token, enter the same Token used for configuring the host that was also associated with the TestSet that should be executed.

Once the configuration in RemoteLaunch is done, we are ready to trigger the tests from SpiraTest. (Tests can be triggered also from RemoteLaunch from Status tab).

In SpiraTest navigate to the TestSet that was configured for automated test run, in the previous steps, and in order to trigger tests just click Execute button, the same as for manual test execution.


In SpiraTest navigate to the TestSet that was configured for automated test run, in the previous steps, and in order to trigger tests just click Execute button

After starting the TestSet and tests are executing you will see a Windows command prompt open as JMeter executes the tests included in the TestSet.

JMeter tests that were used in this example, were trivial, simulating navigation to home pages of Google, Microsoft, YouTube, and Facebook with five users in duration of 5 mins. However, it is important to note that for each test assertions/validations were added for maximal average, min and max response time and error rate, so if a test detects values for these parameters above the defined maximal value, it will fail. Of course, with the load used in our tests no failures were detected, so after the test execution has finished, the results of tests execution in SpiraTest look like this:


 results of tests execution in SpiraTest

On the TestRun page, details of the run can be seen which were reported back from JMeter along with any messages or other information. The Test Name represents the name of the test inside JMeter, and the execution status corresponds with the rules described above.

Conclusion

Inflectra test and project management tools: SpiraTest and SpiraTeam provide capabilities for managing automated tests developed in multiple test automation platforms. One of those is JMeter, which enables SpraTest or SpiraTeam to be a central location for managing and collecting result not only for functional but also for performance test built in an open-source JMeter tool.