API Testing – DHC supports HTTP Archive v1.2 (HAR)

API Testing – DHC supports HTTP Archive v1.2 (HAR)

The new DHC version 1.2.10 supports HTTP Archive (HAR).  You can import HAR directly to DHC and start testing your API endpoints in a second, now! This article shows you how it works, and how easily you can do that.HAR is a common format for recording HTTP tracking information. HAR format is flexible enough and is adopted across projects and various tools. E.g. You can easily export intercepted HTTP communication as HAR file with Chrome DevTools.DHC has a concept of a repository, a place where to store your scenarios, tests, or just plain HTTP requests/responses. You can put a content to a repository manually by click on a save button. Moreover, you can import an existing content made by your teammates, or produced by 3rd party software.DHC version 1.2.10 supports three formats to import: How to import HAR to DHC?I suppose you have DHC installed. In case you have not, please go to Chrome Store and click on install button.When DHC is launched you should see something similar to the screenshot below.

image-1DHC UI showing a repository

 Please click on the repository import button and select ‚ÄòImport HAR 1.2' format. It opens a dialog where you can select a source of HAR. You may choose between a plain file stored on your disk (‚ÄòFile'), or to import HAR from an URL (‚ÄòURL'), or just to copy and paste HAR as a plain text (‚ÄòRaw text').image-2

DHC HAR import dialog

 I will import HAR from a locally stored file that was made with using of Chrome DevTools. For a demonstration it just contains a track of HTTP communication performed by a browser when opening Restlet home page.image-3

Creation of XHR with using of Chrome DevTools

 When you do import HAR into DHC all HTTP requests stored in the archive are shown in DHC repository. You just click on one and everything is ready to start playing!image-4

XHR imported into DHC

 Don't forget you can easily turn plain requests into unit tests by adding assertions and that you can also create complex scenarios based on it.Please note HAR support is still in a preview. Feel free to contact support in case you run into any issue or if you get stuck on something.