Sample - acastaner/harhar GitHub Wiki

For this example we took a HAR file generated from visiting http://www.spirent.com.

Reviewing File Hierarchy

We ran Harhar against the file generated by Chrome, like so:

C:\Users\acastaner\Harhar>harhar.exe www.spirent.com.har

This commanded started Harhar, which parsed the specified HAR file and created the following file hierarchy:

  • 6-25-2014_14-58-34 (because we ran the command on June 25th 2014 at 14h58:34)
    • www.spirent.com.har (because that’s the name of the source HAR file)
      • 253-hre-064.mktoresp.com
        • (more subdirectories)
    • ajax.aspnetcdn.com
      • (more subdirectories)
    • ajax.googleapis.com
      • (more subdirectories)
    • (more directories)

Each hostname has its own directory and subdirectories. This allows the user to upload all those files under the same HTTP Transaction Profile in Avalanche, and assign that Transaction Profile to one or more server IPs in their test. There are 12 hostnames in that test, so we will need to create as many Transaction Profiles in Avalanche Commander.

Server Configuration

Note: This test case requires creating an Advanced Device test.

First we will create all the Transaction Profiles on the server side. Create a new profile, name it “www_spirent_com” and in “Body Content Type” choose “Files from directory.” Now on “Select a directory” click on the box to create a new one, then browse to where Harhar parsed the spirent.com record, and choose the “www.spirent.com” directory:

Avalanche Commander will import all the files from that directory and shouldn’t trigger any error (since Harhar sanatizes all the file names during import). Repeat this step for all the directories. Now we need to create the Server Profiles that will return each of these Transaction Profiles. On the Server/Profiles tab, create a new server named “www_spirent_com” and in the “Transaction Profile” make sure you associate the right profile ; www_spirent_com in that case.

Repeat this step until each Transaction Profile is tied to a Server Profile. Once this is done, create the appropriate associations and assign fitting IP addresses to these servers. I used IP 192.168.1.20 through .31:

Client Configuration

The clients need to know the action they must execute. Harhar generates a text file with all the actions you followed when the HAR record was created (action_list.txt), so you simply need to copy/paste its content into an Action List. I will create a “Spirent_com_visitor” action list like this.

In our Action List we use hostnames in the URIs, which is realistic but requires extra configuration.

Using a DNS Server in the Test Bed

You possibly have a DNS server in your test bed, in which case you need to tell Avalanche to use it from the test port as well as specify the IP address. For instance if your DNS is on 10.10.20.30, use this configuration:

Using a DNS Hosts File

If you don’t have a DNS server handy you can tell Avalanche which IP address corresponds to a Hostname. Note that in that case no DNS request will be sent by the clients, which may or may not be suitable. If the device you test is also in charge of handling the DNS requests in real life (a Customer Premises Equipment for instance) it’s imperative that your test case also sends these requests.

To create a DNS Host File click on Client/Profile and then on the “DNS” tab. Then check the box “Use a DNS Hosts file” and then create the file. On the new window you will be able to input the hostnames and the corresponding IPs :

To finish we’ll simply need to create a Client Association with that action list and the profile holding the DNS Hosts file, and it should all work.

That completes the example on how to use Harhar.