Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I too don't see a way to query for Defects on TestCases. There is a WorkProduct field, but that is intended to point to the Story (or Defect) that resulted in the TestCase being created rather than what you want. You want to inspect the TestCases field on Defects. Unfortunately, the TestCases field on Defects is not usable in a query expression in our standard WSAPI. However, you can include it in a query in our Lookback API.</p> <p>This query will return all Defects that mention one or more TestCases:</p> <pre><code>{ "find":{ "_TypeHierarchy":"Defect", "TestCases":{"$exists":true}, "__At":"current" }, "fields":["ObjectID","TestCases"] } </code></pre> <p>That will give you results like this:</p> <pre><code>[ { "ObjectID": 1412057460, "TestCases": [ 1431813466 ] }, { "ObjectID": 1445019668, "TestCases": [ 1445020483 ] }, { "ObjectID": 2021743865, "TestCases": [ 2844922903, 2844882838 ] }, { "ObjectID": 2047435117, "TestCases": [ 2082930376 ] }, { "ObjectID": 2458916959, "TestCases": [ 2082930376 ] } ] </code></pre> <p>But that is still not what you want. You still need to find the max and the list of TestCases that have that max. <a href="http://coffeescript.org/#try%3aresults%20=%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%201412057460,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%201431813466%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%201445019668,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%201445020483%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202021743865,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202844922903,%0A%20%20%20%20%20%20%20%20%20%20%20%202844882838%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202047435117,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202082930376%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202458916959,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202082930376%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%5D%0A%0Acounts%20=%20%7B%7D%0Afor%20r%20in%20results%0A%20%20for%20t%20in%20r.TestCases%0A%20%20%20%20unless%20counts%5Bt%5D?%0A%20%20%20%20%20%20counts%5Bt%5D%20=%200%0A%20%20%20%20counts%5Bt%5D%2b%2b%0A%09%0Amax%20=%20Math.max.apply%28%7B%7D,%20%28value%20for%20key,%20value%20of%20counts%29%29%0AtestCasesWithMaxDefects%20=%20%28key%20for%20key,%20value%20of%20counts%20when%20value%20is%20max%29%0A%0Aalert%28%22Test%20Case%28s%29%20with%20the%20maximum%20number%20of%20defects%20%28#%7Bmax%7D%29%20is%28are%29%20#%7BtestCasesWithMaxDefects%7D%22%29" rel="nofollow">This code</a> does that. The key lines from that code are:</p> <pre><code>counts = {} for r in results for t in r.TestCases unless counts[t]? counts[t] = 0 counts[t]++ max = Math.max.apply({}, (value for key, value of counts)) testCasesWithMaxDefects = (key for key, value of counts when value is max) alert("Test Case(s) with the maximum number of defects (#{max}) is(are) #{testCasesWithMaxDefects}") </code></pre> <p>Follow the <a href="http://coffeescript.org/#try%3aresults%20=%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%201412057460,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%201431813466%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%201445019668,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%201445020483%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202021743865,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202844922903,%0A%20%20%20%20%20%20%20%20%20%20%20%202844882838%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202047435117,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202082930376%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D,%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22ObjectID%22%3a%202458916959,%0A%20%20%20%20%20%20%20%20%22TestCases%22%3a%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%202082930376%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%5D%0A%0Acounts%20=%20%7B%7D%0Afor%20r%20in%20results%0A%20%20for%20t%20in%20r.TestCases%0A%20%20%20%20unless%20counts%5Bt%5D?%0A%20%20%20%20%20%20counts%5Bt%5D%20=%200%0A%20%20%20%20counts%5Bt%5D%2b%2b%0A%09%0Amax%20=%20Math.max.apply%28%7B%7D,%20%28value%20for%20key,%20value%20of%20counts%29%29%0AtestCasesWithMaxDefects%20=%20%28key%20for%20key,%20value%20of%20counts%20when%20value%20is%20max%29%0A%0Aalert%28%22Test%20Case%28s%29%20with%20the%20maximum%20number%20of%20defects%20%28#%7Bmax%7D%29%20is%28are%29%20#%7BtestCasesWithMaxDefects%7D%22%29" rel="nofollow">link</a> to see the JavaScript equivalent.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload