newbie to cucumber and selenuim in java
I am calling a method in cucumber test case and there if it goes into the else part it would send a mail and exit from the system.when i am running this method with cucumber then it will send the mail and exit with test case. How to resolve that
and after that by using selenium i want to open the browser and check the mailbox to check the mail has sent by the code or not.
You can use
Runtime.getRuntime().addShutdownHook(hook);
When you invoke this method, the thread
hook
will be called whenever the VM wants to shutdown (including when aSystem.exit()
is called). You can add all your validation in thehook
thread.Check the Java Doc for more information about shutdown hook.