Giter Site home page Giter Site logo

cnxtech / venus.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linkedinattic/venus.js

0.0 0.0 0.0 1.68 MB

where bugs go to die

Home Page: http://venusjs.readthedocs.io/en/latest/

License: Other

JavaScript 99.27% Shell 0.13% CSS 0.22% Python 0.27% HTML 0.10%

venus.js's Introduction

##Dependencies

Overview

Venus is a testing tool for JavaScript (JS), which simplifies running unit tests. When you are developing a browser-based project in JS, you'll want to create unit tests and run them frequently. Typically, you'll write a unit test using some library, such as Mocha or Jasmine. These libraries let you define testcases (or "specs" if you are following a BDD style), and provide APIs for writing assertions.

To run one of your tests in the browser, you need to have a test harness page. The harness page is simply an HTML document which includes several JS files:

  • Your testing library of choice
  • Other libraries your code depends on (such as jQuery)
  • The code you want to test (such as foo.js)
  • The testcase, or spec for the code you are testing (such as foo.spec.js)
  • Some initialization code to tell the testing library to start running the tests

You may also include some DOM elements for your test to interact with, or for the testing library to display results.

For example, your test harness might look something like this:

  <!DOCTYPE html>
  <html>
  <head>
    <title>Test for Foo</title>
    <script type="text/javascript" src="lib/jquery.js"></script>
    <script type="text/javascript" src="lib/testing_library.js"></script>
    <script type="text/javascript" src="foo.js"></script>
    <script type="text/javascript" src="specs/foo.spec.js"></script>
    <script type="text/javascript">
        testLibrary.run();
    </script>
  </head>
  <body>
    <div id="results"></div>
  </body>
  </html>

then to run the test, you simply load this page in any web browser. This works, but it presents some problems:

  1. Generating this test harness page is often a manual process
  2. Running the test is a manual process of launching a browser, and visually inspecting the page for results
  3. There is often no easy way to integrate running tests from an IDE, since there is no command line output from running the test

##Venus to the rescue Venus strives to solve these problems without re-inventing the wheel. Rather than create an entirely new testing library, we set out to create a tool to make it easier for you to work with an existing library. Here are the main benefits of Venus:

  • Use Simple annotations in your tests to specify which testing library you want to use, the file you are testing, other file dependencies, and a test harness template
  • Quickly run your browser-based tests directly from the command line using PhantomJS
  • Run your tests from the command line in multiple browsers (running locally or remotely) at the same time
  • Integration with Continuous Integration tools (Selenium Grid + Travis CI)

###Annotations

In your test file, the following annotations are supported:

  • @venus-library - Indicates the testing library/framework you wish to use. QUnit, Mocha, and Jasmine are supported out of the box.
  • @venus-code - JavaScript source code under test.
  • @venus-include - Other JavaScript file dependency to include with your test suite. Use an annotation for every file you wish to include.
  • @venus-fixture - Specify either an HTML string or the name of a template under .venus/templates/.... You can also specify a path relative to where the test file resides. The contents will get included into the template specified by @venus-template.
  • @venus-template - Specify the name of the test harness template (under .venus/templates, no file extension) you want to include for your test suite.

##Get started

Visit the project page at http://venusjs.readthedocs.io/en/latest/ for more information.

venus.js's People

Contributors

sethmcl avatar soonick avatar rbakr avatar asakusuma avatar sambaek avatar jasonbelmonti avatar arazfar avatar roelrz avatar benvinegar avatar bradcypert avatar koshroy avatar aslogd avatar dnozay avatar jakobo avatar johannjacobsohn avatar leemallabone avatar redchair123 avatar tgvrssanthosh avatar wei-liu 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.