3 new revisions:

Revision: ca23a911e0e3
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:16:38 2011
Log:      webcontent: test and suite message
http://code.google.com/p/robotframework/source/detail?r=ca23a911e0e3

Revision: 642282c44872
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:29:15 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=642282c44872

Revision: dce6fe89e080
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:54:00 2011
Log:      webcontent: Parent teardown + test failure
http://code.google.com/p/robotframework/source/detail?r=dce6fe89e080

==============================================================================
Revision: ca23a911e0e3
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:16:38 2011
Log:      webcontent: test and suite message
http://code.google.com/p/robotframework/source/detail?r=ca23a911e0e3

Modified:
 /src/robot/webcontent/js/model.js
 /src/robot/webcontent/js/testdata.js
 /src/robot/webcontent/spec/ParsingSpec.js

=======================================
--- /src/robot/webcontent/js/model.js   Tue Jun  7 06:28:06 2011
+++ /src/robot/webcontent/js/model.js   Wed Jun  8 03:16:38 2011
@@ -21,6 +21,7 @@
         suite.populateKeywords = createIterablePopulator("Keyword");
         suite.populateTests = createIterablePopulator("Test");
         suite.populateSuites = createIterablePopulator("Suite");
+        suite.message = data.message;
         suite.children = function () {
return suite.keywords().concat(suite.tests()).concat(suite.suites());
         };
@@ -29,13 +30,6 @@
         suite.hasTeardownFailure = function () {
return suiteTeardownFailed(suite) || data.status.parentSuiteTeardownFailed;
         };
-        suite.getFailureMessage = function () {
-            if (data.status.parentSuiteTeardownFailed)
-                return "Teardown of the parent suite failed.";
-            if (suite.hasTeardownFailure())
-                return "Suite teardown failed:\n" +
- suite.keyword(suite.numberOfKeywords - 1).message(0).text;
-        };
         suite.searchTests = function (predicate) {
             var tests = [];
             for (var i = 0; i < this.numberOfSuites; i++)
=======================================
--- /src/robot/webcontent/js/testdata.js        Tue Jun  7 07:42:34 2011
+++ /src/robot/webcontent/js/testdata.js        Wed Jun  8 03:16:38 2011
@@ -91,31 +91,40 @@
     }

     function createTest(suite, element) {
+        var statusElement = last(element);
         var test = model.Test({
             parent: suite,
             name: get(element[1]),
             doc: get(element[4]),
             timeout: get(element[2]),
             isCritical: (element[3] == "Y"),
- status: createStatus(last(element), suite.hasTeardownFailure()),
-            message: get(last(last(element))),
-            times: model.Times(times(last(element))),
+ status: createStatus(statusElement, suite.hasTeardownFailure()), + message: createMessage(statusElement, suite.hasTeardownFailure()),
+            times: model.Times(times(statusElement)),
             tags: tags(last2(element))
         });
test.populateKeywords(Populator(element, keywordMatcher, childCreator(test, createKeyword)));
         return test;
     }
+
+    function createMessage(statusElement, hasSuiteTeardownFailed) {
+        if (statusElement.length == 4)
+            return get(statusElement[3]);
+        if (hasSuiteTeardownFailed)
+            return 'Teardown of the parent suite failed.';
+        return '';
+    }

     function createSuite(parent, element) {
+        var statusElement = last2(element);
         var suite = model.Suite({
             parent: parent,
             name: element[2],
             source: element[1],
             doc: get(element[3]),
- status: createStatus(last2(element), parent && parent.hasTeardownFailure()), - // TODO: Add message to suite. Following ought to work but breaks 40+ specs...
-            // message: get(last(last2(element))),
-            times: model.Times(times(last2(element))),
+ status: createStatus(statusElement, parent && parent.hasTeardownFailure()), + message: createMessage(statusElement, parent && parent.hasTeardownFailure()),
+            times: model.Times(times(statusElement)),
             statistics: suiteStats(last(element)),
             metadata: parseMetadata(element[4])
         });
=======================================
--- /src/robot/webcontent/spec/ParsingSpec.js   Wed Jun  1 03:41:18 2011
+++ /src/robot/webcontent/spec/ParsingSpec.js   Wed Jun  8 03:16:38 2011
@@ -247,10 +247,10 @@
                                      ["test",1,0,"Y",0,
["kw",2,0,3,0,["P",0,1]],[],["P",-1,2]],["P",-2,3],
                                       [1,0,1,0]],
- ["teardown",4,0,5,0,[3,"F",6],["F",2,2]],["F",-37,41],[1,0,1,0]], + ["teardown",4,0,5,0,[3,"F",6],["F",2,2]],["F",-37,41, 7],[1,0,1,0]],
                                     ,[]];
         window.strings =["*","*Testt","*NoOp","*Does nothing.",
-                         "*Fail","*Fails","*AssertionError"];
+ "*Fail","*Fails","*AssertionError", "*Suite teardown failed:\nAssertionError"];
     });

     it("should show test status as failed", function (){
@@ -265,17 +265,17 @@

it("should show test message 'Teardown of the parent suite failed.'", function (){
         var test = window.testdata.suite().suite(0).test(0);
- expect(test.getFailureMessage()).toEqual("Teardown of the parent suite failed."); + expect(test.message).toEqual("Teardown of the parent suite failed.");
     });

it("should show suite message 'Teardown of the parent suite failed.'", function (){
         var suite = window.testdata.suite().suite(0);
- expect(suite.getFailureMessage()).toEqual("Teardown of the parent suite failed."); + expect(suite.message).toEqual("Teardown of the parent suite failed.");
     });

it("should show root suite message 'Suite teardown failed:\nAssertionError'", function (){
         var root = window.testdata.suite();
- expect(root.getFailureMessage()).toEqual("Suite teardown failed:\nAssertionError"); + expect(root.message).toEqual("Suite teardown failed:\nAssertionError");
     });

 });
@@ -288,14 +288,14 @@
                         ["test",1,0,"Y",0,
                          ["kw",2,0,0,0,
                           ["kw",3,0,4,5,[0,"F",5],["F",-1,1]],
-                          ["F",-1,1]],[],["F",-2,3]],
+                          ["F",-1,1]],[],["F",-2,3,5]],
                           ["F",-29,30],[1,0,1,0]]);
window.strings =["*","*Feilaava","*feilaa","*Fail","*Fails","*FooBar!"];
     });

     it("should show test failure message ''", function (){
         var test = window.testdata.suite().test(0);
-        expect(test.getFailureMessage()).toEqual("FooBar!");
+        expect(test.message).toEqual("FooBar!");
     });
 });


==============================================================================
Revision: 642282c44872
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:29:15 2011
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=642282c44872

Modified:
 /src/robot/webcontent/js/model.js

=======================================
--- /src/robot/webcontent/js/model.js   Wed Jun  8 03:23:31 2011
+++ /src/robot/webcontent/js/model.js   Wed Jun  8 03:29:15 2011
@@ -24,6 +24,7 @@
         suite.populateKeywords = createIterablePopulator("Keyword");
         suite.populateTests = createIterablePopulator("Test");
         suite.populateSuites = createIterablePopulator("Suite");
+        suite.message = data.message;
         suite.children = function () {
return suite.keywords().concat(suite.tests()).concat(suite.suites());
         };
@@ -32,13 +33,6 @@
         suite.hasTeardownFailure = function () {
return suiteTeardownFailed(suite) || data.status.parentSuiteTeardownFailed;
         };
-        suite.getFailureMessage = function () {
-            if (data.status.parentSuiteTeardownFailed)
-                return "Teardown of the parent suite failed.";
-            if (suite.hasTeardownFailure())
-                return "Suite teardown failed:\n" +
- suite.keyword(suite.numberOfKeywords - 1).message(0).text;
-        };
         suite.searchTests = function (predicate) {
             var tests = [];
             for (var i = 0; i < this.numberOfSuites; i++)

==============================================================================
Revision: dce6fe89e080
Author:   Mikko Korpela <[email protected]>
Date:     Wed Jun  8 03:54:00 2011
Log:      webcontent: Parent teardown + test failure
http://code.google.com/p/robotframework/source/detail?r=dce6fe89e080

Modified:
 /src/robot/webcontent/js/testdata.js
 /src/robot/webcontent/spec/ParsingSpec.js

=======================================
--- /src/robot/webcontent/js/testdata.js        Wed Jun  8 03:16:38 2011
+++ /src/robot/webcontent/js/testdata.js        Wed Jun  8 03:54:00 2011
@@ -108,11 +108,15 @@
     }

     function createMessage(statusElement, hasSuiteTeardownFailed) {
+        var message = '';
         if (statusElement.length == 4)
-            return get(statusElement[3]);
-        if (hasSuiteTeardownFailed)
-            return 'Teardown of the parent suite failed.';
-        return '';
+            message = get(statusElement[3]);
+        if(hasSuiteTeardownFailed)
+            if(message === '')
+                return 'Teardown of the parent suite failed.';
+            else
+                message += '\n\nAlso teardown of the parent suite failed.'
+        return message;
     }

     function createSuite(parent, element) {
=======================================
--- /src/robot/webcontent/spec/ParsingSpec.js   Wed Jun  8 03:16:38 2011
+++ /src/robot/webcontent/spec/ParsingSpec.js   Wed Jun  8 03:54:00 2011
@@ -280,6 +280,28 @@

 });

+describe("Parent Suite Teardown and Test failure", function(){
+    beforeEach(function (){
+        window.data = [-25,"Robot",
+            ["suite","/tmp/SuiteTeardown.txt","SuiteTeardown",0,{},
+                ["test",1,0,"Y",0,
+                    ["kw",2,0,3,4,[0,"F",4],["F",-1,1]],[],
+                    ["F",-2,2,4]],
+                ["teardown",2,0,3,5,[1,"F",5],["F",0,1]],
+                ["F",-23,24,6],[1,0,1,0]],
+            [[["Critical Tests",0,1,"","",""],
+                ["All Tests",0,1,"","",""]],[],
+                [["SuiteTeardown",0,1,"SuiteTeardown","",""]]],[]];
+ window.strings =["*","*Failing","*Fail","*Fails","*In test","*in suite teardown",
+            "*Suite teardown failed:\nin suite teardown"];
+    });
+
+ it("should show test message 'In test\n\nAlso teardown of the parent suite failed.'", function (){
+        var test = window.testdata.suite().test(0);
+ expect(test.message).toEqual("In test\n\nAlso teardown of the parent suite failed.");
+    });
+})
+
 describe("Test failure message", function (){

     beforeEach(function () {

Reply via email to