Existing cucumber bdd steps do not work with Karate - cucumber

I have recently started using karate. I have an existing project which has steps with cucumber and now I am writing tests using karate. As Karate is built on cucumber, I am still not able to run my custom written step definitions.
I tried adding all cucumber and karate dependencies, adding cucumber option in karateRunner
NA
com.intuit.karate.exception.KarateException: KarateTesting.feature:14 - no step-definition method match found for: Then verify the transaction calculation and logic

Related

What is the difference between Serenity BDD Framework and Cucumber tool

Today I've got some theoretical question. I have a little experience in BDD with Cucumber. Now I started working in API testing and I faced with Serenity BDD framework on my new project. It is used with Cucumber. So I would like to clarify what is the difference between Serenity BDD Framework and Cucumber and why can't we use just Cucumber for our tests, because it seems to me, like these two tools are doing the same job. Could anybody give me some explanation or maybe some link to correspondent documentation. Thanks in advance!
No, those are 2 different things.
Cucumber is the layer to map BDD syntax, which is written in .feature file, with actual code that does the job.
Serenity BDD is the framework supporting 3 different approaches:
Cucumber: same features as stand-alone cucumber, can work with UI or API Automation
Page Object: works with UI automation (selenium)
Screenplay: a design pattern for UI and API automation
Serenity BDD does many things for auto testers that:
Config-oriented: serenity.properties or serenity.conf. For example: take screenshot when FOR_EACH_ACTION, BEFORE_AND_AFTER_EACH_STEP, AFTER_EACH_STEP, FOR_FAILURES, DISABLED. This is really helpful for debugging. https://serenity-bdd.github.io/theserenitybook/latest/serenity-system-properties.html#_serenity_take_screenshots
Living report: much more better comparing to cucumber. https://serenity-bdd.github.io/theserenitybook/latest/living-documentation.html
Wrap other libs in nice and clean APIs: serenity-appium, serenity-browserstack, serenity-cucumber, serenity-rest-assured, serenity-saucelabs, serenity-shutterbug1x ... You see all of them at https://github.com/serenity-bdd/serenity-core

How to generate cucumber reports not using a test runner

I have created an application which runs cucumber tests on demand
Previously I was running cucumber through a test runner in junit, but I now run the tests using cucumbers own io.cucumber.core.cli.Main.
Is there a way to use cucumber plugin "pretty" to generate cucumber reports with this approach?
You should add -p "html:target/cucumber-report/cucumber.html" to your options . See here.

Import Cucumber results to Jira/Xray

I am able to run the Cucumber/groovy (with maven/pom.xml) test locally. I'm trying to import the test results (results.jon) generated by cucumber to Jira with Xray.
I'm unable to find the steps or procedures required for this. The only source found: https://confluence.xpand-it.com/display/public/XRAY/Import+Execution+Results
but not applicable to my project. There is no CICD yet at the moment. Is there any way to generate results/reports imported to Jira every time I run a test/multiple tests?
For Gherkin-based frameworks, such as Cucumber, you can't simply submit the results. This is because Xray needs to have the Gherkin phrases, which cannot be inferred from the results file.
So you need to choose one of the possible cucumber flows. You need to either choose Xray as the master for the edition of Cucumber scenarios, or you need to use Git/SVN for that and then synch them to Xray.
These steps are detailed in the previous link.
You can see some useful tutorials here.
There are some cucumber specific tutorials, such as this one, but they're not fully detailed. You can see a more technically detailed tutorial for Serenity BDD that make those steps more visible, for the two different flows (you'll need then to adapt it to cucumber specifics, but the principles are the same).

Tests are skipped while using Cucable plugin

Im trying to using Cucable plugin for my cucumber automation framework, In order to be able to run scenarios and scenario outline in parallel and tests are getting skipped.
I tried to implement this using https://github.com/trivago/cucable-plugin#cucablerunner.
I followed each step but still I dont have success

Cucumber+TestNG and Cucumber+JUNIT comparison

Can anyone please help me in understanding what is difference or advantages of using Cucumber+TestNG over Cucumber+Junit ?
TestNG provides more Annotations Like #BeforeSuite .
TestNG it self provides support for Junit.
With Latest upgrade of cucumber(4.0) Cucumber - TestNg provides Parallel Execution at Scenario Level where as Junit provides at Feature level.
TestNG and Junit are just a unit testing frameworks, when you use Cucumber with Junit you can use Junit Annotation/Assertions in step definition file and similarly when you use Cucumber with TestNG you can use TestNG Annotation/Assertions in step definition file.
Actually in both cases you would be writing the Test Steps using selenium and probably will use the classes inside JUnit or TestNG to run the cucumber Feature file.
As per my knowledge the only place I used such file was the when I'm creating the TestRunner.java class.
It's much easier to do with JUnit since you just have to import org.junit.runner.RunWith But if you are using TestNG you'll need to use dataProviders and go on a bit more complex path to create the TestRunner Class
Other than that there won't be any other differences since you will be using cucumber features for testing.
Due to the above mentioned advantage, I recommend to use JUnit + Cucumber + Selenium for your scripting
I tried both but decided for JUNIT 4.12 (JUNIT 5 does not seem to work with cucumber yet). It has all that you need. But i have to test that parallel thing in Test NG i guess. ;)
I use Cucumber in a Spring Boot Project and therefore JUNIT did not cause any problems for me. I can hand over a browser instance over multiple classes here (#Autowired) and this makes my code so much more modularizable.
You may have more annotation-options with Test NG but somehow i have the feeling that more people work with JUnit, so you have more support and a bigger community here.

Resources