Best Karate code snippet using com.intuit.karate.core.ScenarioBridge.merge
Source:ScenarioBridge.java
...5 *6 * Permission is hereby granted, free of charge, to any person obtaining a copy7 * of this software and associated documentation files (the "Software"), to deal8 * in the Software without restriction, including without limitation the rights9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10 * copies of the Software, and to permit persons to whom the Software is11 * furnished to do so, subject to the following conditions:12 *13 * The above copyright notice and this permission notice shall be included in14 * all copies or substantial portions of the Software.15 *16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22 * THE SOFTWARE.23 */24package com.intuit.karate.core;25import com.intuit.karate.EventContext;26import com.intuit.karate.FileUtils;27import com.intuit.karate.Json;28import com.intuit.karate.JsonUtils;29import com.intuit.karate.KarateException;30import com.intuit.karate.Logger;31import com.intuit.karate.Match;32import com.intuit.karate.MatchStep;33import com.intuit.karate.PerfContext;34import com.intuit.karate.StringUtils;35import com.intuit.karate.XmlUtils;36import com.intuit.karate.graal.JsEngine;37import com.intuit.karate.graal.JsLambda;38import com.intuit.karate.graal.JsList;39import com.intuit.karate.graal.JsMap;40import com.intuit.karate.graal.JsValue;41import com.intuit.karate.http.HttpClient;42import com.intuit.karate.http.HttpRequest;43import com.intuit.karate.http.HttpRequestBuilder;44import com.intuit.karate.http.ResourceType;45import com.intuit.karate.http.WebSocketClient;46import com.intuit.karate.http.WebSocketOptions;47import com.intuit.karate.shell.Command;48import java.io.File;49import java.net.URLDecoder;50import java.net.URLEncoder;51import java.util.ArrayList;52import java.util.Collections;53import java.util.HashMap;54import java.util.LinkedHashMap;55import java.util.LinkedHashSet;56import java.util.List;57import java.util.Map;58import java.util.Set;59import java.util.TreeMap;60import java.util.function.Function;61import java.util.regex.Matcher;62import java.util.regex.Pattern;63import org.graalvm.polyglot.Value;64/**65 *66 * @author pthomas367 */68public class ScenarioBridge implements PerfContext, EventContext {69 private final ScenarioEngine ENGINE;70 protected ScenarioBridge(ScenarioEngine engine) {71 ENGINE = engine;72 }73 public void abort() {74 getEngine().setAborted(true);75 }76 public Object append(Value... vals) {77 List list = new ArrayList();78 JsList jsList = new JsList(list);79 if (vals.length == 0) {80 return jsList;81 }82 Value val = vals[0];83 if (val.hasArrayElements()) {84 list.addAll(val.as(List.class));85 } else {86 list.add(val.as(Object.class));87 }88 if (vals.length == 1) {89 return jsList;90 }91 for (int i = 1; i < vals.length; i++) {92 Value v = vals[i];93 if (v.hasArrayElements()) {94 list.addAll(v.as(List.class));95 } else {96 list.add(v.as(Object.class));97 }98 }99 return jsList;100 }101 private Object appendToInternal(String varName, Value... vals) {102 ScenarioEngine engine = getEngine();103 Variable var = engine.vars.get(varName);104 if (!var.isList()) {105 return null;106 }107 List list = var.getValue();108 for (Value v : vals) {109 if (v.hasArrayElements()) {110 list.addAll(v.as(List.class));111 } else {112 Object temp = v.as(Object.class);113 list.add(temp);114 }115 }116 engine.setVariable(varName, list);117 return new JsList(list);118 }119 public Object appendTo(Value ref, Value... vals) {120 if (ref.isString()) {121 return appendToInternal(ref.asString(), vals);122 }123 List list;124 if (ref.hasArrayElements()) {125 list = new JsValue(ref).getAsList(); // make sure we unwrap the "original" list126 } else {127 list = new ArrayList();128 }129 for (Value v : vals) {130 if (v.hasArrayElements()) {131 list.addAll(v.as(List.class));132 } else {133 Object temp = v.as(Object.class);134 list.add(temp);135 }136 }137 return new JsList(list);138 }139 public Object call(String fileName) {140 return call(false, fileName, null);141 }142 public Object call(String fileName, Value arg) {143 return call(false, fileName, arg);144 }145 public Object call(boolean sharedScope, String fileName) {146 return call(sharedScope, fileName, null);147 }148 public Object call(boolean sharedScope, String fileName, Value arg) {149 ScenarioEngine engine = getEngine();150 Variable called = new Variable(engine.fileReader.readFile(fileName));151 Variable result = engine.call(called, arg == null ? null : new Variable(arg), sharedScope);152 return JsValue.fromJava(result.getValue());153 }154 private static Object callSingleResult(ScenarioEngine engine, Object o) throws Exception {155 if (o instanceof Exception) {156 engine.logger.warn("callSingle() cached result is an exception");157 throw (Exception) o;158 }159 // if we don't clone, an attach operation would update the tree within the cached value160 // causing future cache hit + attach attempts to fail !161 o = engine.recurseAndAttachAndShallowClone(o);162 return JsValue.fromJava(o);163 }164 public Object callSingle(String fileName) throws Exception {165 return callSingle(fileName, null);166 }167 public Object callSingle(String fileName, Value arg) throws Exception {168 ScenarioEngine engine = getEngine();169 final Map<String, Object> CACHE = engine.runtime.featureRuntime.suite.callSingleCache;170 int minutes = engine.getConfig().getCallSingleCacheMinutes();171 if ((minutes == 0) && CACHE.containsKey(fileName)) {172 engine.logger.trace("callSingle cache hit: {}", fileName);173 return callSingleResult(engine, CACHE.get(fileName));174 }175 long startTime = System.currentTimeMillis();176 engine.logger.trace("callSingle waiting for lock: {}", fileName);177 synchronized (CACHE) { // lock178 if ((minutes == 0) && CACHE.containsKey(fileName)) { // retry179 long endTime = System.currentTimeMillis() - startTime;180 engine.logger.warn("this thread waited {} milliseconds for callSingle lock: {}", endTime, fileName);181 return callSingleResult(engine, CACHE.get(fileName));182 }183 // this thread is the 'winner'184 engine.logger.info(">> lock acquired, begin callSingle: {}", fileName);185 Object result = null;186 File cacheFile = null;187 if (minutes > 0) {188 String cleanedName = StringUtils.toIdString(fileName);189 String cacheFileName = engine.getConfig().getCallSingleCacheDir() + File.separator + cleanedName + ".txt";190 cacheFile = new File(cacheFileName);191 long since = System.currentTimeMillis() - minutes * 60 * 1000;192 if (cacheFile.exists()) {193 long lastModified = cacheFile.lastModified();194 if (lastModified > since) {195 String json = FileUtils.toString(cacheFile);196 result = JsonUtils.fromJson(json);197 engine.logger.info("callSingleCache hit: {}", cacheFile);198 } else {199 engine.logger.info("callSingleCache stale, last modified {} - is before {} (minutes: {})",200 lastModified, since, minutes);201 }202 } else {203 engine.logger.info("callSingleCache file does not exist, will create: {}", cacheFile);204 }205 }206 if (result == null) {207 Variable called = new Variable(read(fileName));208 Variable argVar;209 if (arg == null || arg.isNull()) {210 argVar = null;211 } else {212 argVar = new Variable(arg);213 }214 Variable resultVar;215 try {216 resultVar = engine.call(called, argVar, false);217 } catch (Exception e) {218 // don't retain any vestiges of graal-js 219 RuntimeException re = new RuntimeException(e.getMessage());220 // we do this so that an exception is also "cached"221 resultVar = new Variable(re); // will be thrown at end222 engine.logger.warn("callSingle() will cache an exception");223 }224 if (minutes > 0) { // cacheFile will be not null225 if (resultVar.isMapOrList()) {226 String json = resultVar.getAsString();227 FileUtils.writeToFile(cacheFile, json);228 engine.logger.info("callSingleCache write: {}", cacheFile);229 } else {230 engine.logger.warn("callSingleCache write failed, not json-like: {}", resultVar);231 }232 }233 // functions have to be detached so that they can be re-hydrated in another js context234 result = engine.recurseAndDetachAndShallowClone(resultVar.getValue());235 }236 CACHE.put(fileName, result);237 engine.logger.info("<< lock released, cached callSingle: {}", fileName);238 return callSingleResult(engine, result);239 }240 }241 public Object callonce(String path) {242 return callonce(false, path);243 }244 public Object callonce(boolean sharedScope, String path) {245 String exp = "read('" + path + "')";246 Variable v = getEngine().call(true, exp, sharedScope);247 return JsValue.fromJava(v.getValue());248 }249 @Override250 public void capturePerfEvent(String name, long startTime, long endTime) {251 PerfEvent event = new PerfEvent(startTime, endTime, name, 200);252 getEngine().capturePerfEvent(event);253 }254 public void configure(String key, Value value) {255 getEngine().configure(key, new Variable(value));256 }257 public Object distinct(Value o) {258 if (!o.hasArrayElements()) {259 return JsList.EMPTY;260 }261 long count = o.getArraySize();262 Set<Object> set = new LinkedHashSet();263 for (int i = 0; i < count; i++) {264 Object value = JsValue.toJava(o.getArrayElement(i));265 set.add(value);266 }267 return JsValue.fromJava(new ArrayList(set));268 }269 public String doc(Value v) {270 Map<String, Object> arg;271 if (v.isString()) {272 arg = Collections.singletonMap("read", v.asString());273 } else if (v.hasMembers()) {274 arg = new JsValue(v).getAsMap();275 } else {276 getEngine().logger.warn("doc - unexpected argument: {}", v);277 return null;278 }279 return getEngine().docInternal(arg);280 }281 public void embed(Object o, String contentType) {282 ResourceType resourceType;283 if (contentType == null) {284 resourceType = ResourceType.fromObject(o, ResourceType.BINARY);285 } else {286 resourceType = ResourceType.fromContentType(contentType);287 }288 getEngine().runtime.embed(JsValue.toBytes(o), resourceType);289 }290 public Object eval(String exp) {291 Variable result = getEngine().evalJs(exp);292 return JsValue.fromJava(result.getValue());293 }294 public String exec(Value value) {295 if (value.isString()) {296 return execInternal(Collections.singletonMap("line", value.asString()));297 } else if (value.hasArrayElements()) {298 List args = new JsValue(value).getAsList();299 return execInternal(Collections.singletonMap("args", args));300 } else {301 return execInternal(new JsValue(value).getAsMap());302 }303 }304 private String execInternal(Map<String, Object> options) {305 Command command = getEngine().fork(false, options);306 command.waitSync();307 return command.getAppender().collect();308 }309 public String extract(String text, String regex, int group) {310 Pattern pattern = Pattern.compile(regex);311 Matcher matcher = pattern.matcher(text);312 if (!matcher.find()) {313 getEngine().logger.warn("failed to find pattern: {}", regex);314 return null;315 }316 return matcher.group(group);317 }318 public List<String> extractAll(String text, String regex, int group) {319 Pattern pattern = Pattern.compile(regex);320 Matcher matcher = pattern.matcher(text);321 List<String> list = new ArrayList();322 while (matcher.find()) {323 list.add(matcher.group(group));324 }325 return list;326 }327 public void fail(String reason) {328 getEngine().setFailedReason(new KarateException(reason));329 }330 public Object filter(Value o, Value f) {331 if (!o.hasArrayElements()) {332 return JsList.EMPTY;333 }334 assertIfJsFunction(f);335 long count = o.getArraySize();336 List list = new ArrayList();337 for (int i = 0; i < count; i++) {338 Value v = o.getArrayElement(i);339 Value res = JsEngine.execute(f, v, i);340 if (res.isBoolean() && res.asBoolean()) {341 list.add(new JsValue(v).getValue());342 }343 }344 return new JsList(list);345 }346 public Object filterKeys(Value o, Value... args) {347 if (!o.hasMembers() || args.length == 0) {348 return JsMap.EMPTY;349 }350 List<String> keys = new ArrayList();351 if (args.length == 1) {352 if (args[0].isString()) {353 keys.add(args[0].asString());354 } else if (args[0].hasArrayElements()) {355 long count = args[0].getArraySize();356 for (int i = 0; i < count; i++) {357 keys.add(args[0].getArrayElement(i).toString());358 }359 } else if (args[0].hasMembers()) {360 for (String s : args[0].getMemberKeys()) {361 keys.add(s);362 }363 }364 } else {365 for (Value v : args) {366 keys.add(v.toString());367 }368 }369 Map map = new LinkedHashMap(keys.size());370 for (String key : keys) {371 if (key == null) {372 continue;373 }374 Value v = o.getMember(key);375 if (v != null) {376 map.put(key, v.as(Object.class));377 }378 }379 return new JsMap(map);380 }381 public void forEach(Value o, Value f) {382 assertIfJsFunction(f);383 if (o.hasArrayElements()) {384 long count = o.getArraySize();385 for (int i = 0; i < count; i++) {386 Value v = o.getArrayElement(i);387 f.executeVoid(v, i);388 }389 } else if (o.hasMembers()) { //map390 int i = 0;391 for (String k : o.getMemberKeys()) {392 Value v = o.getMember(k);393 f.executeVoid(k, v, i++);394 }395 } else {396 throw new RuntimeException("not an array or object: " + o);397 }398 }399 public Command fork(Value value) {400 if (value.isString()) {401 return getEngine().fork(true, value.asString());402 } else if (value.hasArrayElements()) {403 List args = new JsValue(value).getAsList();404 return getEngine().fork(true, args);405 } else {406 return getEngine().fork(true, new JsValue(value).getAsMap());407 }408 }409 // TODO breaking returns actual object not wrapper410 // and fromObject() has been removed411 // use new typeOf() method to find type412 public Object fromString(String exp) {413 ScenarioEngine engine = getEngine();414 try {415 Variable result = engine.evalKarateExpression(exp);416 return JsValue.fromJava(result.getValue());417 } catch (Exception e) {418 engine.setFailedReason(null); // special case419 engine.logger.warn("auto evaluation failed: {}", e.getMessage());420 return exp;421 }422 }423 public Object get(String exp) {424 ScenarioEngine engine = getEngine();425 Variable v;426 try {427 v = engine.evalKarateExpression(exp); // even json path expressions will work428 } catch (Exception e) {429 engine.logger.trace("karate.get failed for expression: '{}': {}", exp, e.getMessage());430 engine.setFailedReason(null); // special case !431 return null;432 }433 if (v != null) {434 return JsValue.fromJava(v.getValue());435 } else {436 return null;437 }438 }439 public Object get(String exp, Object defaultValue) {440 Object result = get(exp);441 return result == null ? defaultValue : result;442 }443 // getters =================================================================444 // TODO migrate these to functions not properties445 //446 public ScenarioEngine getEngine() {447 ScenarioEngine engine = ScenarioEngine.get();448 return engine == null ? ENGINE : engine;449 }450 public String getEnv() {451 return getEngine().runtime.featureRuntime.suite.env;452 }453 public Object getFeature() {454 return new JsMap(getEngine().runtime.featureRuntime.result.toInfoJson());455 }456 public Object getInfo() { // TODO deprecate457 return new JsMap(getEngine().runtime.getScenarioInfo());458 }459 private LogFacade logFacade;460 public Object getLogger() {461 if (logFacade == null) {462 logFacade = new LogFacade();463 }464 return logFacade;465 }466 public Object getOs() {467 String name = FileUtils.getOsName();468 String type = FileUtils.getOsType(name).toString().toLowerCase();469 Map<String, Object> map = new HashMap(2);470 map.put("name", name);471 map.put("type", type);472 return new JsMap(map);473 }474 // TODO breaking uri has been renamed to url475 public Object getPrevRequest() {476 HttpRequest hr = getEngine().getRequest();477 if (hr == null) {478 return null;479 }480 Map<String, Object> map = new HashMap();481 map.put("method", hr.getMethod());482 map.put("url", hr.getUrl());483 map.put("headers", hr.getHeaders());484 map.put("body", hr.getBody());485 return JsValue.fromJava(map);486 }487 public Object getProperties() {488 return new JsMap(getEngine().runtime.featureRuntime.suite.systemProperties);489 }490 public Object getScenario() {491 return new JsMap(getEngine().runtime.result.toKarateJson());492 }493 public Object getTags() {494 return JsValue.fromJava(getEngine().runtime.tags.getTags());495 }496 public Object getTagValues() {497 return JsValue.fromJava(getEngine().runtime.tags.getTagValues());498 }499 //==========================================================================500 //501 public HttpRequestBuilder http(String url) {502 ScenarioEngine engine = getEngine();503 HttpClient client = engine.runtime.featureRuntime.suite.clientFactory.create(engine);504 return new HttpRequestBuilder(client).url(url);505 }506 public Object jsonPath(Object o, String exp) {507 Json json = Json.of(o);508 return JsValue.fromJava(json.get(exp));509 }510 public Object keysOf(Value o) {511 return new JsList(o.getMemberKeys());512 }513 public void log(Value... values) {514 ScenarioEngine engine = getEngine();515 if (engine.getConfig().isPrintEnabled()) {516 engine.logger.info("{}", new LogWrapper(values));517 }518 }519 public Object lowerCase(Object o) {520 Variable var = new Variable(o);521 return JsValue.fromJava(var.toLowerCase().getValue());522 }523 public Object map(Value o, Value f) {524 if (!o.hasArrayElements()) {525 return JsList.EMPTY;526 }527 assertIfJsFunction(f);528 long count = o.getArraySize();529 List list = new ArrayList();530 for (int i = 0; i < count; i++) {531 Value v = o.getArrayElement(i);532 Value res = JsEngine.execute(f, v, i);533 list.add(new JsValue(res).getValue());534 }535 return new JsList(list);536 }537 public Object mapWithKey(Value v, String key) {538 if (!v.hasArrayElements()) {539 return JsList.EMPTY;540 }541 long count = v.getArraySize();542 List list = new ArrayList();543 for (int i = 0; i < count; i++) {544 Map map = new LinkedHashMap();545 Value res = v.getArrayElement(i);546 map.put(key, res.as(Object.class));547 list.add(map);548 }549 return new JsList(list);550 }551 public Object match(Object actual, Object expected) {552 Match.Result mr = getEngine().match(Match.Type.EQUALS, actual, expected);553 return JsValue.fromJava(mr.toMap());554 }555 public Object match(String exp) {556 MatchStep ms = new MatchStep(exp);557 Match.Result mr = getEngine().match(ms.type, ms.name, ms.path, ms.expected);558 return JsValue.fromJava(mr.toMap());559 }560 public Object merge(Value... vals) {561 if (vals.length == 0) {562 return null;563 }564 if (vals.length == 1) {565 return vals[0];566 }567 Map map = new HashMap(vals[0].as(Map.class));568 for (int i = 1; i < vals.length; i++) {569 map.putAll(vals[i].as(Map.class));570 }571 return new JsMap(map);572 }573 public void pause(Value value) {574 ScenarioEngine engine = getEngine();...
merge
Using AI Code Generation
1def merge = { a, b ->2 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)3 bridge.merge(a, b)4}5def merge = { a, b ->6 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)7 bridge.merge(a, b)8}9def merge = { a, b ->10 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)11 bridge.merge(a, b)12}13def merge = { a, b ->14 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)15 bridge.merge(a, b)16}17def merge = { a, b ->18 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)19 bridge.merge(a, b)20}21def merge = { a, b ->22 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)23 bridge.merge(a, b)24}25def merge = { a, b ->26 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)27 bridge.merge(a, b)28}29def merge = { a, b ->30 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)31 bridge.merge(a, b)32}33def merge = { a, b ->34 def bridge = new com.intuit.karate.core.ScenarioBridge(null, null)35 bridge.merge(a, b)36}37def merge = { a, b ->
merge
Using AI Code Generation
1* def a = {a:1, b:2}2* def b = {c:3, d:4}3* def c = merge(a, b)4* match c == {a:1, b:2, c:3, d:4}5* def a = {a:1, b:2}6* def b = {c:3, d:4}7* def c = merge(a, b)8* match c == {a:1, b:2, c:3, d:4}9* def a = {a:1, b:2}10* def b = {c:3, d:4}11* def c = merge(a, b)12* match c == {a:1, b:2, c:3, d:4}13* def a = {a:1, b:2}14* def b = {c:3, d:4}15* def c = merge(a, b)16* match c == {a:1, b:2, c:3, d:4}17* def a = {a:1, b:2}18* def b = {c:3, d:4}19* def c = merge(a, b)20* match c == {a:1, b:2, c:3, d:4}21* def a = {a:1, b:2}22* def b = {c:
merge
Using AI Code Generation
1def json1 = read('classpath:json1.json')2def json2 = read('classpath:json2.json')3def json = merge(json1, json2)4{5 "address": {6 },7 {8 },9 {10 }11}12{13 "address": {14 },15 {16 },17 {18 }19}20{21 "address": {22 },23 {24 },25 {26 }27}28Given def json = read('classpath:json1.json')29And def xml = read('classpath:xml1.xml')30And def json2 = merge(json, xml)
merge
Using AI Code Generation
1def merge = karate.callOnce('classpath:com/intuit/karate/core/ScenarioBridge.java').merge2def scenario = merge({3 And match response == { name: '#string', id: '#number' }4}, {5 And match response == { name: '#string', id: '#number', address: '#string' }6})7Then scenario == { name: '#string', id: '#number', address: '#string' }8def merge = karate.callOnce('classpath:com/intuit/karate/core/ScenarioBridge.java').merge9def scenario = merge({10 And match response == { name: '#string', id: '#number' }11}, {12 And match response == { name: '#string', id: '#number', address: '#string' }13})14Then scenario == { name: '#string', id: '#number', address: '#string' }
merge
Using AI Code Generation
1* def response = call read('classpath:sample.feature')2* def request = call read('classpath:sample2.feature')3* def merged = merge(request,response)4* def request = call read('classpath:sample.feature')5* def response = call read('classpath:sample2.feature')6* def merged = merge(response,request)7* def request = call read('classpath:sample.feature')8* def response = call read('classpath:sample2.feature')9* def merged = merge(response,request)10* def request = call read('classpath:sample.feature')11* def response = call read('classpath:sample2.feature')12* def merged = merge(response,request)13* def request = call read('classpath:sample.feature')14* def response = call read('classpath:sample2.feature')15* def merged = merge(response,request)16* def request = call read('classpath:sample.feature')17* def response = call read('classpath:sample2.feature')18* def merged = merge(response,request)19* def request = call read('classpath:sample.feature')20* def response = call read('classpath:sample2.feature')21* def merged = merge(response,request)22* def request = call read('classpath:sample.feature')23* def response = call read('classpath:sample2.feature')24* def merged = merge(response,request)25* def request = call read('classpath:sample.feature')26* def response = call read('
merge
Using AI Code Generation
1* def json1 = { "name": "John", "age": 30, "city": "New York" }2* def json2 = { "name": "Peter", "age": 29, "country": "USA" }3* def mergedJson = karate.merge(json1, json2)4* def json1 = { "name": "John", "age": 30, "city": "New York" }5* def json2 = { "name": "Peter", "age": 29, "country": "USA" }6* def mergedJson = karate.merge(json1, json2)7* def json1 = { "name": "John", "age": 30, "city": "New York" }8* def json2 = { "name": "Peter", "age": 29, "country": "USA" }9* def mergedJson = karate.merge(json1, json2)
merge
Using AI Code Generation
1* def json1 = read('classpath:json1.json')2* def json2 = read('classpath:json2.json')3* def json3 = merge(json1, json2)4* def json4 = json(json3)5{6 { "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },7 { "name":"BMW", "models":[ "320", "X3", "X5" ] },8 { "name":"Fiat", "models":[ "500", "Panda" ] }9}10{11 { "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },12 { "name":"BMW", "models":[ "320", "X3", "X5" ] },13 { "name":"Fiat", "models":[ "500", "Panda" ] }14}15{16 "cars" : [ {17 }, {18 }, {19 } ]20}21{22 "cars" : [ {23 }, {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!