-1

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.

Akshay jain
  • 555
  • 1
  • 7
  • 22

2 Answers2

0

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 a System.exit() is called). You can add all your validation in the hook thread.

Check the Java Doc for more information about shutdown hook.

Codebender
  • 14,221
  • 7
  • 48
  • 85
0

call the method (selenium) before the exit

else{
    //code to send the mail
     seleniumMethod();
    System.exit();
 }
seleniumMethod(){

//check mail }

KDP
  • 1,481
  • 7
  • 13