JS API to type-cast and handle all the match types supported in the DSL
See original GitHub issuefrom discussion here: https://stackoverflow.com/a/62638847/143475
currently type conversion is possible only via the companions to def
e.g. json
xml
etc: https://github.com/intuit/karate#type-conversion
sometimes there is a need to type-cast when within a JS block. also - a feature to auto-detect a string and type-cast it would be nice. proposals below (JS block, not Gherkin)
// not 100% sure that data1 can "remain" as XML after making it back to a feature
var data1 = karate.fromString(someString);
// this will follow the same rules as type-conversion keywords (see link above)
var data2 = karate.toType('json', anyObject);
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (10 by maintainers)
Top Results From Across the Web
JS API to type-cast and handle all the match types supported ...
p.s. I am working on adding something close to a kafka dsl to karate, so that people that are not very technical could...
Read more >Variables and their type conversion using KarateDSL
They exist just to categorize and store data in memory. Type conversions is the process of converting a variable from one data type...
Read more >Karate DSL - $.embedded_json_message | data types don't ...
I have a scenario where I'm retrieving rows of data from a Postgres DB table and matching the corresponding column output against a...
Read more >Multi-match query | Elasticsearch Guide [8.5] | Elastic
Types of multi_match query:edit ; best_fields. (default) Finds documents which match any field, but uses the _score from the best field. See best_fields...
Read more >Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Kostas
I had put together something simple a while ago to test Kafka from Karate. Pls see if https://github.com/Sdaas/karate-kafka helps
Daas
Managed to get things working! Thank you for your explanations! Seems that if I use match then no asMap or asList is needed, but they are needed if I want to invoke a custom javascript filter.
All of the below pass with latest develop, many thanks, I’ll have to think how to incorporate it with the rest of our code once it is in a release candidate