TestNG - PASS/FAIL - Assertions or Verify

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TestNG - PASS/FAIL - Assertions or Verify

sapsdkarthik2009
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 [hidden email].
To post to this group, send email to [hidden email].
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.

test123.xls (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TestNG - PASS/FAIL - Assertions or Verify

Sahil Chaudhary
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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAA2NVpPHCiNO%2BoRYPkFHO8K92nLRJ51zdE-wvki4ZMbp5ntRxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG - PASS/FAIL - Assertions or Verify

sapsdkarthik2009
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="m7I4bZteCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sapsdkar...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="m7I4bZteCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="m7I4bZteCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/38b8ad54-1b14-4818-82a1-a97863cc875d%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/38b8ad54-1b14-4818-82a1-a97863cc875d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/38b8ad54-1b14-4818-82a1-a97863cc875d%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/38b8ad54-1b14-4818-82a1-a97863cc875d%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/74f5f28a-1e17-43cc-bc84-df61006f6f22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG - PASS/FAIL - Assertions or Verify

Boopathi krishnamoorthy
In reply to this post by sapsdkarthik2009
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, <[hidden email]> wrote:
Boxbe This message is eligible for Automatic Cleanup! ([hidden email]) Add cleanup rule | More info
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAN0PPjoKp-67%2B4S2iN-OiNx00Cpprfv-ANSMhbw7qwCyy5L9iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.