How to generate reports for each scenario using Cucumber JVM? - cucumber-jvm

the default cucumber-html report is generated once the execution is completed, but I want the same report to be generated for each scenario instead.
Is there a direct API that I can use or do I need to write custom formatters to generate the report for each scenario?

Using the Gherkin Formatters and pointing to that class instead of format html helped me in generating reports for each scenario.

Related

How to configure csv data set in websocket sampler using jmeter?

I am using jmeter tool for websocket testing. I need to create multiple orders with multiple users and for that i need to set up csv data set. How can i use it in websocket sampler? As i can see that the request is sent in "Request Data" section but how should i give the variable names there and how would it read through csv?
There might be a bug in the "websocket sampler" plugin you are using. Try out WebSocket Samplers by Peter Doornbosch, current version (JMeterWebSocketSamplers-0.12.jar) doesn't seem to be having problems with parameterizing via JMeter Functions and/or Variables
You can install the plugin using JMeter Plugins Manager
I don't know which Websocket plugin you're using, but see this for best solution:
https://stackoverflow.com/a/39110121/460802
If you follow the one we advise , then just add a CSV Data Set config to your plan filling required fields:
Pay attention to Variable Names (example here myData1).
You can then use it through:
${myData1}

Jmeter Testing shows null message for api links

How can I handle data from ":/some/api/link" while I am recording using JMeter it works and when I try it again it shows "null" message in 'View results tree'.
In the majority of cases you won't be able to record and replay you test as modern applications and web APIs normally use dynamic parameters for authentication and security purposes. So most probably your Test Plan should look as follows:
1st request
Post Processor (in case of REST API it will be JSON Extractor, in case of SOAP API it will be XPath Extractor) to extract any dynamic parameters and save them into JMeter Variables
2nd request where you should replace hard-coded recorded values with the variables defined in the previous step
The easiest way to detect the dynamic parameters is recording your test 2 times and compare the generated requests, you will need to correlate parameters which differ.
See API Testing With JMeter and the JSON Extractor for more details.

RESTful Service not working for multiple calls

I have created a Restful Service which accepts input xml and outputs response xml. Before giving output xml it calls Web Service and gets the xml from it. I do some modifications to the xml and output it.
The client reports that when they do load testing, sometimes the response comes properly and sometimes does not from RESTful Service.
How can I do load testing with JMeter and find the loophole in it. This happens for multiple calls.
2 great references for jmeter are:
- http://blog.milamberspace.net/ if you talk french
- http://theworkaholic.blogspot.fr/ if not
But you should definitely start by reading :
- http://jmeter.apache.org/usermanual/index.html
Then ask questions on jmeter user list if you are stuck.
Regards
Philippe
First create new test and save test scenario with JMeter Proxy (records user clicks in a browser).
Then use the recorded components to compose your actual test.
Don't forget to use JMeter Plugins (invaluable).

can i accept inputs from an excel sheet using watin

HI
I'm testing a web application using watin. I need to pass multiple inputs to the application for doing this each time i need to change inputs in the code. So is it possible in watin to accept inputs from excel file.
This tool might help you: WAX
Wax allows users to create automated WatiN tests using Microsoft Excel
WatiN offers no (native) way for this. You should solve this with the test runner you are using:
NUnit, MBUnit, XUnit all offer some kind of RowTest functionality which allows you to read data from excel and use that as input for your WatiN tests.
HTH,
Jeroen
Lead dev WatiN
The approach that we use is to use SQL Express for our test data, we then generate a DAL layer using subsonic, and pass a string around as a key, and then get the data from the database as a "test data object".
The one line of code that we write in the DAL in a partial class is similar to
public partial class Project
{
public static Project GetProjectDetails(string ProjectName)
{
return new Select().From<Projects>().Where("ProjectName").IsEqualTo(ProjectName).ExecuteSingle<Project>();
}
}
Our test code then looks something like this:
TestData.Project project = TestData.Project.GetProjectDetails(projectName);
domContainer.TextField( ... project name field ...).Value = Project.ProjectName;
domContainer.TextField( ... project type field ...).Value = Project.ProjectType;
The other way is the nUnit feature Jeroen is refering to the nUnit row test extension.
If you were really motivated you could write a WatiN adapter for FitNesse or RobotFramework.
WatiN tests are written in .Net. .Net provides functionality to access Excel spreadsheets as needed. Just write them into the test code.

JMeter Tests and Non-Static GET/POST Parameters

What's the best strategy to use when writing JMeters tests against a web application where the values of certain query-string and post variables are going to change for each run.
Quick, common, example
You go to a Web Page
Enter some information into a form
Click Save
Behind the scenes, a new record is entered in the database
You want to edit the record you just entered, so you go to another web page. Behind the scenes it's passing the page a parameter with the Database ID of the row you just created
When you're running step 5 of the above test, the page parameter/Database ID is going to change each time.
The workflow/strategy I'm currently using is
Record a test using the above actions
Make a note of each place where a query string variable may change from run to run
Use a XPath or Regular Expression Extractor to pull the value out of a response and into a JMeter variable
Replace all appropriate instances of the hard-coded parameter with the above variable.
This works and can be automated to an extent. However, it can get tedious, is error prone, and fragile. Is there a better/commonly accepted way of handling this situation? (Or is this why most people just use JMeter to play back logs? (-;)
Sounds to me like your on the right track. The best that can be achieved by JMeter is to extract page variables with a regular expression or xpath post processor. However your absolutely correct in that this is not a scalable solution and becomes increasingly tricky to maintain or grow.
If you've reached is point then you may want to consider a tool which is more specialised for this sort of problem. Have a look web testing tool such as Watir, it will automatically handle changing post parameters; but you would still need to extract parameters if you need to do a database update but using Watir allows for better code reuse making the problem less painful.
We have had great success in testing similar scenarios with JMeter by storing parameters in JMeter Variables within a JDBC assertion. We then do our http get/post and use a BSF Assertion and javascript do complex validation of the response. Hope it helps