Cucumber with TestNG

355 views
Skip to first unread message

vaish...@gmail.com

unread,
Jan 4, 2019, 8:06:49 AM1/4/19
to Selenium Users
 
Hi,

I have written script in TestNG using cucumber framework.
I have used TestNG annotations @Beforeclass , @BeforeMethod , @Test
When I execute the script @BeforeMethod is not working.after execution of @Test
Can you tell me whether TesNG annotations are supported or not?.
Kindly can you guide me on this.

I am enclosing screen for reference.


Thanks,
VAISHNAVI SANKARI

⇜Krishnan Mahadevan⇝

unread,
Jan 4, 2019, 8:10:06 AM1/4/19
to seleniu...@googlegroups.com
Vaishnavi 

Please make sure that your Runner class extends AbstractTestNGCucumberTests and try again. 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/35748491-9b2e-4a93-9421-6cadd0ed2473%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

vaish...@gmail.com

unread,
Jan 7, 2019, 7:51:43 AM1/7/19
to Selenium Users
Hi,

I have extended my runner class extends AbstractTestNGCucumberTests but still @BeforeMethod is not executed after execution of @Test.
Kindly can you guide me on this.


Thanks,
VAISHNAVI SANKARI

⇜Krishnan Mahadevan⇝

unread,
Jan 7, 2019, 8:15:32 AM1/7/19
to seleniu...@googlegroups.com
Can you please share an example of how your code looks like ? 


For more options, visit https://groups.google.com/d/optout.

vaish...@gmail.com

unread,
Jan 7, 2019, 11:48:47 PM1/7/19
to Selenium Users
Hi,

I have attached runner class screen for reference.  Can you tell where I have an error in my code.

Thanks,
VAISHNAVI SANKARI


Runner class :

Step definition:

Shivani

unread,
Jul 20, 2019, 10:05:36 AM7/20/19
to Selenium Users
can we use TestNG annotations in step definition class?? 

cjayswal

unread,
Jul 20, 2019, 1:47:15 PM7/20/19
to Selenium Users
Why you want to consider step as test and what is the purpose? if you are calling that step from scenario what is purpose of putting @Test annotation on step?
Scenario can be considered equivalent to TestNG or Junit test.

Take a look to QAF which is TestNG BDD extension supports multiple BDD syntax including gherkin and all testNG features natively.
When you are using qaf:
  • Each bdd/gherkin scenario becomes TestNG test
  • If you are not using BDD and writing test in Java (methods with @Test) still you will see similar report with step in report.
  • You can use any TestNG listeners same as test written in java
  • You can use inbuilt data provider and create your custom as well
  • Use TestNG configuration file with all features including grouping and parallel execution configuration
  • Additional listeners support for driver , element and step listener
  • Advance BDD2 syntax in addition to gherkin and bdd, derived from qaf-bdd, gherkin and jbehave provides a way to specify meta-data with gherkin (like set priority, enabled etc.). You can use any gherkin or QAF BDD editor.
  • Supports web, mobile and web-services so can you focus on testing of AUT rather then struggling with common needs like driver management, reporting, resource management, thread safety for parallel execution etc.
If you have existing gherkin feature files with cucumber implementation you can use existing cucumber implementation as well. If you are not using BDD and writing test in Java (methods with @Test) still you will see similar report with step in report.


शनिवार, 20 जुलाई 2019 को 7:05:36 पूर्व UTC-7 को, Shivani ने लिखा:
Reply all
Reply to author
Forward
0 new messages