Forum Discussion

hngnango's avatar
hngnango
Occasional Contributor
7 years ago

String comparaison result not consistant : sometime Pass sometime fail

Hi  !

 

I did below  logic in script assertion

========================================

if (actualBankName == expectedBankName){
context.testCase.setPropertyValue("result","Pass")
}
else {
context.testCase.setPropertyValue("result","Fail")
}

===================================

In my   output  file  below , the first row is showing 'Fail' instead of Pass.

 

Question: Is there anyway to "TRIM" string value prior to compare ,to make sur to have exact match ?

I do not understand why  my first row is showing Fail.

Please advise

 

Result RequestTimeTaken(sec) ActualBankName ExpectedBankName BLZCode
Fail 0.392 Deutsche Bank Ld Brandenburg Deustche Bank Ld Brandenburg 12070000
Pass 0.233 Raiffeisenbank Hallertau Raiffeisenbank Hallertau 70169693
Fail 0.219 Landesbank Baden-Württemberg WGZ Bank 67050000