यदि आप किसी पृष्ठ के लिए अपने "यूनिट" परीक्षणों के लिए स्वीकृति परीक्षण और मोचा के लिए ककड़ी-जेएस का उपयोग करना चाहते हैं, तो आप cuked-zombie (विज्ञापन के लिए खेद) का उपयोग कर सकते हैं।
GitHub पर रीडमी में वर्णित है जैसे कि यह स्थापित है, लेकिन एक फाइल में अपनी दुनिया config जगह कहा जाता है विश्व 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
};
तो इस तरह से अपनी इकाई परीक्षण में ज़ोंबी के साथ मोचा का उपयोग करें:
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;
});
स्रोत
2014-06-05 06:47:22
मेरा जवाब क्या था जो आपको दिमाग में था? – Industrial
हाँ, यही वही था जो मैं चाहता था। धन्यवाद! – Joel