Cucumber-Enconding does not accept accented variable

Asked

Viewed 226 times

1

in my software test done on Cucumber in a specific scenario I assign a string to a variable:

Scenario Part: "Then the system displays the message "Invalid User or Password!"

The string "Invalid User or Password" is set to variable LoginIn:

     public static void validarLoginInvalido(String LoginIn) throws Exception {
        Alert alert = driver.switchTo().alert();
        System.out.println("o valor da mensagem recebida foi: "+alert.getText());
        assertEquals(LoginIn, alert.getText());
        //assertEquals("Usuário ou Senha Inválidos!", alert.getText());   
}

In my assertEquals compare my string passed in the scenario to the message displayed on the system screen that is: Invalid User or Password!

That is to say in the theologian the assert would pass because the compared messages are exactly equal, but the eclipse presents me with the following error:

org.junit.Comparisonfailure: expected:<Usu[ rio or Password Inv ]lido! > but was:<Usu[ário or Password Invá]lido!>

The enconding of Cucumber is the UTF-8, already tried to change the project enconding to: ISO-8859-1 and the same is presented.

OBS: The code commented in the above example :

assertEquals("Usuário ou Senha Inválidos!", alert.getText());

Comparing the two string and passing text statically works normally.

  • in Feature you have marked the language and encoding? type # language: en # encoding: iso-8859-1

  • Yes, I tested the UTF-8 enconding and ISO-8859-1, both have the same error

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.