title,body,link,tags,view_count,is_answered,score,answer_count
Browser compatibility testing in automated unit tests for new angular framework codes,"<p>Is it possible to test the browser compatibility using automated JavaScript unit tests?</p>

<p>I have to test my angular 6 code for some dom test cases in different browser scenarios. This unit tests should run in CI build.</p>
",https://stackoverflow.com/questions/55475970/browser-compatibility-testing-in-automated-unit-tests-for-new-angular-framework,"['angular', 'unit-testing', 'jasmine', 'karma-runner', 'chutzpah']",347,False,0,1
Karate - Ability to dynamically decide the type of match in karate for verification,"<p>Lets say we scripted the scenarios following way for our evolving servers</p>

<pre><code>Actual server v1 response 
response = { id: ""1"", name: ""karate"" }
Mocking client v1 schema 
schema = { id: ""#string"", name: ""#string }
* match response == schema

Actual server v2 response
response = { id: ""2"", name: ""karate"", value: ""is"" }
Mocking client v2 schema
schema = { id: ""#string"", name: ""#string, value: ""#string"" }
* match response == schema

Actual server v3 response
response = { id: ""3"", name: ""karate"", value: ""is"", description: ""easy"" }
Mocking client v3 schema
schema = { id: ""#string"", name: ""#string"", value: ""#string"", description: ""#string"" }
* match response == schema
</code></pre>

<p>Similarly for backward compatibility testing of our evolving servers, we script the scenarios following way</p>

<pre><code>Actual server v3 response
response = { id: ""3"", name: ""karate"", value: ""is"", description: ""easy"" }
Mocking client v1 schema 
schema = { id: ""#string"", name: ""#string }
* match response contains schema

Actual server v2 response
response = { id: ""2"", name: ""karate"", value: ""is"" }
Mocking client v1 schema 
schema = { id: ""#string"", name: ""#string }
* match response contains schema

Actual server v1 response 
response = { id: ""1"", name: ""karate"" }
Mocking client v1 schema 
schema = { id: ""#string"", name: ""#string }
* match response contains schema
</code></pre>

<p>Proposal is to be able to use some kind of flag in match statement that dynamically decides the kind of match we do during testing.
Lets say that the name of flag is SOMEFLAG and we provide the kind of match we want to do during testing (set in karate-config.js for global effect)</p>

<pre><code>var SOMEFLAG = ""contains""; 
OR
var SOMEFLAG = ""=="";
</code></pre>

<p>Now in scenario we do following</p>

<pre><code># Depending on what is set in karate-config.js, it will use either contains or == for verification.
* match response SOMEFLAG schema
</code></pre>

<p>Is it possible to do this in karate ? </p>

<p>Also note that success of this idea really depends on <a href=""https://github.com/intuit/karate/issues/826"" rel=""nofollow noreferrer"">https://github.com/intuit/karate/issues/826</a> due to ability match nested object using contains match.</p>
",https://stackoverflow.com/questions/57187219/karate-ability-to-dynamically-decide-the-type-of-match-in-karate-for-verificat,"['dsl', 'karate']",362,True,1,1
Cannot use &quot;==&quot; and &quot;contains&quot; in same line of scenario using conditional logic in Karate,"<p>This is a follow up of a <a href=""https://stackoverflow.com/questions/57187219/karate-ability-to-dynamically-decide-the-type-of-match-in-karate-for-verificat"">question noted here</a></p>

<p>Lets says our implemented server v1 and v2 response looks as follows</p>

<pre><code>v1Response = { id: ""1"", name: ""awesome"" }
v2Response = { id: ""2"", name: ""awesome"", value: ""karate"" }
</code></pre>

<p>Similarly we define the client schema for v1 and v2 like as follows</p>

<pre><code>v1Schema = { id: ""#string"", name: ""#string }
v2Schema = { id: ""#string"", name: ""#string, value: ""#string"" }
</code></pre>

<p>We implement schema validation in our generic scenario as follows. We can easily set the ""response"" with either v1Response/v2Response AND ""schema"" with either v1Schema/v2Schema depending on our the environment.</p>

<pre><code>* match response == schema
</code></pre>

<p>Above generic script works perfectly fine as long as we are testing v1 server against v1 client / v2 server against v2 client. However we cannot re-use the same scenario when we want to test backward compatibility for example
v2 server against v1 client. In this case</p>

<pre><code>* match response (actually v2Response) == schema (actually v1Schema) &lt;--- will fail
</code></pre>

<p>So in order to make it work and do backward compatibility testing, I also wanted to use karate ""contains"" feature like</p>

<pre><code>* match response (actually v2Response) contains schema (actually v1Schema) &lt;--- will pass
</code></pre>

<p>However in the quest to keep my scenarios generic it is currently not possible to do either </p>

<ol>
<li>Use both ==/contains in the same line of script like as follows

<ul>
<li>serverVersion == clientVersion ? (match response == schema) : (match response contains schema)</li>
</ul></li>
</ol>

<p>OR </p>

<ol start=""2"">
<li><p>Using some flag as follows</p>

<ul>
<li>match response SOMEFLAG schema </li>
</ul></li>
</ol>

<p>whereas SOMEFLAG can be set to either ""=="" or ""contains"" in karate-config.js depending on environment we are testing.</p>

<p>EDIT</p>

<p>From the above example, all I want is to test following cases that should pass</p>

<pre><code>* match v1Response == v1Schema
* match v2Response == v2Schema 
* match v2Response contains v1Schema
</code></pre>

<p>using a generic line as following</p>

<pre><code>* match response == schema &lt;--- can it possibly be solved using above suggested solutions ?
</code></pre>
",https://stackoverflow.com/questions/57205643/cannot-use-and-contains-in-same-line-of-scenario-using-conditional-logic,"['dsl', 'karate']",296,True,2,1
