現在、フツパーのユーザーはあまりいないと思いますが、ここで何人か見つけられることを願っています。
私は Pavlov のデモを作成しているので、従来の QUnit テストと対比し、私のチームに BDD の利点を示すことができます。途中で Chutzpah に出くわし、自分のプロジェクトに統合するのは本当にクールだろうと思いました。
ブラウザでテストを右クリックして実行すると、どちらも正常に動作しますが、VS でテストを右クリックして実行すると、次のエラーが発生します。
------ Test started: File: C:\Users\U0120711\Documents\Visual Studio 2010\Projects\Behave\StaticContent\tests\Calculator\calculatorTest.js ------
Chutzpah Error Occured:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at Chutzpah.TestResultsBuilder.Build(BrowserTestFileResult browserTestFileResult)
at Chutzpah.TestRunner.RunTestsFromHtmlFile(String headlessBrowserPath, TestOptions options, TestContext testContext, List`1 testResults, ITestMethodRunnerCallback callback)
at Chutzpah.TestRunner.RunTests(IEnumerable`1 testPaths, TestOptions options, ITestMethodRunnerCallback callback)
While Running:C:\Users\U0120711\Documents\Visual Studio 2010\Projects\Behave\StaticContent\tests\Calculator\calculatorTest.js
========== Total Tests: 0 passed, 0 failed, 0 total ==========
ここに私のテストがあります:
パブロフ仕様:
/// <reference path="../../js/External/jQuery/jquery-1.7.1.js" />
/// <reference path="../../js/External/qunit/qunit.js" />
/// <reference path="../../js/External/pavlov/pavlov.js" />
/// <reference path="../../js/Calculator/Calculator.js" />
pavlov.specify("The behavior of a calculator", function () {
describe("Calculator", function () {
var calculator;
before(function () {
calculator = new Calculator();
});
given([2, 0], [3, 0], [4, 0]).
it("returns zero when multiplying by zero", function (x, y) {
assert(0).equals(calculator.multiply(x, y));
});
given([2, 1], [3, 1], [4, 1]).
it("returns the multiplicand when multiplying by one", function (x, y) {
assert(x).equals(calculator.multiply(x, y));
});
});
});
QUnit テスト:
/// <reference path="../../js/External/jQuery/jquery-1.7.1.js" />
/// <reference path="../../js/External/qunit/qunit.js" />
/// <reference path="../../js/Calculator/Calculator.js" />
var calculator;
module("Calculator", {
setup: function () {
calculator = new Calculator();
}
});
$.each([[2, 0], [3, 0], [4, 0]], function (index, pair) {
test("given " + pair[0] + "," + pair[1] + ", returns zero when multiplying by zero", function () {
equal(0, calculator.multiply(pair[0], pair[1]));
});
});
$.each([[2, 1], [3, 1], [4, 1]], function (index, pair) {
test("given " + pair[0] + "," + pair[1] + ", returns the multiplicand when multiplying by one", function () {
equal(pair[0], calculator.multiply(pair[0], pair[1]));
});
});
VS エラーの原因となる可能性のあるテストで実行していることはありますか? または、まだ見つかっていないバグ修正がどこかにありますか?
どんなヒントでも歓迎しますが、私は欠陥をよく知っているので、私の一般的なテスト戦略についてコメントすることは控えてください. これはあくまでも例です:)