JsTestDriverを使い始めたばかりで、環境が正しく構成されているかどうかを確認するための非常に単純なデモコードを作成しました。ただし、Firefoxを(JsTestDriverを介して)起動すると、約40〜50%の確率で、「起動中にFirefoxが予期せず閉じられました」というエラーが発生します。
Chromeを使用している場合、このエラーは発生しません。
私の環境は次のもので構成されています。
- Ubuntu 10.04.4LTS32ビットを実行しているVirtualBox4.1.18
- Firefox 13.0.1
- JsTestDriver-1.3.4.b
- openjdk-6-jre-ヘッドレス
私は実行しています:
java -jar /home/developer/bin/JsTestDriver.jar --port 9876 --browser /usr/bin/firefox --tests all --testOutput results
私のJsTestDriver構成は次のとおりです。
server: http://localhost:9876
load:
- src/*.js
test:
- test/*.js
timeout: 10
ソースコード(テスト中のコード)は次のとおりです。
Person = function()
{
this.firstName = "";
this.lastName = "";
this.fullName = function()
{
if((this.firstName != "") && (this.lastName != ""))
{
return this.lastName + ", " + this.firstName;
}
var name = this.firstName + " " + this.lastName;
return name.trim();
}
};
テストコード(JsTestDriverベースのコード)は次のとおりです。
PersonTest = TestCase("PersonTest");
PersonTest.prototype.testFullName = function()
{
fixture = new Person();
fixture.firstName = "John";
fixture.lastName = "Doe";
assertEquals("Doe, John", fixture.fullName());
};
PersonTest.prototype.testFullName_FirstNameOnly = function()
{
fixture = new Person();
fixture.firstName = "John";
assertEquals("John", fixture.fullName());
};
PersonTest.prototype.testFullName_LastNameOnly = function()
{
fixture = new Person();
fixture.lastName = "Doe"
assertEquals("Doe", fixture.fullName());
};
ありがとう!