Code Monkey home page Code Monkey logo

brtapsauce's Introduction

brtapsauce

Browserify TAP test runner for SauceLabs

Extending sauce-tap-runner with automatic Browserify bundling, test queueing and execution and SauceLabs passed-status setting. brtapsauce can be used for automated tests with Travis-CI, Drone.io, or other CI system.

Usage

Assuming you have a browserifyable file that bundles and executes tap tests (see tape).

Create a test.js file something like this:

const user       = process.env.SAUCE_USER
    , key        = process.env.SAUCE_KEY
    , path       = require('path')
    , brtapsauce = require('brtapsauce')

      // list of browsers & versions that you want to test
    , capabilities = [
          { browserName: 'chrome'            , platform: 'Windows 8' , version: ''   }
        , { browserName: 'firefox'           , platform: 'Windows 8' , version: ''   }
        , { browserName: 'internet explorer' , platform: 'Windows 8' , version: '10' }
        , { browserName: 'internet explorer' , platform: 'Windows 7' , version: '9'  }
        , { browserName: 'internet explorer' , platform: 'Windows 7' , version: '8'  }
        , { browserName: 'internet explorer' , platform: 'Windows XP', version: '7'  }
        , { browserName: 'internet explorer' , platform: 'Windows XP', version: '6'  }
        , { browserName: 'safari'            , platform: 'Windows 7' , version: '5'  }
        , { browserName: 'opera'             , platform: 'Windows 7' , version: ''   }
        , { browserName: 'ipad'              , platform: 'OS X 10.8' , version: '6'  }
        , { browserName: 'android'           , platform: 'Linux'     , version: '4.0', 'device-type': 'tablet' }
      ]

if (!user)
  throw new Error('Must set a SAUCE_USER env var')
if (!key)
  throw new Error('Must set a SAUCE_KEY env var')

brtapsauce({
    name         : 'Project Name'
  , user         : user
  , key          : key
  , brsrc        : path.join(__dirname, 'browserify.js')
  , capabilities : capabilities
})

Then in your package.json:

"scripts": {
  "test-local" : "brtapsauce-local test/browserify.js"
  "test"       : "test/sauce.js"
}

You can then use npm test to execute your tests on SauceLabs or use npm run-script test-local to start a local server that you can run local browsers on.

For CI (Travis, Drone.io or other), you just need to set the SAUCE_USER and SAUCE_KEY environment variables and let npm test do its thing.

Be aware that the first run will take longer as Sauce-Connect.jar is downloaded if it's not available. Also, the tests run in series due to a limitation in sauce-tap-runner.

License

brtapsauce is Copyright (c) 2013 Rod Vagg @rvagg and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

brtapsauce's People

Contributors

conradz avatar rvagg avatar sorribas avatar

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.