0
votes

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.

2
Answers never belong in questions. Once you figure out an answer, feel free to answer the question yourself by posting an answer. Yes, it's perfectly fine to answer your own questions.Kuba hasn't forgotten Monica

2 Answers

1
votes

You are missing a helper module the following command will install the module In your cmd

pip install helper

Whenever you are missing a module name you will have install it through pip or third parties

0
votes

add lib to PYTHONPATH or to python home site packages

details here