DevOps Automation

 View Only

Tips & Tricks - Using Rules Files with DevOps Test Performance

By Jerry Shengulette posted 3 days ago

  

The Rules

You just finished recording a performance test. You selected all the domains to include. The Test Generation dialog box appears on your monitor.

If you have spent any time watching the status bar, you understand a lot of time is spent on the “Correlating data…” step.

Your recording is a series of requests to and responses from your server. Sometimes server responses have data that directly relates to later requests.  Correlating data is the step that makes multiple passes through these requests and responses, seeking out these relationships and making sure that they are reflected in your test.

The process is rarely comprehensive, and it cannot be so because every application-under-test (AUT) is different. Different developers structure their applications differently. Many have different interpretations of the guidelines of HTTP. Some embed crucial variables in URLs. Others created custom headers to convey similar values.

Even when out-of-the-box (or automatic) data correlation is complete, the overall correlation process may not be complete.

Manual data correlation is a DevOps Test Performance feature that allows testers to supplement the automatic data correlation process to cover the nuances of their AUTs. It’s certainly a non-trivial feature. It requires an intimate understanding of the HTTP requests and responses that make up the AUT. It often requires a working knowledge of regular expressions. Neither of those topics is covered in any depth here.

The product support team recognizes that manual data correlation is non-trivial. The activity involves combing through hundreds, if not thousands, of bytes of HTTP traffic looking for “interesting” strings in the hopes of spotting something that is truly dynamic. The process is usually iterative as well, meaning finding and fixing one correlation often reveals another further on in the test.

That is a lot of text stating that “manual data correlation is hard.” Rules are a means of  easing this.

How Rules Files Are Created

If you have ever edited a performance test, you have seen this dialog when you attempt to save the test.

Clicking “Yes” begins the process of creating a rules file. Anecdotally, most users do not create rules files because most users do not attempt correlation on their own. By and large, support engineers create rules files.

How to Use Rules

You received a rules file from the product support team. What now?

This is a screen shot of part of the Test Navigator panel in a Test Performance project. We will be working with myNewTest, myRulesFile1 and myRulesFile2.

There are multiple ways to accomplish this. None is “best”, but you can choose based on personal preferences and the context of your current activity.

Re-correlating From the Test Editor

You are actively editing a performance test script. You make some changes, save the test and create or append to a rules file. You want to see if the rules accomplish their desired effect.

Open the test in the test editor.

Highlight the top level of the test (as shown above).

Right click to select Data Correlation > Re-correlate test data using rules.

A new pop-up will appear.

The top part can be ignored for re-correlation purposes, in most cases.

Check all three checkboxes near the bottom.

Notice that the dialog box expands a bit. The Add button is used to add the rules to be used in the re-correlation.  Click the Add button.

Expand the entry.

The project myProj has three rules files available. As noted above the intent is to use myRulesFile1 and myRulesFile2. Using the Ctrl key in conjunction with a left click both can be selected.

One longtime fan of the blog asked, “Why are there 2 rules files?”. Most users tend to lump all their rules into a single file. There is nothing wrong with that. The intent here was to illustrate that you can have multiple rules files. For instance, you might have a rules file that deals with SSO login correlation, another rules file for correlating ViewState values that are becoming ubiquitous, and finally some rules for Webkit forms. In theory, such compartmentalization would make you more efficient in future work since the next application you record might need SSO rules, but not need Webkit forms rules.

Click OK.

The selected rules now appear in the box.

Click Finish.

The test will be re-correlated. It may take a few minutes depending on the size of the test and the complexity of the rules.

Re-correlating From the Test Navigator

You just received a new rules file, which you need to apply to some old tests for which you might not have the original recordings.

Right click on the test to be re-correlated, using myNewTest for the example.

Select Apply data correlation rules...

This brings up the pop-up shown in the other example.

Again, check the three boxes highlighted.

Use the Add button to select the rules to be applied.

Click OK.

Click Finish.

Correlating During Recording Process

When we create rules files, one of the things we tell testers is that ‘these will be helpful for any new recordings against this same server application.” Here is how that works:

Create a new test. This example uses File > New > Test From Recording.

Choose HTTP Test. Click Next.

Provide a new file name for the recording.
Check the box for “Customize automatic data correlation”.
Click Next.

The key thing is checking that box. This provides an opportunity to include a rules file.

Choose your browser. Click Next.

Configure your browser recorder settings, as usual. Click Finish.

Step through recording your application, as usual.

At the end of recording close your browser.

A new window will appear when the browser disappears.

Since you now have a rules file, check both boxes. You want to continue to take advantage of automatic correlation AND supplement that with your rules.

Click the Add button.
Select the appropriate rules file(s).

Click OK.

Click Next to prune the domains for your test.

Click Finish.

Your new test is created using built-in automatic correlation rules AND your rules files.

Re-correlating from Older Recordings

Ideally, when you receive a new set of rules and you have older tests, you also have the recording files used to create those tests. I like to apply rules to recordings because it allows maximum flexibility. For example, I can also doublecheck the domains selected for the test as part of the process.

Recording session files are recognizable by the “red dot” icon.

In the example, a rules file – myRulesFile1 – was developed through editing myNewTest. There is also an old recording present – myOldTest.

Right-click on myOldTest recording in the Test Navigator.

Select “Generate Test…”.

Select “HTTP Test”.

Click Next.

Provide a meaningful Test name.

Check the box next to “Customize automatic data correlation”.

Click Next.

Check both boxes: “Do automatic data correlation” AND “Do rule-based data correlation”.

Use the Add button to browse you the rules file you need to use.

Click Next.

Select the domains to be included in your test.

Click Finish.

As the test is generated, automatic correlation AND the new rules will be applied in the new test.

Embrace the Rules

At the risk of this sounding like a lecture to my children, rules exist to make your life easier. They are not simple to create or to read, but they are simple to employ. As your journey through performance testing continues, make use of them at every opportunity.

0 comments
1 view

Permalink