Skip to content

Instantly share code, notes, and snippets.

@adiralashiva8
Created April 12, 2020 08:29
Show Gist options
  • Save adiralashiva8/38e556fd85e322ef218c3a4be015944a to your computer and use it in GitHub Desktop.
Save adiralashiva8/38e556fd85e322ef218c3a4be015944a to your computer and use it in GitHub Desktop.
class RobotListener2:
ROBOT_LISTENER_API_VERSION = 2
def __init__(self):
print('Before Start Of Execution')
def start_suite(self, name, attrs):
self.test_count = len(attrs['tests'])
if self.test_count != 0:
print('Before Start of Suite')
# print suite name
print(name)
def start_test(self, name, attrs):
if self.test_count != 0:
print('Before Start of Test')
# print test name
print(name)
def end_keyword(self, name, attrs):
if self.test_count != 0:
print('After End Of Keyword')
# print keyword name
print(attrs['kwname'])
# pritn keyword status
print(attrs['status'])
def end_test(self, name, attrs):
if self.test_count != 0:
print('After End Of Test')
# print test name
print(name)
# pritn test status
print(attrs['status'])
# print test error message
print(attrs['message'])
def end_suite(self, name, attrs):
if self.test_count != 0:
print('After End Of Suite')
# print suite name
print(name)
# pritn suite status
print(attrs['status'])
def close(self):
print('After Complete of Execution')
class RobotListener3:
ROBOT_LISTENER_API_VERSION = 3
def __init__(self):
print('Before Start Of Execution')
def start_suite(self, data, result):
self.test_count = len(data.tests)
if self.test_count != 0:
print('Before Start of Suite')
# print suite name
print(data.name)
def start_test(self, data, test):
if self.test_count != 0:
print('Before Start of Test')
# print test name
print(test)
def end_test(self, data, test):
if self.test_count != 0:
print('After End Of Test')
# print test name
print(test)
# pritn test status
print(test.status)
# print test error message
print(test.message)
def end_suite(self, data, result):
self.test_count = len(data.tests)
if self.test_count != 0:
print('After End Of Suite')
# print suite name
print(data.name)
# pritn suite status
print(result)
def close(self):
print('After Complete of Execution')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment