Good morning, i am doing a test class for one javafx class, im trying to control errors right now. When an error ocurred shows me a Dialog Alert with a message who explain the error. I want to compare this message with other in my test class.
Thats last thing that i try.
LOGIN CLASS
catch (ServerConnectionErrorException ex) {
LOGGER.warning("LoginWindowController: Server connection error");
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Server Error");
alert.setContentText("Unable to connect with server");
Label serverErrorContext = new Label();
serverErrorContext.setText(alert.getContentText());
serverErrorContext.setId("serverErrorContext");
alert.showAndWait();
}
TEST CLASS
@Test
public void test4_ConnectionError(){
clickOn("#txtLogin");
write("user");
clickOn("#txtPass");
write("BBccd1234");
clickOn("#btLogin");
FxAssert.verifyThat("#serverErrorContext",LabeledMatchers.hasText("Unable to connect with server"));
clickOn(".button");
}
Aucun commentaire:
Enregistrer un commentaire