mercredi 4 mai 2016

Pysys. Prevent execution of validate() method because of errors occured at execute()

I'd want to prevent the execution of the validate() method of my testcase when something didn't go, in the execute() method, in the way I expected...

I've tried to do something like the following:

class MyTestCase(BaseTest):
   def execute(self):
      if somethingWentOK == False:
            self.addOutcome(BLOCKED)

And, from the validate() method:

   def validate(self):
      if self.getOutcome()!=BLOCKED:
           doValidationStuff()
      else:
           self.log.error("Something failed!!!")

But the output I get is different from what I expected:

2016-05-04 17:25:36,892 ERROR Testcase execution interrupted by previous errors!
2016-05-04 17:25:36,911 INFO
2016-05-04 17:25:36,933 INFO  Test duration 51.48 secs
2016-05-04 17:25:36,948 INFO  Test final outcome NOT VERIFIED
2016-05-04 17:25:36,950 INFO
2016-05-04 17:25:37,025 CRIT
2016-05-04 17:25:37,026 CRIT  Test duration: 51.60 (secs)
2016-05-04 17:25:37,026 CRIT
2016-05-04 17:25:37,026 CRIT  Summary of non passes and tests requiring inspection:

I thought I was going to get a BLOCKED outcome instead of the NOT VERIFIED one the framework produces...

I understand that I'm doing something not properly, so any feedback about that could be appreciated.

Aucun commentaire:

Enregistrer un commentaire