python - roboframework script issue -


in robotframework, trying execute command on server, taking output in variable , comparing output empty or not empty getting error.

robot script:

${redrelease}   execute command root , return result   ${server}   cat /etc/redhat-release | grep '6.7'  run keyword if  '${redrelease}'=='${empty}' should contain  xxx    yyyy 

but getting error:

evaluating expression '' red hat enterprise linux server release 6.7 (santiago)'==''' failed: syntaxerror: no viable alternative @ character ''' (<string>, line 1) 

how can compare output of grep command empty or non empty?

roboframework provides in-built library "sshlibrary" helps in dealing same.

for example :

*** settings *** library           sshlibrary   *** variables *** ${host}           127.0.0.1 ${username}       labadmin ${password}       root123 ${command}        cat /etc/*release  *** test cases ***  login_to_server     open connection    ${host}     login    ${username}    ${password}     ${output}    execute command    ${command}     should contain    ${output}    "ubuntu" 

modify above snippet according setup.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -