- ×Show All
- Venus.js Mailing List: https://groups.google.com/forum/#!forum/venusjs
- irc: #venusjs on freenode
- Documentation: http://venusjs.readthedocs.io/en/latest/
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:
then to run the test, you simply load this page in any web browser. This works, but it presents some problems:
- Generating this test harness page is often a manual process
- Running the test is a manual process of launching a browser, and visually inspecting the page for results
- 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)
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-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.
Visit the project page at http://venusjs.readthedocs.io/en/latest/ for more information.