@Parameters annotation is getting executed at the very first for all the classes in test Runner

14 views
Skip to first unread message

RAKESH GHOSAL

unread,
Aug 22, 2016, 2:14:46 AM8/22/16
to Selenium Users
I'm attaching my entire project file.
I'm trying to build a DataDriver Framework of "http://demo.guru99.com/v4/index.php' - this is a demo site from Guru99 Bank.

It should be run as below :

1. Login to the system with Username and password as given in LoginTest. 
2. Create New Customer with new customer details as given in NewCustomer excel.
3. Edit customer with details as given in EditCustomer excel - but in this test, the customer number must be the same, which is generated in NewCustomer test.

Here I have 6 java files, LoginTest,NewCustomer,EditCustomer,TestBase,TestUtil and MyTestSuiteRunner.

LoginTest,NewCustomer,EditCustomer - all these are having @Parameters annotation to supply data from excel.

In NewCustomer.java, I have written a code to write customer no in EditCustomer excel file as soon as new customer is created.

Now the problem is, in MyTestSuiteRunner, I have provided 3 java class name in order of Login.class, NewCustomer.class, EditCustomer.class. Now Selenium is reading all the @Parameter annotation at the very begining, that is before executing @Test in LoginTest file also. Hence my purpose is not serving, that is while NewCustomer file is writing in EditCustomer excel, before that Selenium had already read the data from EditCustomer excel and it is supplying the old customer no already present in that excel.

So is there a way by which we can restrict selenium that only after NewCustomer file is executed, then only @Parameter should be run in EditCustomer File. Please help!!!

I have tried with @DataProvider(Junit) as well, but it is also having the same prob.
DatadriverFramework.7z
Reply all
Reply to author
Forward
0 new messages