dryRun Implementation in Karate - karate

Just wondering if we have the dryRun functionality of cucumber in Karate ? I have gone through the information in this link - https://github.com/intuit/karate/issues/434 but it doesn't really tell me if a solution has been implemented or not. If not explicit to "dryRun" do we have a functionality within Karate that does the same operation as Cucumber ?
I have a framework and would like to know the overall count / scenarios that has been scripted and running it without the dryRun tag is a bit of an overkill

#qatestprofile
I have created Karate demo project with Dry Run example which generates HTML scenario table using Karate's Dry Run option and you can use the code as per your need.
Note: This demo example can be improved so feel free to suggest.

Related

Migration from 0.9.5 to 1.0.1 - ScriptBridge class equivalent

We would like to move our api test created using karate framework to karate framework 1.0.1. I see that there is no such class as ScriptBridge which is used by us to attach screenshots and get information about test status, tags of currently running scenario.
What is the equivalent for the ScriptBridge class?
My question is related with Attaching screenshots to json report where I asked how to attach screenshots to report.
Short answer to your question, the class you are looking for is ScenarioBridge.
But the HTML reporting has been overhauled and hopefully you will be able to achieve what you need without hacking into internal classes. There is a somewhat undocumented doc keyword, you will find an example in the link below. If you feel helpers for handling images need to be part of Karate, do contribute or suggest a feature request.
Please read this: https://stackoverflow.com/a/66822585/143475

Karate Java API for Match methods

Background:
I noticed this interesting post on Twitter about a Java API for Karate: https://twitter.com/ptrthomas/status/1344290316212342784
I don't have a twitter account so unable to reply - hope you don't mind me asking here instead.
I have used Karate (with the parallel runner, feature files and all) in one work project and it is a joy to use - and a few folks in the workplace are very impressed with the complex JSON assertion. We are achieving a level of JSON response field coverage for that project that is not possible with other frameworks (IMO).
I've now been tasked with improving an older test project which uses JUnit + RESTAssured, but has quite limited field assertions. I am unable to fully convert it to raw Karate (too many tests, not enough time), but I'm keen to explore the possibility of supplementing what is there already with the Karate Java API mentioned in above twitter post.
For example - for an existing test which gets a Response using RESTAssured, it would be nice for me to somehow use the 'contains' method (or any of the methods in Match class) in Karate to assert that response, as it is the best JSON assertion tool I have come across.
Questions:
Off the bat - is this a practice you would recommend for my use case? Let me know if you think this is an anti-pattern. I ask this because the example here (https://github.com/ptrthomas/karate-showcase) is not using RESTAssured to get the response and my use case is a bit different.
If its worth exploring - I assume this stuff will be available in v1.0.0? (I see public methods such as that are on the develop branch, but couldn't see it on the v1.0.0 github thread).
but I'm keen to explore the possibility of supplementing what is there already with the Karate Java API mentioned in above twitter post.
That's very interesting and you have got me also thinking about this potentially interesting way to introduce Karate to legacy projects. I do get this question on how to magically migrate existing RA tests a lot.
I would recommend it. You can expect a 0.9.9.RC3 next week that should have all the assertions you want. And the API has been simplified so you don't need to call isTrue() etc.
We plan to have better examples (maybe you can help) but for now, use this as a starting point (look at the last test / very end of the file): MatchTest.java
If you want to get started now (which I recommend and you can provide more feedback) do take a look at the developer guide: https://github.com/intuit/karate/wiki/Developer-Guide

Do Karate UI support Angular UI based application testing

If karate supports Angular testing, can i have some example so that i can look into it.
Have been going through locators given at https://intuit.github.io/karate/karate-core/#locators but unable to get exact information on how to proceed.
There is no need, Karate works with plain HTML.
And if you need to do some specifc JS helpers (which is all that frameworks that claim to support Angular do), just use the tips here and make re-usable functions: https://stackoverflow.com/a/60800181/143475
If you still have a question, ask a new question and provide a sample (can be online, see examples in link above) for us to understand and discuss.

Can python wrapper scripts be executed in karate tests

I have been using Karate for our Java application & its working out pretty good. Some teams in our company have been using python in their Development & QE process. They are interested in karate, but is there a possibility to run python scripts within karate tests?
Atleast 3 different teams have come to us asking for this. Please let me know if anyone is already doing this (or) if there is a possibility to do this. Thanks.
I think you have some pretty good options here.
First, look at this answer. It will be very easy to call any command line program from a Karate test: https://stackoverflow.com/a/51150286/143475
A new development in Karate is that there is a stand-alone JAR (binary) which contains all the capabilities, including parallel running and HTML reports. This is ideal for teams that don't want to set up a Java IDE - only a JRE is sufficient. So you can even invoke Karate from the command-line. You can even edit / debug tests using the Karate UI - but this still needs work and we are looking for contributions.
Please refer the documentation here, and you can try this within a few minutes: https://github.com/intuit/karate/tree/develop/karate-netty#standalone-jar

How to run together Cucumber and Gatling

I am new to test and during my intership, I had to look for some good tools to automate functional tests.
So I made a lot of searches and decided to use Cucumber, linked with Selenium and SoapUI.
But the fact is that another search had been made before to automate load tests and Gatling (used with Jenkins) had been chosen for that.
Then I am asking to find a solution to gather the 2 solutions but it is quite hard to find any solution about that.
The only information I catch was using Taurus to have a single configuration file.
If you have any information which you think coul help me, I would be very thankful.
The purpose and techniques used by cucumber and gatling are very different so you will probably not want to push interoperation too far.
For example, you plan to use Selenium in your cucumber steps. That would not work well with the performance testing.
If you use jvm version of cucumber, you'll be able to reuse some of the utilities, for example test builders.