Non ho abbastanza punti per aggiungere un commento alla risposta @jbpros, ma è necessario notare che Scenario Outlines sono ora completi in cucumber.js come indicato here.
Ad esempio:
mondo:
// features/support/world.js
var zombie = require('zombie');
var World = function World(callback) {
this.browser = new zombie(); // this.browser will be available in step definitions
this.visit = function(url, callback) {
this.browser.visit(url, callback);
};
callback(); // tell Cucumber we're finished and to use 'this' as the world instance
};
exports.World = World;
Caratteristica:
Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
| 200 | 65 | 135 |
| 200 | 5 | 194 |
Passi Definizione:
var aTest = function() {
this.World = require("../support/world.js").World;
this.start = 0;
this.eat = 0;
this.Given(/^there are (\d+) cucumbers$/, function(number, next) {
this.start = parseInt(number);
callback();
});
this.When(/^I eat (\d+) cucumbers$/, function (number, next) {
this.eat = parseInt(number);
callback();
});
this.Then(/^I should have (\d+) cucumbers$/, function (number, next) {
var left = this.start - this.eat;
if (left != number)
callback.fail(new Error("This test didn't pass, I started with: " + this.start
+ ", ate: " + this.eat
+ " and was left with: " + left
+ ". Expected: " + number));
callback();
});
};
module.exports = aTest;
fonte
2014-05-08 03:28:24
Cosa si intende per test automatizzati. Chiedo perché lei menziona Selenium, che è per test di integrazione e Jasmine che è per test unitari. –
Ciò che intendo è che voglio che i miei test vengano eseguiti automaticamente senza dover testare manualmente ciascuna funzionalità nel browser. Pensavo che Jasmine fosse uno strumento BDD. – chchrist