Пример #1
0
def main(args):
    sys.path.append(os.path.realpath("."))
    base_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
    usage = "usage: %prog -t TEST_CASE"
    parser = stasis.OptionParser(usage=usage)
    #parser.add_option("-f", "--file", dest="log_file", default=None,
    #                   help="Log file", metavar="/PATH/FILE", action="store" )
    parser.add_option("-A",
                      "--arg",
                      action="append",
                      dest="arg_list",
                      default=[],
                      metavar="<var>=<value>",
                      help="Variable and value to be passed to test run")
    parser.add_option("-t",
                      "--test",
                      dest="test_case_list",
                      default=[],
                      help="Test case",
                      metavar="TEST_CASE",
                      action="append")
    parser.add_option("-v",
                      "--verbose",
                      action="count",
                      dest="debug_level",
                      default=0,
                      help="Increase verbosity of debug output")
    (options, args) = parser.parse_args()

    TestSequence.arg_dict = {}
    for arg in options.arg_list:
        split_arg = arg.split("=")
        TestStasis.arg_dict[split_arg[0]] = split_arg[1]

    #logger = logging.getLogger( "pyxt_pyxt_test" )
    #logger.setLevel( 30 - options.debug_level * 10 )
    #if options.log_file is None:
    #    handler = logging.StreamHandler()
    #else:
    #    handler = logging.FileHandler( options.log_file, 'w' )

    #formatter = logging.Formatter( "\n%(name)s(), %(threadName)s [%(created)f] - %(filename)s:%(lineno)s\n %(message)s" )
    #handler.setFormatter( formatter )
    #logger.addHandler( handler )

    #TestPyxt.logger = logger
    #TestPyxt.debug_level = options.debug_level

    runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
    if len(options.test_case_list) == 0:
        suite = unittest.makeSuite(TestSequence)
    else:
        suite = unittest.TestSuite()
        for test_case in options.test_case_list:
            suite.addTest(TestSequence(test_case))

    runner.run(suite)
Пример #2
0
def main( args ):
    sys.path.append( os.path.realpath( "." ) )
    base_name = os.path.splitext( os.path.basename(sys.argv[0]) )[0]
    usage = "usage: %prog -t TEST_CASE"
    parser = stasis.OptionParser( usage=usage )
    #parser.add_option("-f", "--file", dest="log_file", default=None,
    #                   help="Log file", metavar="/PATH/FILE", action="store" )
    parser.add_option("-A", "--arg",
                       action="append",
                       dest="arg_list",
                       default=[],
                       metavar="<var>=<value>",
                       help="Variable and value to be passed to test run")
    parser.add_option("-t", "--test", 
                       dest="test_case_list", 
                       default=[],
                       help="Test case", 
                       metavar="TEST_CASE", 
                       action="append" )
    parser.add_option("-v", "--verbose", 
                       action="count", 
                       dest="debug_level", 
                       default=2, 
                       help="Increase verbosity of debug output")
    (options,args) = parser.parse_args()

    TestSequence.arg_dict = {}
    for arg in options.arg_list:
        split_arg = arg.split("=")
        TestStasis.arg_dict[split_arg[0]] = split_arg[1]
    
    TestSequence.debug = options.debug_level
    
    runner = unittest.TextTestRunner( sys.stdout, verbosity=2 )
    if len( options.test_case_list ) == 0:
        suite = unittest.makeSuite( TestSequence )
    else:
        suite = unittest.TestSuite()
        for test_case in options.test_case_list:
            suite.addTest( TestSequence( test_case ) )
        
    runner.run( suite )
Пример #3
0
def main(args):
    sys.path.append(os.path.realpath("."))
    base_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]
    usage = "usage: %prog -t TEST_CASE [-i case_run_id] [-p password]"
    parser = stasis.OptionParser(usage=usage)
    parser.add_option("-H",
                      "--host",
                      default="LOCAL",
                      help="server",
                      action="store")
    parser.add_option("-t",
                      "--test",
                      dest="test_case_list",
                      default=[],
                      help="Test case",
                      metavar="TEST_CASE",
                      action="append")
    parser.add_option("-U",
                      "--user",
                      default=None,
                      help="Username",
                      action="store")
    parser.add_option("-v",
                      "--verbose",
                      action="count",
                      dest="debug_level",
                      default=3,
                      help="Increase verbosity of debug output")

    (options, args) = parser.parse_args()

    runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
    suite = unittest.TestSuite()
    if len(options.test_case_list) != 0:
        for test_case in options.test_case_list:
            suite.addTest(TestStasisStaf(test_case))
    else:
        suite = unittest.makeSuite(TestStasisStaf)
    runner.run(suite)
Пример #4
0
def main( args ):
    sys.path.append(os.path.realpath("."))
    base_name = os.path.splitext( os.path.basename(sys.argv[0]) )[0]
    usage = "usage: %prog -t TEST_CASE [-i case_run_id] [-p password]"
    parser = stasis.OptionParser( usage=usage )
    parser.add_option("-c", "--case_run_id", 
                       default=None,
                       help="Integer id for test run", 
                       metavar="INT", 
                       action="store" )
    parser.add_option("-l", "--local", 
                       default=False,
                       help="Run local test cases only", 
                       metavar="T/F", 
                       action="store_true" )
    parser.add_option("-P", "--password", 
                       default=None,
                       help="Password", 
                       action="store" )
    parser.add_option("-p", "--port", 
                       type="int",
                       default=None,
                       help="Port of server, script will not start a server", 
                       action="store" )
    parser.add_option("-S", "--server", 
                       default=None,
                       help="server", 
                       action="store" )
    parser.add_option("-t", "--test", 
                       dest="test_case_list", 
                       default=[],
                       help="Test case", 
                       metavar="TEST_CASE", 
                       action="append" )
    parser.add_option("-u", "--url", 
                       default=None,
                       help="Username", 
                       action="store" )
    parser.add_option("-U", "--user", 
                       default=None,
                       help="Username", 
                       action="store" )
    parser.add_option("-v", "--verbose", 
                       action="count", 
                       dest="debug_level", 
                       default=0, 
                       help="Increase verbosity of debug output")

    (options,args) = parser.parse_args()
  
    TestScripts.password = options.password
    TestScripts.user = options.user
    TestScripts.url = options.url 
    TestScripts.case_run_id = options.case_run_id
    TestScripts.port = options.port
    TestScripts.server = options.server
    TestScripts.case_run_id = options.case_run_id

  
    runner = unittest.TextTestRunner( sys.stdout, verbosity=2 )
    suite = unittest.TestSuite()
    if len( options.test_case_list ) != 0:
        for test_case in options.test_case_list:
            suite.addTest( TestScripts( test_case ) )
    elif options.local:
        for test_case in TestScripts.local_cases:
            suite.addTest( TestScripts( test_case ) )
    else:
        suite = unittest.makeSuite( TestScripts )
            
    runner.run( suite )