Testcase Query Examples: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (Reverted edits by Rizwan1218 (Talk) to last revision by Skierpage)
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Other ways to query for test cases than the query(s) on [[Test cases 8.2.0]]
Other ways to query for test cases than the query(s) on [[Test cases 8.2.0]]

Copy these to make your own.

== Basics ==

The basic query is
<nowiki>{{#ask: [[Category:Test cases]] [[Build stream::joyride|Any]] </nowiki> | ''additional options'' }}
One option you should always add is <tt>|default=Query for xyz found nothing?!</tt>, otherwise you'll have no indication a page has a query that isn't working.


See [http://semantic-mediawiki.org/wiki/Help:Inline_queries#Output_formats Inline query output formats].
See [http://semantic-mediawiki.org/wiki/Help:Inline_queries#Output_formats Inline query output formats].




=== Query counting each test case ===
=== Query counting each test case ===
Line 7: Line 17:
There are
There are
{{#ask:
{{#ask:
[[Category:Test cases]] [[Stream::joyride]]
[[Category:Test cases]]
| format=count
| format=count
| default=No articles found in [[:Category:Test cases]] with [[Property:Stream]] of [[Joyride]]?
| default=No articles found in [[:Category:Test cases]]?}} total test cases in [[:Category:Test cases]].

}} ''<== automatically generated!'' test cases in [[:Category:Test cases]] with [[Property:Stream]] of Joyride.
There are
{{#ask:
[[Category:Test cases]] [[Build stream::joyride]]
| format=count
| default=No articles found in [[:Category:Test cases]] with [[Property:Build stream]] of [[Joyride]]?
}} test cases in [[:Category:Test cases]] with [[Property:Build stream]] of Joyride.

There are
{{#ask:
[[Category:Test cases]] [[Build stream::8.2]]
| format=count
| default=No articles found in [[:Category:Test cases]] with [[Property:Build stream]] of [[Joyride]]?
}} test cases in [[:Category:Test cases]] with [[Property:Build stream]] of 8.2.

There are
{{#ask:
[[Category:Test cases]] [[Test category::Activity]]
| format=count
| default=No articles found in [[:Category:Test cases]]?}} test cases in [[:Category:Test cases]] with category ''Activity''.

=== Querying for test results (problematic!) ===
This is tricky, because multipled test results are lumped into one test case page.
See [[Semantic MediaWiki#Issues for test results]].

Show any test case for 8.2.1 with a bug number or a fail ''but the failure may not be in 8.2.1 testing''.
{{#ask:
[[Category:Test cases]] [[Build stream::8.2.1]] <q>[[PassFail::Fail]] OR [[Trac bug number::+]]</q>
|?Short name
|?Build stream
|?PassFail
|?Trac bug number
|?Comments
}}


=== Query displaying each test case ===
=== Query displaying each test case ===


If the pages you are including are small, you can embed them with <tt>format=embedded</tt>. This is like transcluding each page with <nowiki>{{:Title of page}} {{:Another page}} ...</nowiki>, but dynamic.
If the pages you are including are small, you can embed them with <tt>format=embedded</tt>. This is like transcluding each page with <nowiki>{{:Title of page}} {{:Another page}} ...</nowiki>, but dynamic. ''This can confuse editors, and it puts the page that uses it into any categories in the embedded pages!''

The example below is limited to three results


{{#ask:
{{#ask:
[[Category:Test cases]] [[Stream::joyride]]
[[Category:Test cases]] [[Build stream::joyride]]
| format=embedded
| format=embedded
| embedformat=h4
| embedformat=h4
| limit=3
| default=No articles found in [[:Category:Test cases]] with [[Property:Stream]] of [[Joyride]]?
| default=No articles found in [[:Category:Test cases]] with [[Property:Build stream]] of [[Joyride]]?
}}
}}


=== Bug: query for a disallowed value sometimes still works ===
=== Bug: query for a disallowed value sometimes still works ===


''Bug: if I query for a bogus value, it counts all of them.'' A query for Stream==BADVALUE returns a count of
''Bug: if I query for a bogus value, it counts all of them.'' A query for Build stream==BADVALUE returns a count of
{{#ask:
{{#ask:
[[Category:Test cases]] [[Stream::BOGUS VALUE]]
[[Category:Test cases]] [[Build stream::BOGUS VALUE]]
| format=count
| format=count
| default=No articles found in [[:Category:Test cases]] with [[Property:Stream]] of [[BOGUS VALUE]]?
| default=No articles found in [[:Category:Test cases]] with [[Property:Build stream]] of [[BOGUS VALUE]]?
}}
}}



Latest revision as of 20:32, 25 July 2013

Other ways to query for test cases than the query(s) on Test cases 8.2.0

Copy these to make your own.

Basics

The basic query is

 {{#ask: [[Category:Test cases]] [[Build stream::joyride|Any]]  | additional options }}

One option you should always add is |default=Query for xyz found nothing?!, otherwise you'll have no indication a page has a query that isn't working.

See Inline query output formats.


Query counting each test case

There are {{#ask:

 | format=count
 | default=No articles found in Category:Test cases?}} total test cases in Category:Test cases.

There are {{#ask: Build stream::joyride

 | format=count
 | default=No articles found in Category:Test cases with Property:Build stream of Joyride?

}} test cases in Category:Test cases with Property:Build stream of Joyride.

There are {{#ask: Build stream::8.2

 | format=count
 | default=No articles found in Category:Test cases with Property:Build stream of Joyride?

}} test cases in Category:Test cases with Property:Build stream of 8.2.

There are {{#ask: Test category::Activity

 | format=count
 | default=No articles found in Category:Test cases?}} test cases in Category:Test cases with category Activity.

Querying for test results (problematic!)

This is tricky, because multipled test results are lumped into one test case page. See Semantic MediaWiki#Issues for test results.

Show any test case for 8.2.1 with a bug number or a fail but the failure may not be in 8.2.1 testing. {{#ask: Build stream::8.2.1 PassFail::Fail OR Trac bug number::+

 |?Short name
 |?Build stream
 |?PassFail
 |?Trac bug number
 |?Comments

}}

Query displaying each test case

If the pages you are including are small, you can embed them with format=embedded. This is like transcluding each page with {{:Title of page}} {{:Another page}} ..., but dynamic. This can confuse editors, and it puts the page that uses it into any categories in the embedded pages!

The example below is limited to three results

{{#ask: Build stream::joyride

 | format=embedded 
 | embedformat=h4
 | limit=3
 | default=No articles found in Category:Test cases with Property:Build stream of Joyride?

}}

Bug: query for a disallowed value sometimes still works

Bug: if I query for a bogus value, it counts all of them. A query for Build stream==BADVALUE returns a count of {{#ask: Build stream::BOGUS VALUE

 | format=count
 | default=No articles found in Category:Test cases with Property:Build stream of BOGUS VALUE?

}}