Executing cucumber (gherkin scripts) with SOAP UI ? - cucumber

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.

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

Cucumber Framework Migration - Existing Rest Assured to Karate Framework

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

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.

How do automation for web services using CuCumber?

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.

Integration Testing and Load Testing : using the same scenarii (JVM)

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.

Resources