OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

In robot framework how do you to create object of class and call the methods in corresponding class?

  • Thread starter Thread starter kirti kumbhar
  • Start date Start date
K

kirti kumbhar

Guest
In robot framework how do you to create object of class and call the methods in corresponding class? This is the code snippet.

Code:
*** Settings ***
Documentation     A resource file with reusable keywords and variables.
...               Use keywords in this file in testcases directory.
Library           /home/kirti/src/Helper/utilities.py
Library           /home/kirti/src/Helper/config_parser.py
#Library          /home/kirti/qa/src/executor/cleanup.CleanUp
Library           /home/kirti/qa/src/executor/cleanup.py

*** Variables ***
${RESULT}         0

*** Keywords ***
Read Json Config Values
    Log To Console     "Setting up the config values globally"
    config_parser.Json Config Parser
    Import Variables    /home/kirti/src/Helper/variables.py
    Log Variables    INFO

Check Machines Reachability
utilities.Check All Machines Status

Check SNMP Counter
    utilities.Get Snmp    192.178.1.2    PPSessionCount

Call Clean Up
    #${cleanupobj}=     cleanup.create cleanup
    #${name}=     ${cleanupobj.cc()}
    Import Library     /home/kirti/src/executor/cleanup.py
    ${cmp}=    Get library instance    CleanUp
    Log To Console     ${cmp}.__class__.__name__
    #${name}=    Call method    ${cmp}    Create cleanup
    ${name}=    Call method    ${cmp}    cc
    #${name}=    Call method    ${cleanupobj}    env cleanup
    #Log To Console     "${name}"
    #Log Variables    INFO
    utilities.Check All Machines Status
<p>In robot framework how do you to create object of class and call the methods in corresponding class? This is the code snippet.</p>

<pre><code>*** Settings ***
Documentation A resource file with reusable keywords and variables.
... Use keywords in this file in testcases directory.
Library /home/kirti/src/Helper/utilities.py
Library /home/kirti/src/Helper/config_parser.py
#Library /home/kirti/qa/src/executor/cleanup.CleanUp
Library /home/kirti/qa/src/executor/cleanup.py

*** Variables ***
${RESULT} 0

*** Keywords ***
Read Json Config Values
Log To Console "Setting up the config values globally"
config_parser.Json Config Parser
Import Variables /home/kirti/src/Helper/variables.py
Log Variables INFO

Check Machines Reachability
utilities.Check All Machines Status

Check SNMP Counter
utilities.Get Snmp 192.178.1.2 PPSessionCount

Call Clean Up
#${cleanupobj}= cleanup.create cleanup
#${name}= ${cleanupobj.cc()}
Import Library /home/kirti/src/executor/cleanup.py
${cmp}= Get library instance CleanUp
Log To Console ${cmp}.__class__.__name__
#${name}= Call method ${cmp} Create cleanup
${name}= Call method ${cmp} cc
#${name}= Call method ${cleanupobj} env cleanup
#Log To Console "${name}"
#Log Variables INFO
utilities.Check All Machines Status
</code></pre>
 

Latest posts

Top