mardi 19 mars 2019

unable to compare strings in Robot tests due to source string

What I'm trying to do is getting a record from a table and comparing it against the text in an element in the web UI.

I exec into the docker and run the command to pull out the top record which works fine

+++ docker exec -it 60493033cec6 /bin/sh -c 'mysql -uroot -ppassword -Bse "use requestdb; select REQUEST_ID from infra_active_requests limit 1;"'

The echo command for the above outputs the below:-

++ req_id=$'0327902d-6346-4c61-94b2-9da532bc7ef3\r'

++ echo Record: $'0327902d-6346-4c61-94b2-9da532bc7ef3\r'    

Record: 0327902d-6346-4c61-94b2-9da532bc7ef3          notice there is no \r here

++ export $'req_id=0327902d-6346-4c61-94b2-9da532bc7ef3\r'

++ req_id=$'0327902d-6346-4c61-94b2-9da532bc7ef3\r' `// \r included in the string here.

AND in the tests I am using the below statement to compare the strings

${result}  Get Text  xpath = //*[@id="mat-tab-content-0-0"]/div/mat-table/mat-row[1]/mat-cell[1]/a
Should be equal as Strings   ${result}    ${REQ_ID}  //REQ_ID has the request id created before
${REQ_ID} =  Fetch From Left ${REQ_ID} \r `     // to remove the \r

I am trying to set the value of the outcome from the db query on to ${RESULT} using

${REQ_ID} = Fetch From Left ${REQ_ID} \r

Am i doing this right? The String library is imported

The error I get is:-

1. No keyword with name 'Fetch From Left ${REQ_ID} \r' found.

or

2. 0327902d-6346-4c61-94b2-9da532bc7ef3 != 0327902d-6346-4c61-94b2-9da532bc7ef3   ///when run without the fetch from left command

Aucun commentaire:

Enregistrer un commentaire