def test_report_local_fail(self): port = 8232 server = test_server.TestServer(port) server.count = 4 server.start() log_file = os.tempnam(None,"stasis-") case_lib = stasis.TestCaseLibrary(self.cv) url = stasis.buildUrl("localhost","user","pass","","http", port) xml_file = os.path.join("testopia_run_files","seq_report_fail.xml") params = {} sequence_lib = stasis.TestSequenceLibrary(self.cv, self.sv, case_lib) sequence = sequence_lib.load(xml_file) log_reporter = stasis.LogTestCaseReporter(2, logfile=log_file) sequence.addReporter(log_reporter) testopia_reporter = stasis.TestopiaCaseReporter(url) sequence.addReporter(testopia_reporter) runner = stasis.Runner(sequence, params) runner.run(wait_before_kill=3) begin_count = 0 pass_count = 0 total = 2 fd = open(log_file, 'r') for line in fd.readlines(): if re.search(" BEGIN ", line): begin_count += 1 if re.search(" ERROR ", line): pass_count += 1 fd.close() self.assertEqual(pass_count, total) self.assertEqual(begin_count, total)
def test_report_local_fail(self): if self.port is None: port = 8133 count = 8 server = test_server.TestServer(port, count) thread = threading.Thread(None, server.start_server) thread.start() else: port = self.port log_file = os.tempnam(None, "stasis-") case_lib = stasis.TestCaseLibrary(self.cv) url = stasis.buildUrl("localhost", "user", "pass", "/", "http", port) xml_file = "seq_report_fail.xml" params = {} sequence_lib = stasis.TestSequenceLibrary(case_lib) series = sequence_lib.load(xml_file) log_reporter = stasis.LogTestCaseReporter(3, logfile=log_file) series.addReporter(log_reporter) testopia_reporter = stasis.TestopiaCaseReporter(url) series.addReporter(testopia_reporter) dispatcher = stasis.RunDispatcher(series, self.rr) dispatcher.run() case_fail_count = 0 fail_count = 0 fd = open(log_file, 'r') for line in fd.readlines(): if re.search("CASE_FAIL_", line): case_fail_count += 1 if re.search(" FAIL ", line): fail_count += 1 fd.close() self.assertEqual(fail_count, 2) self.assertEqual(case_fail_count, 4)
def test_report_live(self): log_file = os.tempnam(None, "stasis-") case_lib = stasis.TestCaseLibrary(self.cv) if self.case_run_id is None: case_run_id = raw_input("case_run_id: ") else: case_run_id = self.case_run_id if self.url is None: if self.user is None: user = raw_input("Enter testopia user name: ") else: user = self.user if self.password is None: passwd = raw_input("Password for %s: " % user) else: passwd = self.password if self.server is None: server = raw_input("Server: ") else: server = self.server url = stasis.buildUrl(server, user, passwd) else: url = self.url params = {} sequence_lib = stasis.TestSequenceLibrary(case_lib) series = sequence_lib.load(None, case_run_id) log_reporter = stasis.LogTestCaseReporter(3, logfile=log_file) series.addReporter(log_reporter) testopia_reporter = stasis.TestopiaCaseReporter(url) sequence.addReporter(testopia_reporter) dispatcher = stasis.RunDispatcher(series) dispatcher.run() begin_count = 0 pass_count = 0 total = 3 fd = open(log_file, 'r') for line in fd.readlines(): if re.search(" BEGIN ", line): begin_count += 1 if re.search(" PASS ", line): pass_count += 1 fd.close() self.assertEqual(pass_count, total) self.assertEqual(begin_count, total)
def test_report_live(self): log_file = os.tempnam(None,"stasis-") case_lib = stasis.TestCaseLibrary(self.cv) #uri = os.path.join(os.getcwd(),"testopia") #hostname = "bugzillastage.provo.novell.com" #hostname = "localhost:%s" % self.port if self.case_run_id is None: case_run_id = raw_input("case_run_id: ") else: case_run_id = self.case_run_id if self.user is None: user = raw_input("Password for %s: " % user) else: user = self.passwd if self.password is None: passwd = raw_input("Password for %s: " % user) else: passwd = self.passwd #password = "******" url = stasis.buildUrl("bugzillastage.provo.novell.com", user, passwd) params = {} sequence_lib = stasis.TestopiaSequenceLibrary(self.cv, case_lib, url) sequence = sequence_lib.load(case_run_id) log_reporter = stasis.LogTestCaseReporter(2, logfile=log_file) sequence.addReporter(log_reporter) testopia_reporter = stasis.TestopiaCaseReporter(url) sequence.addReporter(testopia_reporter) runner = stasis.Runner(sequence, params) runner.run(wait_before_kill=3) begin_count = 0 pass_count = 0 total = 2 fd = open(log_file, 'r') for line in fd.readlines(): if re.search(" BEGIN ", line): begin_count += 1 if re.search(" PASS ", line): pass_count += 1 fd.close() self.assertEqual(pass_count, total) self.assertEqual(begin_count, total)