By Matt Harrington
With the development and performance testing of the new Responsive Delivery feature of PhishMe, it became apparent early on that there was a need to be able to generate valid Exchange subscription notifications for actual mail user actions. During initial development, it was sufficient to develop and test with one or two actual exchange users by signing onto their respective test accounts and performing actions in their respective mailboxes. However, as development of the feature progressed and the performance of the feature was more of a concern, there became a need for a method to generate tens of thousands, or even hundreds of thousands, of valid Exchange user event notifications without human intervention. JMeter and Taurus were looked at as viable methods to create the number of notifications we wanted, but we could not simulate that number of valid subscriptions or valid notifications for those subscriptions. With a bit more research, we discovered that we could run custom groovy code as a JMeter JSR223Sampler and have that groovy code perform the desired actions both at random and at high volume.
To do this for Exchange mail users, we coded up some groovy to randomly connect to a test user (1 of 45000 created in our in-house Exchange instance) and perform various mailbox actions. You can do this with any of the various Microsoft Exchange APIs available like the Exchange Web Services API, JWebServices API, or even Microsoft’s Graph API
Now, by creating a JMeter jmx file to include a JSR223Sampler test (either by hand or via the JMeter UI), you can run that groovy code with JMeter by calling out your groovy filename and the scriptLanguage of “groovy”:
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" enabled="true">
Lastly, you could configure the test threads and run time and execute that test right from the JMeter UI, or you can configure a test run with a yaml file and run it using BlazeMeter Taurus via the command line. To configure the Taurus yaml, create your execution section with your threading, iteration, and/or run time specifics and a scenario section that calls out the jmx file created above. See http://gettaurus.org/docs/ConfigSyntax/ for more info on this. Here is an example:
- executor: jmeter
Add a user.classpath property for any libraries that your groovy code may require in order to run. In the case of Exchange, you want this classpath to be able to find the JWebServices jar.