Handling invalid data in datadriven test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Handling invalid data in datadriven test

deepareddy
Hi Tarun,

I have a doubt.i tried to run the code of your registration form on my system.In test data ie in CSV file i used invalid data in first row and valid data in second

In this case, since first set of data is invalid , it does not go to thank you page, its reading next set of data into the fields with the first set of data retained.its not clearing the old data.

Can you please help me out how to clear old data before reading next set of data.

I tried driver.navigate().refresh(); it dint work.

@Test(dataProvider = "regCSVData", dataProviderClass = RegistrationData.class)
    public void newRegistrationUsingCSVFile(RegistrationData registrationData) {
        NewRegistrationPage registration = PageFactory.initElements(driver, NewRegistrationPage.class);
        registration.registerNewUser(registrationData);
        assert driver.findElement(By.tagName("body")).getText().contains("Thank you for registering. "+ "You may now sign-in using the user name and password you've just entered.");
        driver.navigate().refresh();
        driver.get(appURL);
    }

Thanks,
Deepa