I'm new in Python and Robot Framework. For test project for learning i'm creating:
general_scenario.robot:
*** Settings ***
Documentation Suite description
Resource ../resource.robot
*** Variables ***
...
*** Test Cases ***
[Config] Extend Config Model
[Tags] model
Extend Config Model
then, create keyword lib:
...
class ModelLibrary(ModelAbstract):
...
@keyword('Extend Config Model')
def extend_config_model(self):
moGen = ModelGeneral.__init__(self, 45.5, 2.04)
moAdd = ModelAdditional(True, 0.34)
moRoute = ModelRoute("path")
mo = Model("ship002", moGen, moAdd, moRoute)
print(mo.name, mo.general, mo.additional, mo.route)
pass
where i want to use helper(data-model class) helper.Model.py, which import in this keyword lib, like this:
from helper.Model import ModelGeneral, ModelAdditional
also have resource.robot file:
Library libs/ModelLibrary.py
Library libs/EmulationLibrary.py
Library helper/Model.py
so >pybot general_scenarios.robot
:
[ ERROR ] Error in file 'C:\..\resource.robot': Importing test library 'C:\..\libs\ModelLibrary.py' failed: ModuleNotFoundError: No module named 'helper'
Traceback (most recent call last):
File "C:\..\libs\ModelLibrary.py", line 5, in <module>
from helper.Model import ModelGeneral, ModelAdditional
and:
[ ERROR ] Error in file 'C:\..\resource.robot': Test Library 'Model' expected 4 arguments, got 0.
fix args not fixed Importing test library failed. Can't understand wats going wrong with import normal py module.