se si desidera utilizzare cetriolo-j per i test di accettazione e moka per i test di "unità" per una pagina, è possibile utilizzare cuked-zombie (mi dispiace per la pubblicità).
installarlo come descritto nel readme su github, ma posto tuo config mondo in un file chiamato mondo-config.js
`/* globals __dirname */
var os = require('os');
var path = require('path');
module.exports = {
cli: null,
domain: 'addorange-macbook': 'my-testing-domain.com',
debug: false
};
Quindi utilizzare moka con zombie nei vostri test di unità in questo modo:
var chai = require('chai'), expect = chai.expect;
var cukedZombie = require('cuked-zombie');
describe('Apopintments', function() {
describe('ArrangeFormModel', function() {
before(function(done) { // execute once
var that = this;
cukedZombie.infectWorld(this, require('../world-config'));
this.world = new this.World(done);
// this inherits the whole world api to your test
_.merge(this, this.world);
});
describe("display", function() {
before(function(done) { // executed once before all tests are run in the discribe display block
var test = this;
this.browser.authenticate().basic('maxmustermann', 'Ux394Ki');
this.visitPage('/someurl', function() {
test.helper = function() {
};
done();
});
});
it("something on the /someurl page is returned", function() {
expect(this.browser.html()).not.to.be.empty;
});
fonte
2014-06-05 06:47:22
La mia risposta era ciò che avevate in mente? – Industrial
Sì, è quello che volevo. Grazie! – Joel