How to make robot framework test case pass if the expected output received.

376 views
Skip to first unread message

Manikandan G

unread,
Oct 20, 2017, 3:40:55 AM10/20/17
to robotframework-users
Hi All,

       Have written code using robot framework for verifying the device running version is matched with the given input. But while executing Test case is always Passing and throwing the output matches. If we give incorrect input also it's passing and throwing 
0 out of 22 matches. 

I am expecting if given input matches testcase should pass otherwise fail.

Script
-------

$out == execute command show version

$result == Get Lines Contains String  $out '12.2(55)' 


Test case always passing irrespective of the given input 12.2(55). 

Thanks,
Manikandan.G

Hélio Guilherme

unread,
Oct 20, 2017, 10:13:59 AM10/20/17
to robotframework-users
Better to paste here the exact code and output.

What you are showing are logical conditions (==) instead of assignment (=).

Depending on what $out and $result contains before the comparison, the results will be True or False (and that is not the Test result).

Also $out and $result are not correct representations of Robot Framework variables.


My Favorite Open Source Projects
awsome-lists gretl meld robotframework wxPython
(sponsored/patrocinado) Recomendo servidores e alojamento Web em:
http://www.proalojamento.com/clientes/aff.php?aff=258

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Manikandan G

unread,
Oct 26, 2017, 9:26:46 AM10/26/17
to robotframework-users
Here am pasting the code and expecting output - Next example
----------------------------------------------------------------------------------------

    Telnet.Open Connection    ${DUT_IPaddr}
    Telnet.Read Until    :
    Telnet.Write    ${DUT_Username}
    Telnet.Read Until    :
    Telnet.Write    ${DUT_Password}
    Telnet.Read Until    >
    Telnet.Write    enable
    Telnet.Read Until    :
    Telnet.Write    ${DUT_enPassword}
    Telnet.Set Prompt    \#
    Telnet.Write    conf t
    Telnet.Read Until    \#
    Telnet.Write    hostname Cisco2-LabSwitch
    Telnet.Read Until    \#
    Telnet.Write    end
    Telnet.Set Prompt    \#
    ${out}=    Telnet.Execute Command    show run | inc hostname


The above script login to the DUT and then configuring hostname. 

The last line  am trying to store the  output value to variable named  out  [  "${out}=    Telnet.Execute Command    show run | inc hostname" ]

Am expecting the test case should pass if the value stored in out is same which is configured .

The test case should pass based on the hostname set properly what we given.

Thanks,
Manikandan.G

zhuy...@gmail.com

unread,
Nov 14, 2017, 1:37:21 AM11/14/17
to robotframework-users
You can use keyword Should Contain or Should Match Regexp as an  assertion

在 2017年10月26日星期四 UTC+8下午9:26:46,Manikandan G写道:

Manikandan G

unread,
Nov 15, 2017, 6:24:44 AM11/15/17
to robotframework-users
Thanks for the response. 

Have tried with "Should Contain" and its working as expected. 


Regards,
Manikandan.G
Reply all
Reply to author
Forward
0 new messages