MATTERMOST – ROCKETCHAT – Testing

Introduction

In this post, I used JMeter to test the REST APIs of two servers, Mattermost and RocketChat, with various user actions such as User Authentication, Sending Messages, Joining/Leaving Rooms or Channels, and Reading Messages. Then, afterward, I used Jenkins to run the jobs remotely, combined with Performance plugins, to view the results.

Step 1: Testing Plan with JMeter

This was the demonstration of the testing plan for the RocketChat server, and for the Mattermost server, the structure was the same, except for the difference in API requests.

Thread Group Configuration: I started by creating a Thread Group with 25 users and set the test duration for approximately 1 hour.

User Authentication: For User Authentication, I added an HTTP Request named “PostLogin” for the login API. I also used two Post Processors that used regular expressions to extract the ‘userId’ and ‘authToken.’

To keep the user authenticated, I used an ‘HTTP Header Manager’ to include these values in subsequent requests.

Other API Actions: In addition to User Authentication, I included API requests for actions like sending messages and reading messages, which are critical for my test scenarios.

Running the Test: After setting up the test plan, I executed the test, and it ran as expected. I monitored the results using the Result Tree and Summary Reports to analyze the performance of the APIs.

Step 2: Setting up Jenkins

In this part, I connected to the Jenkins agent via SSH. To get started, I created SSH keys and made sure the server was properly connected to the agent.

After that, I created a new node, naming it ‘jenkins-agent,’ and when I launched it, I received this message.

Upon attempting to connect, I encountered an error message in the logs (shown in the picture). It turned out that I was missing the ‘known_hosts’ file at ‘/var/lib/jenkins/.ssh/’ on my Jenkins server.

To rectify this, I created the ‘known_hosts‘ file and set the appropriate ownership with ‘chown -R jenkins:jenkins /var/lib/jenkins/.ssh/know_hosts‘.

To ensure successful SSH connections, I added the Jenkins Agent’s host information using ‘ssh-keyscan‘ and appended it to the ‘known_hosts‘ file using this command.

ssh-keyscan "Jenkins-Agent IP" >> /var/lib/jenkins/.ssh/known_hosts

After these modifications, I attempted to connect the ‘jenkins-agent’ node again, and it worked without any errors.

Step 3: Pipeline Testing

In Jenkins Server, I created a freestyle project pipeline and configured Build Steps, which included three ‘Execute shell’ build steps:
1. For 15 users:

/bin/sh -xe
/opt/apache-jmeter-5.6.2/bin/jmeter -n -t /opt/apache-jmeter-5.6.2/bin/MM/15users.jmx -l /opt/apache-jmeter-5.6.2/bin/MM/mmresult.jtl

2. For 20 users:

/bin/sh -xe
/opt/apache-jmeter-5.6.2/bin/jmeter -n -t /opt/apache-jmeter-5.6.2/bin/MM/20users.jmx -l /opt/apache-jmeter-5.6.2/bin/MM/mmresult.jtl

3. For 30 users:

/bin/sh -xe
/opt/apache-jmeter-5.6.2/bin/jmeter -n -t /opt/apache-jmeter-5.6.2/bin/MM/35users.jmx -l /opt/apache-jmeter-5.6.2/bin/MM/mmresult.jtl

I configured each of these steps to run for 5 minutes.

-n: This is a command-line option for JMeter that specifies for non-GUI (command-line) mode.
-t /opt/apache-jmeter-5.6.2/bin/MM/35users.jmx: This part specifies the path to the JMX test plan file that will be executed.
-l /opt/apache-jmeter-5.6.2/bin/MM/mmresult.jtl: This part of the command specifies the path where JMeter should save the results of the test. The results will be saved in a JTL (JMeter Test Log) file format.

Next, I configured the Post-build Actions and added the result line -l /opt/apache-jmeter-5.6.2/bin/MM/mmresult.jtl to Publish Performance test result report

The results:

Conclusion

In conclusion, the testing phase was a valuable part of my study case. In my next post, I applied load to both servers and attempted to learn how to analyze the results using JMeter plugins integrated with Jenkins and Zabbix.