New to the world of robot framework. I have written a ppython program to compare the values of three comulns of a CSV file using pandas. So far so good. The program runs successfully. However, I need to use robot framework to create the test cases and show the results as pass or fail. Below is the python program:
import pandas as pd
# Reading the CSV file
df = pd.read_csv(r'xl1.csv', skipinitialspace=True, sep=',')
# Summation pf the two columns and giving results
sum1 = df['Gross_Salary'].sum()
sum2 = df['Deduction'].sum()
diff = sum1 - sum2
if diff == df['Net_Salary'].sum():
print("Pass")
else:
print("Fail")
The above code is reading a CSV file, and adding two columns, and then compare the value with the 3rd column. If they match, then "pass", otherwise "fail"
Gross_Salary Deduction Net_Salary
100 20 80
2000 200 1500
300 0 300
Below is the Robot code:
*** Settings ***
Library SeleniumLibrary
Library Process
Library BuiltIn
*** Test Cases ***
PandaTest
${result}= run process python <path_to_xl_parse.py>
BuiltIn.Should Be Equal As Strings ${result.rc} PASS
I am getting below error:
PandaTest | FAIL |
2 != PASS
------------------------------------------------------------------------------
Pan | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
Please help, Thank you
"Pass" is not equal to "PASS". You should use identical strings in both codes.
And use
Log ${result}
to see what you get from script in first place. Printing values is always a good idea when searching for an error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.