Exemplo n.º 1
0
 def testAddDisabled(self):
     location.add(_LOCATION_DIR, False)
     self.failIf(_MODELS_DIR in models.__path__)
     self.failIf(_TESTSTEPS_DIR in teststeps.__path__)
     self.failIf(_TESTCASES_DIR in testcases.__path__)
     self.failIf(_TESTSUITES_DIR in testsuites.__path__)
     try:
         __import__("tadek.models.model1")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.teststeps.stepspkg2.stepsmdl21")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.testcases.casespkg1.casesmdl11")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.testsuites.suitespkg2.suitesmdl22")
     except ImportError:
         pass
     else:
         self.failIf(True)
Exemplo n.º 2
0
 def testAddDisabled(self):
     location.add(_LOCATION_DIR, False)
     self.failIf(_MODELS_DIR in models.__path__)
     self.failIf(_TESTSTEPS_DIR in teststeps.__path__)
     self.failIf(_TESTCASES_DIR in testcases.__path__)
     self.failIf(_TESTSUITES_DIR in testsuites.__path__)
     try:
         __import__("tadek.models.model1")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.teststeps.stepspkg2.stepsmdl21")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.testcases.casespkg1.casesmdl11")
     except ImportError:
         pass
     else:
         self.failIf(True)
     try:
         __import__("tadek.testsuites.suitespkg2.suitesmdl22")
     except ImportError:
         pass
     else:
         self.failIf(True)
Exemplo n.º 3
0
 def testGetSuites(self):
     location.add(_LOCATION_DIR)
     suites = location.getSuites()
     self.failUnless("suitespkg1" in suites)
     self.failUnless("suitespkg1.suitesmdl11" in suites)
     self.failUnless("suitespkg1.suitesmdl12" in suites)
     self.failUnless("suitespkg2" in suites)
     self.failUnless("suitespkg2.suitesmdl21" in suites)
     self.failUnless("suitespkg2.suitesmdl22" in suites)
Exemplo n.º 4
0
 def testGetCases(self):
     location.add(_LOCATION_DIR)
     cases = location.getCases()
     self.failUnless("casespkg1" in cases)
     self.failUnless("casespkg1.casesmdl11" in cases)
     self.failUnless("casespkg1.casesmdl12" in cases)
     self.failUnless("casespkg2" in cases)
     self.failUnless("casespkg2.casesmdl21" in cases)
     self.failUnless("casespkg2.casesmdl22" in cases)
Exemplo n.º 5
0
 def testGetSteps(self):
     location.add(_LOCATION_DIR)
     steps = location.getSteps()
     self.failUnless("stepspkg1" in steps)
     self.failUnless("stepspkg1.stepsmdl11" in steps)
     self.failUnless("stepspkg1.stepsmdl12" in steps)
     self.failUnless("stepspkg2" in steps)
     self.failUnless("stepspkg2.stepsmdl21" in steps)
     self.failUnless("stepspkg2.stepsmdl22" in steps)
Exemplo n.º 6
0
 def testGetSteps(self):
     location.add(_LOCATION_DIR)
     steps = location.getSteps()
     self.failUnless("stepspkg1" in steps)
     self.failUnless("stepspkg1.stepsmdl11" in steps)
     self.failUnless("stepspkg1.stepsmdl12" in steps)
     self.failUnless("stepspkg2" in steps)
     self.failUnless("stepspkg2.stepsmdl21" in steps)
     self.failUnless("stepspkg2.stepsmdl22" in steps)
Exemplo n.º 7
0
 def testGetCases(self):
     location.add(_LOCATION_DIR)
     cases = location.getCases()
     self.failUnless("casespkg1" in cases)
     self.failUnless("casespkg1.casesmdl11" in cases)
     self.failUnless("casespkg1.casesmdl12" in cases)
     self.failUnless("casespkg2" in cases)
     self.failUnless("casespkg2.casesmdl21" in cases)
     self.failUnless("casespkg2.casesmdl22" in cases)
Exemplo n.º 8
0
 def testGetSuites(self):
     location.add(_LOCATION_DIR)
     suites = location.getSuites()
     self.failUnless("suitespkg1" in suites)
     self.failUnless("suitespkg1.suitesmdl11" in suites)
     self.failUnless("suitespkg1.suitesmdl12" in suites)
     self.failUnless("suitespkg2" in suites)
     self.failUnless("suitespkg2.suitesmdl21" in suites)
     self.failUnless("suitespkg2.suitesmdl22" in suites)
Exemplo n.º 9
0
 def testEnable(self):
     location.add(_LOCATION_DIR, False)
     location.enable(_LOCATION_DIR)
     self.failUnless(_MODELS_DIR in models.__path__)
     self.failUnless(_TESTSTEPS_DIR in teststeps.__path__)
     self.failUnless(_TESTCASES_DIR in testcases.__path__)
     self.failUnless(_TESTSUITES_DIR in testsuites.__path__)
     try:
         __import__("tadek.models.model1")
         __import__("tadek.teststeps.stepspkg1.stepsmdl12")
         __import__("tadek.testcases.casespkg2.casesmdl21")
         __import__("tadek.testsuites.suitespkg1.suitesmdl11")
     except ImportError:
         self.failIf(True)
Exemplo n.º 10
0
 def testEnable(self):
     location.add(_LOCATION_DIR, False)
     location.enable(_LOCATION_DIR)
     self.failUnless(_MODELS_DIR in models.__path__)
     self.failUnless(_TESTSTEPS_DIR in teststeps.__path__)
     self.failUnless(_TESTCASES_DIR in testcases.__path__)
     self.failUnless(_TESTSUITES_DIR in testsuites.__path__)
     try:
         __import__("tadek.models.model1")
         __import__("tadek.teststeps.stepspkg1.stepsmdl12")
         __import__("tadek.testcases.casespkg2.casesmdl21")
         __import__("tadek.testsuites.suitespkg1.suitesmdl11")
     except ImportError:
         self.failIf(True)
Exemplo n.º 11
0
def runTestCases(tests, locations, devices):
    '''
    A function responsible for running the given test cases.
    '''
    log.debug("Run test cases from '%s' locations using '%s' devices: %s"
               % (", ".join(locations), ", ".join([str(d) for d in devices]),
                  ", ".join(tests)))
    loader = TestLoader()
    amountToRun = 0
    for path in locations:
        location.add(path)
    if not isinstance(tests, (list, tuple)):
        tests = [tests]
    suites, errors = loader.loadFromNames(*tests)

    ncases = 0
    for test in suites:
        ncases += test.count()
    print (" LOADED %d TEST CASES " % ncases).center(80, '-') + '\n'

    if len(errors) > 0:
        print "There were errors during loading test cases:"
        for error in errors:
            print "%s\n%s" % (error.name, error.traceback)
            printSeparator()
        print

    if not ncases:
        #Nothing to do
        exitWithStatus(status=0)

    log.info("Start running tests: %s" % suites)
    channels.add("SummaryChannel", SUMMARY_CHANNEL)
    result = testresult.TestResult()
    runner = TestRunner(devices, suites, result)

    for device in devices:
        device.connect()
    try:
        runner.start()
        runner.join()
    except KeyboardInterrupt:
        runner.stop()
    finally:
        for device in devices:
            if device.isConnected():
                device.disconnect()
    return result
Exemplo n.º 12
0
 def _addLocation(self, path):
     '''
     Adds a location and a corresponding item to the locations tree.
     Returns None on success or an error message on failure.
     '''
     if path in self._locItems:
         return
     location.add(path, enabled=False)
     item = QtGui.QTreeWidgetItem()
     item.setText(0, path)
     item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable
                   | QtCore.Qt.ItemIsSelectable)
     item.setCheckState(0, QtCore.Qt.Unchecked)
     self._locsTree.addTopLevelItem(item)
     self._locsTree.resizeColumnToContents(0)
     self._locItems[path] = item
Exemplo n.º 13
0
 def _addLocation(self, path):
     '''
     Adds a location and a corresponding item to the locations tree.
     Returns None on success or an error message on failure.
     '''
     if path in self._locItems:
         return
     location.add(path, enabled=False)
     item = QtGui.QTreeWidgetItem()
     item.setText(0, path)
     item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable |
                   QtCore.Qt.ItemIsSelectable)
     item.setCheckState(0, QtCore.Qt.Unchecked)
     self._locsTree.addTopLevelItem(item)
     self._locsTree.resizeColumnToContents(0)
     self._locItems[path] = item
Exemplo n.º 14
0
 def testGet(self):
     location.add(_LOCATION_DIR)
     self.failUnless(_LOCATION_DIR in location.get())
Exemplo n.º 15
0
 def setUp(self):
     location.add("tests")
Exemplo n.º 16
0
 def testGetDisabled(self):
     location.add(_LOCATION_DIR, False)
     self.failUnless(_LOCATION_DIR in location.get())
     self.failIf(_LOCATION_DIR in location.get(True))
Exemplo n.º 17
0
 def testGetEnabled(self):
     location.add(_LOCATION_DIR)
     self.failUnless(_LOCATION_DIR in location.get(True))
Exemplo n.º 18
0
 def testGetDisabled(self):
     location.add(_LOCATION_DIR, False)
     self.failUnless(_LOCATION_DIR in location.get())
     self.failIf(_LOCATION_DIR in location.get(True))
Exemplo n.º 19
0
 def testGetModels(self):
     location.add(_LOCATION_DIR)
     mdls = location.getModels()
     self.failUnless("model1" in mdls)
     self.failUnless("model2" in mdls)
Exemplo n.º 20
0
 def testGetEnabled(self):
     location.add(_LOCATION_DIR)
     self.failUnless(_LOCATION_DIR in location.get(True))
Exemplo n.º 21
0
 def testGet(self):
     location.add(_LOCATION_DIR)
     self.failUnless(_LOCATION_DIR in location.get())
Exemplo n.º 22
0
 def testGetModels(self):
     location.add(_LOCATION_DIR)
     mdls = location.getModels()
     self.failUnless("model1" in mdls)
     self.failUnless("model2" in mdls)
Exemplo n.º 23
0
 def setUp(self):
     location.add("tests")
Exemplo n.º 24
0
from tadek.engine.testresult import *
from tadek.engine.testexec import *
from tadek.engine.contexts import *
from tadek.engine.tasker import *

__all__ = ["TaskerTest", "TaskTest"]

import datetime
import threading

class TestTasker(TestTasker):
    def __init__(self, *tests):
        super(TestTasker, self).__init__(*tests)

# Make the below testcases module accessible
location.add("tests")

from tadek.engine.testresult import TestSuiteResult
import tadek.testcases.testpkg3.testmdl31
from tadek.testcases.testpkg3.testmdl31 import printT
lock = threading.Lock()

def cleanSuite(suite):
    suite.__name__ = "suite"
    for elem in suite.__dict__.copy():
        if elem[:5]=="suite" or elem[:4]=="case":
            delattr(suite, elem)

class TaskerTest(unittest.TestCase):
    def groupingTasks(self, testSuites):
        Suite = tadek.testcases.testpkg3.testmdl31.Suite