JMeter does not support Dubbo interface testing by default, but it can be done through extended plug-ins or JAR packages.

JMeter plug-in extension

1.1 Plug-in Download

To test Dubbo, we need to download the Dubbo plugin, which is available on GitHub:

Github.com/thubbo/jmet…

Click enter, here we select the current latest version 2.7.8 to download.

1.2 Plug-in Installation

Once the plug-in is downloaded, simply place the JAR package into the Ext folder in JMeter’s lib.

Because of my JMeter is to use the Mac Homebrew installed, so my path is/usr/local/Cellar/JMeter 5.3 _1 / libexec/lib/ext, specific according to their installation path finding. As you can see below, my JAR package has been put in.

% the PWD/usr/local/Cellar/jmeter 5.3 _1 / libexec/lib/ext % ls | grep jmeter - plugins - dubbo - 2.7.8 - jar - with - dependencies. The jar Jmeter - plugins - dubbo - 2.7.8 - jar - with - dependencies. The jarCopy the code

1.3 restart the JMeter

Restart The Jmeter sampler to see the presence of Dubbo Sample.

Preparing test interfaces

Here is a test demo of Dubbo that is prepared locally. The provider method is as follows:

public class UserServiceImpl implements UserService { @Override public List<UserAddress> getUserAddressList(String UserId) {UserAddress userAddress1 = new UserAddress(1, "xihu ", "1", "Tester1", "12345678", "Y"); UserAddress userAddress2 = new UserAddress(2, "yuhang ", "2", "Tester2", "12345678", "N"); return Arrays.asList(userAddress1, userAddress2); }}Copy the code

Dubo-admin to check whether the current service has been provided:

Test the Dubbo interface

We chose to test the interface directly, using Dubbo’s generalization call, without knowing the registry, just the service interface, method name, and service provider address. The Dubbo generalization call will be covered separately later.

3.1 Modifying The Configuration

After opening the Dubbo Sample, we will see the configuration as shown in the figure above (it may change according to different versions). If the same situation occurs, delete “1.0” in Version, otherwise it will affect our parameter transmission, and then fill in the interface information as follows:

  • Note: The type of the input parameter must be in the full type format of the Java data type.

3.2 Result Presentation

Run the test and view the test result as follows:

You can see that the interface responded successfully, and the result returned successfully, testing the Dubbo interface successfully.

(Article from Hogwarts Testing Institute)

More technical articles can be found at qrcode.testing-studio.com/f?from=juej…