Fixes for Nightly tests
- Add onos-diagnostics-k8s command
- Don't catch SkipCase Exception
- Minor cleanup for TAP output
Change-Id: I647e6e57bf9351c69d3059a07ef14d826c244ad7
diff --git a/TestON/core/logger.py b/TestON/core/logger.py
index 72db4c9..a7d4e22 100644
--- a/TestON/core/logger.py
+++ b/TestON/core/logger.py
@@ -357,23 +357,23 @@
main.TOTAL_TC_NORESULT = main.TOTAL_TC_NORESULT + 1
main.log.exact( "\n " + "*" * 29 + "\n" + "\n Result: No Assertion Called \n" + "*" * 29 + "\n" )
line = "Case " + case + ": " + main.CurrentTestCase + " - No Result"
- main.log.TAP( "ok - %s # TODO No assert called" % line )
+ main.log.TAP( "ok %s # TODO No assert called" % line )
elif currentResult == 1:
main.TOTAL_TC_RUN = main.TOTAL_TC_RUN + 1
main.TOTAL_TC_PASS = main.TOTAL_TC_PASS + 1
main.log.exact( "\n" + "*" * 29 + "\n Result: Pass \n" + "*" * 29 + "\n" )
line = "Case " + case + ": " + main.CurrentTestCase + " - PASS"
- main.log.TAP( "ok - %s" % line )
+ main.log.TAP( "ok %s" % line )
elif currentResult == 0:
main.TOTAL_TC_RUN = main.TOTAL_TC_RUN + 1
main.TOTAL_TC_FAIL = main.TOTAL_TC_FAIL + 1
main.log.exact( "\n" + "*" * 29 + "\n Result: Failed \n" + "*" * 29 + "\n" )
line = "Case " + case + ": " + main.CurrentTestCase + " - FAIL"
- main.log.TAP( "not ok - %s" % line )
+ main.log.TAP( "not ok %s" % line )
else:
main.log.error( " Unknown result of case " + case +
". Result was: " + currentResult )
line = "Case " + case + ": " + main.CurrentTestCase + " - ERROR"
- main.log.TAP( "not ok - %s" % line )
+ main.log.TAP( "not ok %s" % line )
main.log.wiki( "<h3>" + line + "</h3>" )
main.log.summary( line )
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index ff01b00..5653ffe 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -254,6 +254,8 @@
self.stepResultsList = []
self.stepName = ""
self.caseExplanation = ""
+ self.CASERESULT = self.ERROR
+ self.STEPRESULT = self.NORESULT
result = self.TRUE
# NOTE: number of main.step statements in the
@@ -343,35 +345,26 @@
"""
Add case results to the TAP results file
"""
- #self.log.TAP( "<p>" + self.caseExplanation + "</p>" )
main.log.debug( self.stepCache )
- subcaseMessage = False
steps = 0
stepLines = []
for line in self.stepCache.splitlines():
- main.log.debug( line )
if re.search( "[0-9]\.[0-9]", line ): # Step
- if subcaseMessage: # End of Failure Message Printout
- subcaseMessage = False
if re.search( " - PASS$", line ):
steps += 1
- stepLines.append( " ok -- STEP %s" % line )
+ stepLines.append( " ok - STEP %s" % line )
elif re.search( " - FAIL$", line ):
steps += 1
- stepLines.append( " not ok -- STEP %s" % line )
+ stepLines.append( " not ok - STEP %s" % line )
elif re.search( " - No Result$", line ):
steps += 1
- stepLines.append( " ok -- STEP %s # TODO: No assertion in test step" % line )
+ stepLines.append( " ok - STEP %s # TODO: No assertion in test step" % line )
else: # Substep
- if not subcaseMessage: # Open Failure Message Printout
- stepLines.append( " # %s" % line )
- subcaseMessage = True
- else: # Add to Failure Message Printout
- self.log.TAP( " # %s" % line )
+ stepLines.append( " # %s" % line )
if steps > 0:
self.log.TAP( " 1..%s" % steps )
- for line in stepLines:
- self.log.TAP( line )
+ for line in stepLines:
+ self.log.TAP( line )
def organizeResult( self, caseNum, result ):
@@ -467,11 +460,11 @@
main.log.debug( "StepResultsTAP" )
for line in self.stepCache.splitlines():
if re.search( " - PASS$", line ):
- self.log.TAP( " ok -- STEP %s" % line )
+ self.log.TAP( " ok - STEP %s" % line )
elif re.search( " - FAIL$", line ):
- self.log.TAP( " not ok -- STEP %s" % line )
+ self.log.TAP( " not ok - STEP %s" % line )
elif re.search( " - No Result$", line ):
- self.log.TAP( " ok -- STEP %s # TODO: No assertion in test step" % line )
+ self.log.TAP( " ok - STEP %s # TODO: No assertion in test step" % line )
else: # Should only be on fail message
self.log.TAP( " # %s" % line )
@@ -501,7 +494,7 @@
except Exception:
self.log.exception( "Error parsing step results" )
- def skipCase( self, result="DEFAULT", msg=None ):
+ def skipCase( self, result="NORESULT", msg=None ):
"""
Will skip the rest of the code in a test case. The case results will be
determined as normal based on completed assertions unless the result
@@ -515,7 +508,9 @@
result = result.upper().strip()
if result == "PASS":
self.CASERESULT = self.TRUE
- elif result == "FAIL":
+ elif result == "NORESULT":
+ self.CASERESULT = self.NORESULT
+ else:
self.CASERESULT = self.FALSE
self.onFailMsg = "Skipping the rest of this case. "
if msg: