summaryrefslogtreecommitdiffstats
path: root/examples/matrix.py
blob: e8cba98f730e22725a12b44c28e6d9f7599a9c9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python

import re, sys, optparse
from nitrate import *

if __name__ == "__main__":
    parser = optparse.OptionParser(usage="matrix.py --plan PLAN [options]")
    parser.add_option("--plan", dest="plan", type="int", help="test plan id")
    options = parser.parse_args()[0]

    testplan = TestPlan(options.plan)
    print "Checking results of {0}:\nTest runs: {1}".format(testplan,
            ", ".join([run.identifier for run in testplan.testruns]))

    for testcase in sorted(testplan.testcases, key=lambda x: x.script):
        for testrun in testplan.testruns:
            for caserun in testrun.caseruns:
                if caserun.testcase.id == testcase.id:
                    print caserun.status.shortname,
                    break
            else:
                print "....",
        print "- {0} - {1}".format(str(testcase.tester).ljust(8), testcase)