lundi 22 décembre 2014

How to import and use user defined classes in robot framework with python

Assume I have a class in python:



class TestClass(object):
def __init__(self, arg1, arg2):
self.arg1 = arg1
self.arg2 = arg2

def print_args(self):
print arg1, arg2


I want to use robotframework to implement my tests scenarios. I want to make an instance from above class and call its methods. How to do that? I know how to import the lib; it should be like this:



Library TestClass


I don't know how to initialize an object from this class and call class methods via this object. If I wanted to implement it with python, I would write some piece of code like this:



import TestClass
test = TestClass('ARG1', 'ARG2')
test.print_args()


Now, I want to know how to write this in robotframework. Any help?


Aucun commentaire:

Enregistrer un commentaire