问题
Here's my robot code
There are 22 records on both tables but only 1 record has an unequal data I would like to show that result and minus or blind an equal data result.
connect to database using custom params cx_Oracle ${DB_CONNECT_STRING}
@{queryResultsA}= Query Select count (*) from QA_USER.SealTest_Security_A order by SECURITY_ID
Log ${queryResultsA}
@{queryResultsB}= Query Select count (*) from QA_USER.SealTest_Security_B order by SECURITY_ID
Log ${queryResultsB}
should not contain match ${queryResultsB} ${queryResultsA}
回答1:
Using For Loop
# Assuming your table has values like this @{queryResultsA}= Create List a b c d e @{queryResultsB}= Create List a z c d e ${Length}= Get Length ${queryResultsA} ${count}= Set Variable :FOR ${count} IN RANGE ${Length} \ Run Keyword If '@{queryResultsA}[${count}]'!='@{queryResultsB}[${count}]' Log To Console @{queryResultsA}[${count}] @{queryResultsB}[${count}]
OUTPUT
b z
Using SET
${z} = Evaluate (set(${queryResultsA}) - set(${queryResultsB})) Log ${z}
OUTPUT
b
Note the difference here Set B is subtracted from Set A so whatever not matched in set A will be the output.
来源:https://stackoverflow.com/questions/54090508/how-can-i-choose-to-show-only-unequal-data-result-and-minus-or-blind-equal-data