pavelsaman
pavelsaman

Reputation: 8322

Importing libraries with parameters writen in Python to Robot framework in Eclipse

I'm using Eclipse for writing automated tests in Robot framework. I have a simple library that accepts one argument:

class TestVar:   

def __init__(self, var):
    self._var = var   

def get_var(self):           
    return self._var

Then, I import the library in my test suite:

Library           TestVar    42

When I run this test:

Test    
${var2}=    Get Var   
Log     ${var2}

I get 42 as expected.

But the problem is Eclipse doesn't want to add the library into red.xml, nor wants to recognise it in any way: Eclipse fails to import a library with parameters

When I change my library to a library that doesn't expect any parameter, Eclipse works just fine.

It must be something with Eclipse setting that I have no idea about.

I'd appreciate some help.

Upvotes: 1

Views: 1383

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 386010

The typical solution for this is to make the arguments to your library optional. That way tools like libdoc or eclipse can import the library without arguments, while still allowing you to pass arguments when running the test.

Upvotes: 2

Related Questions