wiki:TestStepSubclasses

CPPUnit Interpretation

This subclass of Test will interpret cppunit output.

#Extended from Buildbot default Test class by Jonathan S. Romero (jonnyro@jonnyro.com)
# based on examples found in buildbot release.
class CPPUnitTest(Test):

    def __init__(self, **kwargs):
	Test.__init__(self, **kwargs) # always upcall!

    def evaluateCommand(self, cmd):
        # Get stdio, stripping pesky newlines etc.
        lines = map(
            lambda line : line.replace('
','').replace('
','').replace('
',''),
            self.getLog('stdio').readlines()
            )
	

        total = 0
        passed = 0
        failed = 0
        rc = cmd.rc

	lines.reverse()
	print lines[0]

	m = re.match(r'OK ((d*))', lines[0])	

	if m != None:
		total = int(m.group(1))
		passed = int(m.group(1))
		failed = 0		
	else:
		m = re.match(r'Run: (d*).*Failure total: (d*).*Failures: (d*).*Errors: (d*)', lines[0])
	
		if m != None:
			total = int(m.group(1))
			failed = int(m.group(2))	
			passed = total - failed 


        self.setTestResults(total=total, failed=failed, passed=passed)

        return rc
Last modified 7 years ago Last modified on Apr 9, 2010, 6:36:05 AM