Skip to content

andremalan/mockbuilder

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 3 commits ahead, 1 commit behind jakefeasel:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

#Mock Builder

This project takes HTTP Archive Files (.har) and translates them into Sinon.js Ajax Mocks.

Get the HAR files from the Chrome Developer Tools network panel. After your browser has generated some traffic, you can right click in the transaction log and select "Save as HAR with Content". Save the files into the "hars" subfolder. This project translates those HAR files into Mock requests which could be useful for things like unit tests. The translated mocks will be put into the "mocks" folder with the same name as the .har file.

##How to install

Install as a standard node package

npm install

Using the command line from this folder, execute this command:

grunt

This will enable the folder monitoring process, allowing new and changed .har files to be automatically translated into mocks.

##Configuration

all config changes can be made to: config.js

###url

When making requests to a local server, the base url that sinon expects will be /. You can edit config.js to switch the url to be whatever the external url was. So if you grab your mocks from "example.com" and have the url set to that in the config, sinon will then treat any calls to "example.com/foo" as calls to "/foo".

###outputLocation

To automatically copy the mocks into a folder in your application, you can modify outputlocation to save to anywhere you would like.

About

Quickly turn HTTP Archive (.har) files into AJAX test mocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.9%
  • Harbour 2.1%