RobotFramework is unable to import modules mentioned in python file -


i have .robot file imports .py file(my python file has modules import statements) when trying run robot file getting below error. how make sure modules imported in python class file imported?

[ error ] error in file 'c:\users\admin\documents\pythondemo\src\framework\tests\login_box.robot': importing test library 'createcampaign.py' failed: importerror: no module named framework.page_object_model.home_page traceback (most recent call last):   file "c:\users\admin\documents\pythondemo\src\framework\tests\createcampaign.py", line 1, in <module> framework.page_object_model.home_page import homepage pythonpath:   c:\users\admin\documents\pythondemo\src\framework   c:\windows\system32\python27.zip   c:\python27\dlls   c:\python27\lib   c:\python27\lib\plat-win   c:\python27\lib\lib-tk   c:\python27   c:\python27\lib\site-packages ============================================================================== login box :: tests login box.com ============================================================================== log box using valid credentials                                  | fail | no keyword name 'when log box ${user} ${userpass}' found. 

.robot file

*** settings *** library  test_create_campaign.py  documentation  tests login box.com  *** variables *** ${user}         abc@abc.com ${userpass}     testing  *** test cases *** log box using valid credentials     when log box ${user} ${userpass} 

.py file

from framework.page_object_model.home_page import homepage robot.api.deco import keyword  class createcampaign(layartestcase): @keyword(name='i log box ${user} ${userpass}')     def test_create_campaign(self, user, userpass):         print user         print userpass 

i modified python file make work.

.py file

from framework.page_object_model.home_page import homepage robot.api.deco import keyword  class test_create_campaign:     @keyword(name='i log box ${user} ${userpass}')     def test_create_campaign(self, user, userpass):         print user         print userpass 
  1. corrected syntax of class definition.
  2. renamed class name same file name. important because robot framework not accept keyword otherwise. there reason using class? can define method (keyword) without class , work well.

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -