TestNG - PASS/FAIL - Assertions or Verify

28 views
Skip to first unread message

karthik

unread,
May 16, 2018, 2:36:13 AM5/16/18
to Selenium Users
Dear Gurus,

I'm using TestNG @DataProvider as we need to run the same test method multiple times with different data sets. Also every run would display a different output message (based on the input  from the excel) on the web front end.

Ex:

1 . First record - The display message is "  Customer info is correct"  (Smith, john, 45, testaddress 123, customer info is correct)
2.  Second record - The display message is " Cusomter info is incorrect"
3.  Third record  - The display message is " Customer info has been already entered"

How do I handle my TestNG to PASS/FAIL based on the expected message(The message mentioned against the specific record on the excel sheet) against / actual message being displayed on the page.

Can we use the assertions (multiple assertions ?) on the Switch Case ?

Kindly advise

PS: Attached the excel sheet for your reference.

Thanks,
Karthik


<<

@Test(dataProvider = "abc", dataProviderClass = DataFactory.class)
public void donortoolcalc(String donorname, String donorage,......, String expectedMessage) throws Throwable {
test123.xls

Sahil Chaudhary

unread,
May 16, 2018, 7:19:36 AM5/16/18
to seleniu...@googlegroups.com
Hi , 

You can add one column with Name run in excel and give value Y or N in that column. Fetch records for which you want to run Test case. Suppose you have two rows with Y. Two rows will be fetched in 2 D array. Which will be input to data provider and your test will run twice for two test data.

Thanks
Sahil 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/38b8ad54-1b14-4818-82a1-a97863cc875d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

karthik

unread,
May 16, 2018, 6:35:33 PM5/16/18
to Selenium Users
Thanks Sahil for your prompt response.  Much Appreciated.

Im sorry if I my question was misleading.  The objective is not to fetch records and run it against the test case (its already working tho)

I'm looking out for the solution to direct TestNG to PASS/FAIL (after the run) based on the displayed message (expected message / actual message) on the web front end.

Sorry, Does this make sense ?


On Wednesday, May 16, 2018 at 9:19:36 PM UTC+10, Sahil Chaudhary wrote:
Hi , 

You can add one column with Name run in excel and give value Y or N in that column. Fetch records for which you want to run Test case. Suppose you have two rows with Y. Two rows will be fetched in 2 D array. Which will be input to data provider and your test will run twice for two test data.

Thanks
Sahil 
On Wed, May 16, 2018 at 12:06 PM, karthik <sapsdkar...@gmail.com> wrote:
Dear Gurus,

I'm using TestNG @DataProvider as we need to run the same test method multiple times with different data sets. Also every run would display a different output message (based on the input  from the excel) on the web front end.

Ex:

1 . First record - The display message is "  Customer info is correct"  (Smith, john, 45, testaddress 123, customer info is correct)
2.  Second record - The display message is " Cusomter info is incorrect"
3.  Third record  - The display message is " Customer info has been already entered"

How do I handle my TestNG to PASS/FAIL based on the expected message(The message mentioned against the specific record on the excel sheet) against / actual message being displayed on the page.

Can we use the assertions (multiple assertions ?) on the Switch Case ?

Kindly advise

PS: Attached the excel sheet for your reference.

Thanks,
Karthik


<<

@Test(dataProvider = "abc", dataProviderClass = DataFactory.class)
public void donortoolcalc(String donorname, String donorage,......, String expectedMessage) throws Throwable {

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Boopathi krishnamoorthy

unread,
May 16, 2018, 11:36:25 PM5/16/18
to seleniu...@googlegroups.com
Compare the message which displayed in the UI against the message present in the data sheet if both matches then make it pass else fail it.

Thanks 
Boopathi 

On Wed 16 May, 2018, 12:11 PM karthik, <sapsdkar...@gmail.com> wrote:
Boxbe This message is eligible for Automatic Cleanup! (sapsdkar...@gmail.com) Add cleanup rule | More info
Reply all
Reply to author
Forward
0 new messages