Giter Site home page Giter Site logo

fixture-proxy's Introduction

Proxy for Serving Test Fixtures

A Proxy implementation based on Node.js that is used for serving locally part of the HTTP requests, while redirecting the rest to their original destination.

It is based on another (more traditional) proxy implementation at: https://github.com/pkrumins/nodejs-proxy

Who is it for?

This proxy is for developers and testers who are developing (or testing) the GUI of a web application.

Since the API that is serving some of the data, for AJAX calls or simple Form calling either does not exist yet, or might return different results each time, it is easier if you can control the content of some of these responses.

When using Selenium and WebDriver for checking the validity of the GUI, it is best to be able to expect specific values to be displayed. If the server might return different values, the test might be too general ("Is there a button?", "Is there a category list?"), or might break too often. When fixing the server response, it is possible to test for specific values ("Are there 5 categories displayed?").

It is also possible to modify the server responses and create extreme values (for example, "No Categories", "Many Categories", "Duplicate Categories", "Long name Categories"...). This can be done easily as part of the test by modifying the local text file.

How to make it work?

After installing node.js, simple download the zipped project, unzip it and

 > node proxy.js

Then configure your browser proxy setting to:

Host : localhost port : 3000

In Firefox: Preferences (CMD+,) -> Advanced -> Network -> Connection -> Settings... -> Manual Proxy Configuration

In Chrome: Settings (CMD+,) -> Show Advanced Settings -> Network -> Change Proxy Settings...

You can make sure that you installed everything correctlly, you can go to node.js site, and you should see a gray cicle around the logo which was sevrved from the local proxy.

How to add Local Fixtures?

The local files should include the full URL address: (var file = 'http://www.domain.com/API/DataAPI/...more path.../...&query=value&...')

  • update each local URL path in the ./localFiles list
  > echo "http://nodejs.org/images/logo.png" >> ./localFiles

You should use the local proxy mainly for text files (JSON responses), but it should work for image files as well.

  • update its content into their MD5 files

You can discover the name of the local file by using md5.js utility

  > node md5.js "http://nodejs.org/images/logo.png"
27 May 15:47:55 - url is:http://nodejs.org/images/logo.png
27 May 15:47:55 - MD5 is:66b7938bb7d32e555eafea6a1f1ad533

fixture-proxy's People

Stargazers

Persona A avatar JT5D avatar Maksim Kozhukh avatar Danilo Poccia avatar Guy avatar

Watchers

evandrix avatar Guy avatar James Cloos avatar

fixture-proxy's Issues

Saving responses automatically

If a URL is added to the localFiles list and its local file doesn't exists, it will be created automatically and the content from the web will be stored at the first time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.