How to use variable in feature file
The easiest way is to write a step specific for returning lines items for "right now":
Given the API returns items for right now
You can call the other version of the step from the new version:
[Given(@"the API returns items for right now")]
public void GivenTheAPIReturnsItemsForRightNow()
{
GivenTheAPIReturnsItemsFor(DateTime.Now);
}
This avoids code duplication between steps.
How can I pass a variable from one feature file to other
Normally if you have two Scenario
-s that depend on one another you have to combine them into one. Refer the docs here: https://github.com/intuit/karate#script-structure
But if you are really looking for how to initialize something and re-use it across all feature files, maybe you are looking for karate.callSingle()
: https://github.com/intuit/karate#hooks
var result = karate.callSingle('get-token.feature');
Passing a variable from one feature file into another as a part of request URL(not query parameter) in Karate
Can you simplify your example ? The only thing I can make out is you need a space after the call
feature and before the call argument:
* call read('deleteVehicle.feature') { vehcileId: '#(vehicleId)' }
The pattern we generally recommend is to setUp not tearDown as tearDown has a risk of not executing if you had an error. That said, please see hooks: https://github.com/intuit/karate#hooks
Sometimes you should just keep it simple and call a feature (with args) only where you need it.
Returning Variable from Feature File With Multiple Scenarios - Karate
Can't say without seeing your code. But you can try using the @parallel=false
annotation in the "calling" feature file: https://github.com/intuit/karate#parallelfalse
Otherwise this may be a bug in Karate - so please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Related Topics
How to Write Data to a Text File Without Overwriting the Current Data
How to Upload File to Server With Http Post Multipart/Form-Data
How to Open a Url in Chrome Incognito Mode
How to Add Json to Restsharp Post Request
How to Read Appsettings.Json With Array of Values
Programmatically Close Aspx Page from Code Behind
Using Selenium2, How to Check If Certain Text Exists on the Page
How to Send a File Document to the Printer and Have It Print
Client Certificate Not Getting Added to the Request (Certificate Verify)
Build Query String for System.Net.Httpclient Get
Check If Datetime Is a Weekend or a Weekday
Angular Post Request Received in Net Core API as Null
How to Cast a List into a Type Which Inherits from List<T>
Clearing a Textbox Leaves an Invisible Character
How to Format a String as a Telephone Number in C#
How to Refresh or Show Immediately in Datagridview After Inserting
Split a Comma-Separated String With Both Quoted and Unquoted Strings