Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitovi/testee-client
Testee client adapters for QUnit, Jasmine and Mocha
https://github.com/bitovi/testee-client
Last synced: about 6 hours ago
JSON representation
Testee client adapters for QUnit, Jasmine and Mocha
- Host: GitHub
- URL: https://github.com/bitovi/testee-client
- Owner: bitovi
- License: mit
- Created: 2014-06-04T22:15:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-06-09T00:30:36.000Z (over 2 years ago)
- Last Synced: 2024-10-31T20:09:27.601Z (7 days ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/testee-client
- Size: 1.32 MB
- Stars: 1
- Watchers: 49
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Testee client adapters
[![Build Status](https://travis-ci.org/bitovi/testee-client.svg?branch=master)](https://travis-ci.org/bitovi/testee-client)
Testee client side adapters for Mocha, QUnit and Jasmine (1 and 2) that convert test results into Feathers service calls (`runs`, `suites`, `tests` and `coverages`).
## Initializing options
In your test page you can set Testee options using `window.Testee`.
### BaseURL
By default, the client will use the url the tests are running at (`window.location.protocol + '//' + window.location.host`). you can change this using the `baseURL` option:
```html
window.Testee = {
baseURL: 'http://testee-server.com/'
}```
### Provider
By default, the client will use socket.io to make Feathers service calls. You can change this to use REST by specifying the `provider` option:
```html
window.Testee = {
provider: {
type: 'rest'
}
}```
### Socket
You can provide your own socket instance to make Feathers service calls using the `socket` option:
```html
window.Testee = {
socket: io('http://testee-server.com/')
}```
## Asynchronous Loading
When loading files asynchronously, you need to stop your testing framework from running until all test files are loaded. Then call `window.Testee.init()`. If you're using [steal](https://www.npmjs.com/package/steal), you can use the [steal-mocha](https://www.npmjs.com/package/steal-mocha), [steal-qunit](https://www.npmjs.com/package/steal-qunit) or [steal-jasmine](https://www.npmjs.com/package/steal-jasmine) libraries.
### Mocha
```html
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
mocha.run();
});```
### QUnit
```html
QUnit.config.autorun = false;
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
QUnit.load();
});```
### Jasmine
```html
define(['tests.js'], function() {
if(window.Testee) {
window.Testee.init();
}
window.onload();
});```
## A test flow:
```js
var ids = {
run: guid(),
suite: guid(),
childsuite: guid(),
testpass: guid(),
testfail: guid()
};Testee.start({
id: ids.run,
environment : navigator.userAgent,
runner : 'Jasmine'
});Testee.suite({
"title": "Main test suite title",
"root": true, // If it is the root level test suite
"id": ids.suite,
"parent": runId
});Testee.suite({
"title": "Child test suite",
"parent": ids.suite,
"id": ids.childsuite
});Testee.test({
"title": "The test title",
"parent": ids.childsuite, // Parent suite id
"id": ids.testpass
});Testee.pass({
"duration": 0,
"id": ids.testpass
});Testee.testEnd({
"id": ids.testspass
});Testee.test({
"title": "A failing test",
"parent": ids.childsuite,
"id": ids.testfail
});Testee.fail({
"id": ids.testfail,
"err": {
"message": "expected 1 to equal 2",
"stack": "Error: expected 1 to equal 2\n at Assertion.assert (/Users/daff/Development/node/swarmling/node_modules/expect.js/expect.js:99:13)\n CUSTOM STACK TRACE"
}
});Testee.testEnd({
"id": ids.testfail
});Testee.suiteEnd({
"id": ids.childsuite
});Testee.suiteEnd({
"id": ids.suite
});Testee.end({});
```