How I can set two different test messages for fail and pass test cases and after running all test cases how I can get list of all fail and pass messages which I can print in log file or xml file.
What is better way to store all messages and get in correct format.
Here is my Sample Home page.js
HomePage = function () {
var PageTestParams = TestParams.Modules.HomePage,
PageLangText = Lang.Modules.HomePage;
SearchResult = function(test){
},
SearchTextField = function(test){
test.assertExists(PageTestParams.SearchFormSelector, PageLangText.SuccessMsg["SearchForm"]);
SearchResult(test);
},
NavigationCount = function(test){
test.assertElementCount(PageTestParams.NavigationSelector, PageTestParams.NavigationCount,PageLangText.SuccessMsg["NavigationCount"]);
SearchTextField(test);
},
CheckTitle = function(test){
test.assertTitle(PageTestParams.Title, PageLangText.SuccessMsg["TitleText"]);
casper.test.pass("main fail ho gaya");
NavigationCount(test);
},
this.init = function(test){
CheckTitle(test);
}
};
I am passing this JS for test assertion if any test case fail or pass the same message is getting printed for same scenario. I have searched and got below syntax but its printing same message which I have setted in test assertion.
casper.test.on("fail", function(failure) {
casper.echo("FAIL " + failure.message);
});
You can do something like this (same logic for success or fail):-
Then on casper.run you can do a couple of things:-
1) To see the full dump of all successes (you can see all the properties) you can do this:-
2) to output the array of successes one by one (so you can format the output) you can do:-
3) I assume you know you can also output the full test assertions to xunit by passing in
--xunit=output.xml