How to do automation for web services using Cu Cumber? Please guide me on how to start it for my project on web services.
You cannot start automation testing using cucumber. Cucumber is just a BDD framework, which lets you execute test cases.
However, The most recommended option is to use ruby language with the cucumber framework. If your using ruby and if your project has rest-api's, you can use the gem called rest-client and airborne.
You can search about these, and learn how are you going to pass the request with the parameters and analyse the response and call these codes using gherkin language. All these together will constitute a framework called cucumber, which you can use to execute.
On a side note: The next time you post, please have some research already done and post what error are you facing.
Related
I am working as automation tester for banking domain account. I have a query and need your help.
Current Approach :
1.The framework which we are using for API-Services testing is Java based - Serenity -Cucumber framework using Rest Assured.
2.All the script development/script maintenance activities related to this framework is taken care by the automation testers in our team.
3.Few weeks before , we got to know about Karate framework and completed the PoC( Proof of concept).
4.All went well and we are in the plan to migrate our existing Rest assured java code Karate framework.
The reason for migration - Karate framework Api services testing can be able to do by Manual testers as well.So we are in the plan for migration.
Query
We have almost 80 web services already developed in Rest assured and running successfully.
Also for migration, all the services are inter-dependent. So we have to use both Res-assured and Karate framework code together ,unless it's fully migrated.
Can't able to migrate all the services immediately ,it's a time taken effort.
Is it possible to run karate framework and Rest Assured Java code in the same scenario.
Scnario given in Karate Feature file:
Given urlCustomerservices
When method get
Then status 200
def getCustIDfromUserservices=newcallJavaFunction().getcustid("user","password")
print getCustIDfromUserservices
This "getcustid" have the Rest assured java code for "Post" call service to get the customer number.
When I am running this in code karate framework , getting this error -
"io.restassured.internal.RequestSpecificationIMpl.invokeMethod(java/lang/String;Ljava/lang/object;)Ljava/lang/object;
Could any help in this. Whether can we run both karate and Rest assured code together in same scenario in karate framework . If yes, why am getting this error, when am trying to get the response in Rest assured.
First I'll say that this is not something we claim to support :) So you are on your own.
That said, it sounds like a simple library conflict. My guess is your existing Maven pom.xml has a lot of libraries floating around. You will need to do some investigation and find out what maven exclusions you need to do or which libraries need explicit versions specified. If you are lucky, switching from karate-apache to karate-jersey may do the trick.
Also I strongly recommend creating a Karate quickstart, then adding the extra stuff one by one in "hello world" mode and see what causes the problem. Use the mvn dependency:tree command and see the differences between a Karate project and yours. If you know how to use Maven profiles, that may be one way to go. All the best !
Worst case, fall back to 2 maven modules and run 2 test-suites, it is fine and not the end of the world. You can gradually migrate.
EDIT - also see https://stackoverflow.com/a/65628686/143475
At the moment, I'm using two different frameworks for REST APIs integration testing, and load/stress testing. Respectively : geb (or cucumber) and gatling. But most of the time, I'm re-writing some pieces of code in load / performance scenarii that I've been writing for integration testing.
So the question is : is there a framework (running on the JVM) or simply a way, to write integration tests (for a strict REST API use case), preferably programmatically, then assemble load testing scenarios using these integration tests.
I've read cucumber maybe could do that, but I'm lacking a proper example.
The requirements :
write integration tests programmatically
for any integration test, have the ability to "extract" values (the same way gatling can extract json paths for instance)
assemble the integration tests in a load test scenario
If anyone has some experience to share, I'd be happy to read any blog article, GitHub repository, or whatever source dealing with such an approach.
Thanks in advance for your help.
It sounds like you want to extract a library that you use both for your integration tests as well as your load test.
Both tools you are referring to are able to use external jar.
Suppose that you use Maven or Gradle as build tool, create a new module that you refer to from both your integration tests and your load tests. Place all interaction logic in this new module. This should allow you to reuse the code you need.
I'm trying to find possibilities for the BDD approach of testing my web services with SOAP UI & Cucumber. Is there any way to achieve this ? Please advise
Thanks
Exactly, both SOAPUI and Cucumber are different test runners. You have to choose between both. Except that SOAPUI provides you http-clients for calling services and Cucumber can contain any tests that use different libraries/clients to do different type of testing.
Presuming that you are thinking to use SoapUI just as http-client for services testing, its better to use Jersey client and use Cucumber/JBehave as BDD runner.
I Do Agree with #I Am's answer. Using Jersey or other httpclient do the needful. In case of jersy with BDD you can use QAF with Web service plugin. You can use cucumber gherkin or QAF BDD or pure java for test authoring. QAF bdd for web-service may look like below:
SCENARIO: My Fist webservice call
META-DATA: {"description":"Just for learning purpose"}
When user requests '${get.sample.call}'
Then response should have status 'OK'
END
Where, get.sample.call will be in properties file holding request details.
I am new to node.js and I have decided that I will be using hapijs for my web and API implementations.
However, I have found that the hapi community built and use lab and code for the test and assertion libraries, which are a rewrite of mocha and chai.
I am having a hard time finding the differences between those libraries.
I know there is the possibility of using them all interchangeably but I would like a more detailed comparison, as I want to define and adhere coding standards and I don't like mix and match of libraries, unless there is a valid reason.
Any feedback is appreciated
When you are planning to build web application using nodejs Hapi is more suitable for it. Writing TTD is important for developer now a days. Lab and code is node framework to help to writing unit test in nodejs. Lab comes with Hapi to cover unit case for endpoint like writing test case for route and covering different scenarios for route. Code is an assertion library. Code is used if you are asserting response code ,response body and any header parameters.
I'm quite new to testing in javascript, where I work, we us node.js for our projects.
I finished one of our projects, but I only used manual testing.
I need to develop my testing skill and I dont know how to improve it.
I need any testing tool to run my node.js projects, could you please tell me how to improve and learn new testing skills?
Look at Mocha test framework. I think this is the best choose for testing node.js applications at this moment.
If you are using Node to develop a web application you could use one of the headless browsers to test the user interaction (along with ajax) there are PhantomJS and Zombie for example.
Look around in Node Toolbox you'll find many frameworks and utilities to create your tests.
This is a good overview on some of the different unit test tools for Node.js:
3 Quick Tips for Writing Tests in Node.Js (after some rambling)