QUERY: Using Karate DSL with javascript based UI automation framework - karate

I want to know, if we can use karate with JS based UI automation framework. And if yes, what are the requisite to follow. Do we require maven in that case?
We have well matured UI automation Selenium based framework. We want to know, if we can integrate Karate DSL without using maven.

You might if you use the CLI (command line interface) provided by the stand-alone JAR / executable. Please read the documentation here: https://github.com/intuit/karate/tree/master/karate-netty#standalone-jar
Which means if you can call an OS command from node / JS - you can use Karate. But there are no guarantees - and you can assume the answer to your question is NO.
That said - we plan to have our own competitor to Selenium - but it will take a little more time: https://github.com/intuit/karate/tree/master/karate-core

Related

How I can make the URL of my summary report public to share in Karate framework [duplicate]

I'm trying to get reporting working for Karate DSL, and it's proven a challenge because my team uses Circle CI instead of Jenkins. Cucumber reporting seems to only work for Jenkins.
I've had a look at this documentation, here:
https://github.com/intuit/karate/tree/master/karate-demo#example-report
https://github.com/jenkinsci/cucumber-reports-plugin
I was wondering if there is a circle friendly equivalent you could recommend? It'd be even better if the reports could be generated in the terminal. It's going to be a hard sell to convince my team to change CI tools just so I can implement a test framework.
Thanks!
Here's what I suggest:
If you follow the demo / doc instructions - you will get the HTML reports in say target/cucumber-html-reports, and this is "pure Maven and Java", no dependency on CircleCI at all so far.
Now all you need to do is somehow make these HTML reports accessible via the web. In Jenkins, there is an HTML Publisher Plugin. I am not familiar with CircleCI but a quick search suggests that there is a way to expose links to build artifacts.
Also note that when you follow the demo, Java JUnit XML reports would also be output to target/cucumber-reports. It looks like CircleCI has support for these which means that it should be able to derive the build pass/fail status and stats if configured right.
Also note that Karate now enables you to write custom reports: https://stackoverflow.com/a/66773839/143475

Is there a way to run Karate tests as an integration test suite against a pre-booted spring boot server?

Is there any good way to get Karate tests to test a Spring-Boot microservice in the "integration-test" phase of a Maven build? What I mean is: is there an anti-pattern/workaround that works well OR am I out of luck because this was an afterthought of the Karate development?
Facts I have gathered so far:
It says here: "the surefire plugin is not hardcoded into Karate"
Is there a way to run Karate test during maven's integration test phase?
Running Karate tests in context of maven-failsafe-plugin does not work at all. Easy to reproduce on my test project url below. Two problems foremost:
When running from maven-failsafe, Karate will generate .txt and .html files but does not generate .json Cucumber output files.
Therefore, you can get no HTML report from the cucumber-reporting plugin (which I require)
I created a project to demonstrate these facts: https://github.com/djangofan/karate-api-sample
Running integration tests requires that I start Spring Boot before the test suite and then stop the spring boot server afterwards. Maven SureFire does not have this capability BUT the maven failsafe plugin does: the maven build helper plugin has a pre-integration-test hook for it. Limited only by Maven surefire, I am out of luck.
I see an example in the karate/karate-demo project of starting the spring boot server from code. This is not easy to accomplish when I am trying to test a web service that is already established. Is this my only option: to use surefire with a class filter and code to bootstrap?
Given no good answer, I will just revert to using cucumber-java + resteasy, which I am pretty sure will work with maven failsafe: https://maven.apache.org/surefire/maven-failsafe-plugin/examples/cucumber.html
First, this is not Karate.js not sure where that came from :)
When running from maven-failsafe, Karate will generate .txt and .html files but does not generate .json Cucumber output files.
Sorry, cannot replicate.
For failsafe, just use the naming conventions and it will work, e.g. **/IT*.java
Maven SureFire does not have this capability BUT the maven failsafe plugin does:
So use failsafe as mentioned above. If you are not able to do that, please change your project to demonstrate the issue and we promise to fix it. Also refer these instructions: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Given no good answer, I will just revert to using cucumber-java + resteasy
That is of course your choice. At least in my (biased :) opinion you will miss all the JSON assertion value that Karate adds, and the parallel execution + aggregation of reports. I am sure you will help as far as possible so that we can make the experience better for all who need this solution - but else, hey - no worries :P

How to run karate test runner file with TestNG? [duplicate]

This question already has an answer here:
Karate framework and TestNG
(1 answer)
Closed last year.
We have implemented cucumber with rest assured for API automation. Recently we came to know Karate giving advantages when compared with Rest assured. So I thought of recommend to my organization to use Karate, hence I have prepared sample to API automation scripts with Karate. Yes, I can execute very well with JUnit, but same testrunner file if I tried to execute with TestNG am unable to execute at all, displaying Test runs are zero after my execution.
Could you please help me is there any way to run Karate runner file with TestNG framwework. Really your answer going to make us decision.
I have gone through various posts which are related TestNG with Karate. But unluckily am unable to trigger my scripts.
Note: I have extended KarateRunner class and used #KarateOptions as well in my code.
TestNG is needed only for development mode. All teams finally need to do CI and here Karate does not need even JUnit, please refer this: https://github.com/intuit/karate#parallel-execution
Now for development mode - even if you insist on using TestNG, you can mix JUnit into the same project: https://stackoverflow.com/a/19928639/143475
Please give up trying to use TestNG for Karate, it is un-necessary and a waste of your time. Also note that we have IDE support which is what most developers will use. Even the JUnit support is not needed most of the time.

Is there any framework which supports Behaviour driven approch (bdd) for selenium-webdriver with driver managment?

I want to start my automation project from scratch, as per requirements I have to use Behavior Driven Approach for testcase authoring and selenium for Automation. please suggest best suited framework.
You can check open source QMetry Automation Framework for web (selenium-webdriver) and mobile (appium) automation. It has all the features driver management, parallel execution, run configuration you want and many more like data-driven testing, data-bean, locator repository, integration with third party tools (CI, Test Management tools etc).
It support BDD, keyword-driven and coded (TestNG test) approach for authoring test cases. So you can opt bdd for test authoring.
You also will find inbuilt bdd steps ready to use for selenium webdriver and rest-webservices with the framework.
You can start by downloading blank project from git which uses ANT and IVY. If you want to use maven you can download qaf-blank-project-maven.
For getting started follow step-by-step-tutorial

Automation tests using Cucumber, SoapUI and Selenium

I'd like to use Cucumber linked with SoapUI and Selenium in order to create an automation functional test.
I only found one website about it, describing that first I have to create a SoapUI project and save it as a .xml file. Then I should include this file into the test project using Cucumber and Selenium.
My first question is what configuration do I have to do for that ? (in the pom.xml file when using Maven for example or in any configuration file for Jenkins)
My second and last question is : if I launch every night with Jenkins (let's say that as an example) my tests, do I have to launch first the SoapUI project and import it again in the test project to run my tests in a good way ?
Thanks for your answers
I think you can use REST Assured for you API testing.
Use cucumber for your BDD statement, use java for there step definition and REST Assured for all the API request stuff.
Wrap all your automation with well written Gherkin and you'll need no other documentation. Think about that. BDD (specification by example) is a requirements approach, not a testing approach.