mardi 28 août 2018

Run method if test doesnt finish

Hi Im having an issue i cant figure out, Im running a test on a betting game and at the start of each test I need to create a new game for the database, i run my tests on this game and then delete it, so the database doesnt get full of new games as i run about 20 tests that require this. However, the issue im finding is that if there is some UI change all of these tests might fail and im stuck with 20 games in the data base as the game.deletegame() hasnt ran and deleted the game. Is there a way i can get this to run if the test doesnt complete?

Here is my code: public class register_from_pick_screen extends ConditionsWebDriverFactory{

public static final int TEST_CASE_PASSED_STATUS = 1;
public static final int TEST_CASE_FAILED_STATUS = 5;


@Test
public void register_from_pick()throws Exception{
    CreateGameSD game = new CreateGameSD();
    game.create_Public_Free_to_Play_game_named_with_description(TestGames.test_web_game,TestGames.test_web_game_description);

    GameLobby lobby = new GameLobby();
    lobby.clickElementWithName(TestGames.test_web_game);
    LeaderBoard leaderboard = new LeaderBoard();
    GameId gameid = new GameId();
    gameid.game_id();
    leaderboard.joinGame();
    FixturesScreen fixtures = new FixturesScreen();
    fixtures.four_picks_make();
    fixtures.picks_match_total();
    fixtures.pick_removal_test();
    fixtures.submit_picks();
    Login login = new Login();
    login.select_register_from_login();
    Register register = new Register();
    register.register_in_pick_screen();
    fixtures.submit_picks();
    PickReceipt pick = new PickReceipt();
    pick.your_in_the_game();
    register_from_login_form.addResultForTestCase("16788",TEST_CASE_PASSED_STATUS," ");

    register_from_login_form.addResultForTestCase("17143",TEST_CASE_PASSED_STATUS," ");
    game.delete_game();



}

Aucun commentaire:

Enregistrer un commentaire