dwf/rva: results are now carrying descriptions as needed (Runner, Suite, Spec)

This commit is contained in:
pivotal 2008-12-02 14:26:47 -08:00
parent 1df1de2bb7
commit a9a6d7cbda
3 changed files with 39 additions and 34 deletions

View File

@ -80,7 +80,7 @@
<file leaf-file-name="bootstrap.html" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider selected="true" editor-type-id="text-editor">
<state line="15" column="26" selection-start="541" selection-end="541" vertical-scroll-proportion="0.47420964">
<state line="15" column="26" selection-start="541" selection-end="541" vertical-scroll-proportion="0.47342193">
<folding />
</state>
</provider>
@ -89,10 +89,10 @@
</provider>
</entry>
</file>
<file leaf-file-name="bootstrap.js" pinned="false" current="false" current-in-tab="false">
<file leaf-file-name="bootstrap.js" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="519" column="0" selection-start="14833" selection-end="14833" vertical-scroll-proportion="0.41459626">
<state line="553" column="7" selection-start="16102" selection-end="16102" vertical-scroll-proportion="0.70542634">
<folding />
</state>
</provider>
@ -101,16 +101,16 @@
<file leaf-file-name="test.css" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/test.css">
<provider selected="true" editor-type-id="text-editor">
<state line="5" column="0" selection-start="118" selection-end="118" vertical-scroll-proportion="0.14179105">
<state line="5" column="0" selection-start="118" selection-end="118" vertical-scroll-proportion="0.14157973">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="jasmine.js" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="jasmine.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="265" column="30" selection-start="5651" selection-end="5651" vertical-scroll-proportion="0.5437202">
<state line="260" column="33" selection-start="5439" selection-end="5439" vertical-scroll-proportion="0.7619048">
<folding />
</state>
</provider>
@ -313,7 +313,7 @@
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21091811" order="0" />
<window_info id="RDoc" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32933578" order="1" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32841328" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
@ -434,7 +434,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.html">
<provider selected="true" editor-type-id="text-editor">
<state line="15" column="26" selection-start="541" selection-end="541" vertical-scroll-proportion="0.47420964">
<state line="15" column="26" selection-start="541" selection-end="541" vertical-scroll-proportion="0.47342193">
<folding />
</state>
</provider>
@ -444,21 +444,21 @@
</entry>
<entry file="file://$PROJECT_DIR$/test/test.css">
<provider selected="true" editor-type-id="text-editor">
<state line="5" column="0" selection-start="118" selection-end="118" vertical-scroll-proportion="0.14179105">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="519" column="0" selection-start="14833" selection-end="14833" vertical-scroll-proportion="0.41459626">
<state line="5" column="0" selection-start="118" selection-end="118" vertical-scroll-proportion="0.14157973">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/jasmine.js">
<provider selected="true" editor-type-id="text-editor">
<state line="265" column="30" selection-start="5651" selection-end="5651" vertical-scroll-proportion="0.5437202">
<state line="260" column="33" selection-start="5439" selection-end="5439" vertical-scroll-proportion="0.7619048">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/bootstrap.js">
<provider selected="true" editor-type-id="text-editor">
<state line="553" column="7" selection-start="16102" selection-end="16102" vertical-scroll-proportion="0.70542634">
<folding />
</state>
</provider>

View File

@ -158,10 +158,6 @@ var it = function (description, func) {
currentTimeout: 0,
finished: false,
// suite: {
// next: function() {
// }},
results: nestedResults(),
expects_that: function (actual) {
@ -213,6 +209,7 @@ var it = function (description, func) {
func();
}
that.results.description = description;
return that;
}
@ -236,7 +233,9 @@ var describe = function (description, spec_definitions) {
currentRunner.suites.push(that);
spec_definitions();
that.results.description = description;
return that;
}
@ -244,6 +243,7 @@ var Jasmine = function () {
var that = actionCollection();
that.suites = that.actions;
that.results.description = 'All Jasmine Suites';
currentRunner = that;
return that;
@ -256,7 +256,7 @@ var currentSpec;
/*
* TODO:
* - add spec or description to results
//* - add spec or description to results
//* - spec.execute needs to wait until the spec is done
//* - an async test will be killed after X ms if not done and then listed as failed with an "async fail" message of some sort
//* - Suite to run tests in order, constructed with a function called describe
@ -267,7 +267,7 @@ var currentSpec;
//* - Suite rolls up spec results
//* - Suite supports asynch
//* - Runner that runs suites in order
// * - Runner supports async
//* - Runner supports async
* - HTML reporter
* - Shows pass/fail progress (just like bootstrap reporter)
* - Lists a Summary: total # specs, # of passed, # of failed

25
test/bootstrap.js vendored
View File

@ -69,21 +69,21 @@ var testMatchersReporting = function () {
reporter.test((results.length == 2),
"Results array doesn't have 2 results");
reporter.test((results[0].passed == true),
reporter.test((results[0].passed === true),
"First spec didn't pass");
reporter.test((results[1].passed == false),
reporter.test((results[1].passed === false),
"Second spec did pass");
results = [];
var expected = new Matchers(false, results);
expected = new Matchers(false, results);
expected.should_equal(true);
reporter.test((results[0].message == 'Expected true but got false.'),
"Failed expectation didn't test the failure message");
results = [];
var expected = new Matchers(true, results);
expected = new Matchers(true, results);
expected.should_equal(true);
reporter.test((results[0].message == 'Passed.'),
@ -102,10 +102,12 @@ var testSpecs = function () {
another_spec.execute();
another_spec.done = true;
reporter.test((another_spec.results.results.length == 1),
reporter.test((another_spec.results.results.length === 1),
"Results aren't there after a spec was executed");
reporter.test((another_spec.results.results[0].passed == true),
reporter.test((another_spec.results.results[0].passed === true),
"Results has a result, but it's true");
reporter.test((another_spec.results.description === 'spec with an expectation'),
"Spec's results did not get the spec's description");
var yet_another_spec = it('spec with failing expectation').runs(function () {
var foo = 'bar';
@ -114,7 +116,7 @@ var testSpecs = function () {
yet_another_spec.execute();
yet_another_spec.done = true;
reporter.test((yet_another_spec.results.results[0].passed == false),
reporter.test((yet_another_spec.results.results[0].passed === false),
"Expectation that failed, passed");
var yet_yet_another_spec = it('spec with multiple assertions').runs(function () {
@ -127,7 +129,7 @@ var testSpecs = function () {
yet_yet_another_spec.execute();
yet_yet_another_spec.done = true;
reporter.test((yet_yet_another_spec.results.results.length == 2),
reporter.test((yet_yet_another_spec.results.results.length === 2),
"Spec doesn't support multiple expectations");
}
@ -395,6 +397,8 @@ var testSpecScope = function () {
"Spec did not return false for a failed expectation");
reporter.test((suite.specs[0].results.results[1].passed === true),
"Spec did not return true for a passing expectation");
reporter.test((suite.results.description === 'one suite description'),
"Suite did not get its description in the results");
}, 1000);
}
@ -495,7 +499,6 @@ var testNestedResults = function () {
"Branch Results should have 2 passed, has " + branchResults.passedCount);
reporter.test((branchResults.failedCount === 2),
"Branch Results should have 2 failed, has " + branchResults.failedCount);
}
var testReporting = function () {
@ -525,6 +528,8 @@ var testReporting = function () {
'Expectation Passed count should be 1, but was ' + runner.results.passedCount);
reporter.test((runner.results.failedCount === 1),
'Expectation Failed count should be 1, but was ' + runner.results.failedCount);
reporter.test((runner.results.description === 'All Jasmine Suites'),
'Jasmine Runner does not have the expected description, has: ' + runner.results.description);
}, 1000);
}
@ -546,7 +551,7 @@ var runTests = function () {
setTimeout(function() {
$('spinner').hide();
reporter.summary();
}, 10000);
}, 3500);
}