Forum Discussion
Define a test case? Is it a script function? Some combination of script functions? A keyword test?
No matter what, by default, executing a function or keyword test does not return a "status". You need to determine the status of a test case yourself and do the necessary code to return some sort of result or status. Then, in your framework structure that executes the tests, you can check that result and write out to the log the pass/fail of the test case.
- jcatayong7 years agoContributor
Hi,
The TestCase that i metioned here was from a keyword tests
- tristaanogre7 years agoEsteemed Contributor
As mentioned, keyword tests do not return a "status". Think of each keyword test as a code function. If you write a function like so:
function noStatus(){ Log.Message('This is just a function that does stuff'); }
That function just executes and writes the log. There is no feedback from the code to indicate any status of that function. If, however, you write it like this:
function giveMeStatus(myStatus){ Log.Message('This is a function that returns a status'); if (myStatus) { return true; } else { return false; } }
Then you can do something like this
function checkMyStatus(){ if (giveMeStatus(true)) { Log.Message('giveMeStatus Passed'); } else { Log.Message('giveMeStatus Failed'); } }
It's all in the way you write your code. If you want your keyword tests to return a value that you can then check to see if it passed or failed, then you need to actually have it "return" a value using the Return operation. Otherwise, it just executes something.
- AlexKaras7 years agoChampion Level 3
Hi,
Besides mentioned by Robert, you may consider OnStopTest event in TestComplete. Within the code handler for this event you may get Log.ErrorCount and if it equals to zero you may assume that test passed.
Related Content
Recent Discussions
- 5 hours agoSubhraDas