Jump to content

Template:Talk header/testcases3

From Wikipedia, the free encyclopedia

Find sources

[edit]
[edit]

By default, the pagename is used as the argument to {{find sources}}. This can be altered with the use of |search_term=.

Find sources – control: no params (except demospace=1) shows find sources using the pagetitle
{{Talk header|demospace=1}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – with search_term (5-word)
{{Talk header|demospace=1 |search_term=United States embargo against Cuba}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – with search_term (6-word)
{{Talk header|demospace=1 |search_term=Clandestine press of the French Resistance}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – with search_term (9-word)
{{Talk header|demospace=1 |search_term=Collaboration with the Axis Powers during World War II}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}

B. Search_term, and search_term 1 thru 4

[edit]
Find sources – control: no params (except demospace=1) shows find sources using the pagetitle
{{Talk header|demospace=1}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – search_term shows find sources using the param value
{{Talk header|demospace=1 |search_term=French Revolution}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – search_term1 (expect:same as above)
{{Talk header|demospace=1 |search_term1=French Revolution}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1 & 2: shows find sources using the param values
{{Talk header|demospace=1 |search_term1=French Revolution |search_term2=Napoleon}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1, 2, & 3: shows find sources using the param values
{{Talk header|demospace=1 |search_term1=French Revolution |search_term2=1791 |search_term3=Louis XIV}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1, 2, 3, & 4: shows find sources using the param values
{{Talk header|demospace=1 |search_term1=French Revolution |search_term2=1791 |search_term3=Louis XIV |search_term4=Terror}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1 + domain: shows find sources using the param values
{{Talk header|demospace=1 |domain=medical |search_term1=Marie Curie}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1 and 2 + domain: shows find sources using the param values
{{Talk header|demospace=1 |domain=medical |search_term1=Marie Curie |search_term2=radium}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – terms 1, 2, 3 + domain: shows find sources using the param values
{{Talk header|demospace=1 |domain=medical |search_term1=Marie Curie |search_term2=radium |search_term3=Nobel}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}

C. Opt-out find sources

[edit]

The opt-out makes no sense, unless it's opted in before you opt it out. But opt-in is not the default in Template space, so we add param |demospace=1 to simulate the correct namespace so it would be included, then use the opt-out params to hide it again.

Find sources – control 1: no params (except demospace=1) shows find sources
{{Talk header|demospace=1}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – control 2: 'hide_find_sources=no' is the default
{{Talk header|demospace=1 |hide_find_sources=no}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Opt-out hide_find_sources=yes hides the display
{{Talk header||demospace=1 |hide_find_sources=yes}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}

Redo same trio, using alias |demospace=main:

Find sources – control 1: no params (except demospace=main) shows find sources
{{Talk header|demospace=main}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Find sources – control 2: 'hide_find_sources=no' is the default
{{Talk header|demospace=main |hide_find_sources=no}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
Opt-out hide_find_sources=yes hides the display
{{Talk header||demospace=main |hide_find_sources=yes}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}

D. Param 'search-domain'

[edit]

Article on medical topics get a different set of links generated by {{find medical sources}} rather than the regular template.

9c-1a. Param 'search-domain': find medical sources – control 1: no params (except demospace=main) shows find sources
{{Talk header|demospace=main |search-domain=medical}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-1b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=medical}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-2a. Param 'search-domain': find medical sources – control 2: 'hide_find_sources=no' is the default
{{Talk header|demospace=main |hide_find_sources=no |search-domain=medical}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-2b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=medical |hide_find_sources=no}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-3a. Param 'search-domain': medical+opt-out hide_find_sources=yes hides the display
{{Talk header|demospace=main |hide_find_sources=yes |search-domain=medical}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-3b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=medical |hide_find_sources=yes}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-4a. Param 'search-domain': find video sources – control 1: no params (except demospace=main) shows find sources
{{Talk header|demospace=main |search-domain=video game}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-4b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=video game}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}


9c-5b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=video game |hide_find_sources=no}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-6a. Param 'search-domain': video+opt-out hide_find_sources=yes hides the display
{{Talk header|demospace=main |hide_find_sources=yes |search-domain=video game}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}
9c-6b. Param 'domain': (same as above)
{{Talk header|demospace=main |domain=video game |hide_find_sources=yes}}
Side by side comparison
{{Talk header}}{{Talk header/sandbox}}

E. WikiProject detection

[edit]
Expand to view description of how to run these tests

These are external tests that rely on using {{Talk header/sandbox}} transcluding the "Find sources" wrapper template ({{Find sources/sandbox}} to choose the right domain-specific "find sources" template from among medical, video game, or general sources (and possibly others). Because these tests depend on using the WikiProjects listed in the Talk header template at the top of an article page, they cannot be tested in the normal way.

Methodology: ExpandTemplates or in situ

The test cases can be performed either at Special:ExpandTemplates, or in situ at the Talk pages of actual articles which have the appropriate WikiProject listings already present, in Preview Mode. The easier method is probably to use ExpandTemplates.

Testing with ExpandTemplates

  1. go to Special:ExpandTemplates
  2. fill in the Context Title using one of the suggested Talk pages listed at the test cases below (E-1, E-2, ...)
  3. Paste invocations of the live and sandbox templates, with appropriate params (same params for each)
    Note: |noarchive=yes must be included to prevent a runaway script from searching for endless, non-existent archives)
  4. Click [OK] and observe the results.

Example: to perform test E-1, choose an article from the E-1 list, like Illyriad, and do this:

  1. paste Talk:Illyriad into 'Context Title' (Note: this article belongs only to WP:WikiProject Video games.)
  2. paste the following text into the input wikitext box:
{{talk header|noarchive=yes}}
----
{{talk header/sandbox|noarchive=yes}}
3. Expected result: because this article is a member of WP:WikiProject Video games and not a member of project Medicine, the links displayed match those of {{find video game sources}}.

Testing in situ

The other method is an in situ test. All of the 'tests in this section may be performed in situ in the following way:

  1. edit the Talk page of an article belonging to one or more WikiProjects detected by the template
  2. find the transclusion of template {{talk header}} (normally at the top of the Talk page; or add one)
  3. change it to {{talk header/sandbox}} (+ optional params; see individual test cases below)
  4. click "Preview" button and observe the "find sources" links that are generated in the Talk header
  5. if the observed links match the "expected result" given in the test case, it's a "pass", otherwise, "fail".

Any article Talk page with the correct header and projects may be used for this; the lists in the Test cases defined below contains some suggested Talk pages with the correct WikiProjects on them to perform the test case. After viewing the test case result in Preview mode on the page, it's best to cancel out and not save the altered page.

E-1 Articles including project Video games
E-1 Articles including project Video games
This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

Use {{Find sources/sandbox}}
Expected result: these should display links matching {{find video games sources}}:

E-2 Articles including project Medicine
E-2 Articles including project Medicine
This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

Use {{Find sources/sandbox}}
Expected result: these should display links matching {{find medical sources}}

Note: the articles above only test the autodection feature for articles which transclude the wikiproject under its original name 'WikiProject Medicine' and without using a redirect. Complete testing of this feature requires testing some Talk pages of articles that incorporate a redirect to project Medicine. See test E-2a below for a selection of these.

For an additional list of sample articles employing redirects to project Medicine to use for testing, please see test B-2 here.

E-2a Articles using redirects to WikiProject Medicine
E-2a Articles using redirects to WikiProject Medicine

There are 15 redirects to WikiProject Medicine. Not all of them are in use on article Talk pages. A couple that are, include {{WPMED}} (hundreds of transclusions),

Articles using redirect Template:WPMED – more than 500 pages use {{WPMED}};

Some examples for testing: (expected result: medical sources links are displayed in the TPH.

Sample article TPs for pages using other redirects to project Medicine:

E-3 Articles including project Biography
E-3 Articles including project Biography
This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

Use {{Find sources/sandbox}}
Expected result: these should display links matching {{find biographical sources}}

E-4 Project priority: articles that include multiple projects
E-4 Project priority
articles that include multiple projects
This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

These tests verify that the correct set of find sources links are displayed, for articles belonging to more than one project.

Use {{Find sources/sandbox}}
Expected result: these should display links matching the {{find * sources}} template corresponding to the search domain of the highest priority project on the page.

As of 1 Nov 2021, the priority sequence is: 1. medical, 2. video games, 3. general (legacy links). (Other domains like biographical and military are on the list for possible expansion of the template.) Further examples can be found using Petscan.

E-4a – medical & biographical

E-4a – medical & biographical:

This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

Expected result: Medical links (results match {{find medical sources}})

E-4b – video & biographical

E-4b – video & biographical:

This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

Expected result: Video links (results match {{find video game sources}})

E-5 Other articles not belonging to any of the automatically detected WikiProjects
E-5 Other articles not belonging to any of the automatically detected WikiProjects
This test may be performed using ExpandTemplates or in situ testing. (see Methodology)

These should default to the standard {{find sources}} list:

(chosen from Special:Random)

F. WikiProject override

[edit]
Expand to view description of how to run these tests

Please read the instructions in section #E. WikiProject detection first, to understand how they are set up, including how to execute a test case either by using Special:ExpandTemplates, or by using an in situ test.

As in that section, because the tests below depend on overriding the WikiProjects listed in the Talk header template at the top of an article page, they cannot be fully tested in the normal way. These tests may be performed in two ways: in situ, or via Special:ExpandTemplates. Where tests in this section differ from the test cases in the previous section, is that in these tests, we include a |domain= param to override the WikiProject(s) detected by the template.

Here is an example of testing with ExpandTemplates, to override a video game Talk page with medical source links in the Talk header:

  1. go to Special:ExpandTemplates
  2. paste Talk:Illyriad into 'Context Title'. (Note: this article belongs to WP:WikiProject Video games)
  3. paste the following text into the input wikitext box:
{{tlc|talk header|noarchives=yes|domain=medical}}
----
{{tlc|talk header/sandbox|noarchives=yes|domain=medical}}

3. Expected result: although this is not a member of project Medicine, the links displayed match {{find medical sources}}.

The other way to execute a test case, is in situ: add a Talk header with a |domain= param to the Talk pages of actual articles which have the appropriate Talk page headers and WikiProject listings (without saving):

  • edit the Talk page header of an article belonging to, say, WikiProject medicine
  • find the transclusion of {{talk header}} (normally at the top of the page)
  • change it to (or add:) {{talk header/sandbox}}, hit Preview, and take note of the "find sources" links that are generated
  • execute a set of domain override tests on this page:
    • change the header to {{talk header/sandbox|domain=medical}} (or med) and Preview
      observe that the find sources links in the Talk header change to those of {{find medical sources}}
    • change the header to {{talk header/sandbox|domain=video}} (vg or video game) and Preview
      observe that the find sources links in the Talk header change to those of {{find video game sources}}
    • change the header to {{talk header/sandbox|domain=general}} or (gen and Preview
      observe that the find sources links in the Talk header change to those of the default set: {{find general sources}}

Any article Talk page may be used for these tests; for suggested articles, see the list in test section #E. WikiProject detection above, which contains some suggested Talk pages with the correct WikiProjects on it to autodetect a project, and to override it using the |domain= param, and observe the results. After viewing the test case result in Preview mode on the page, it's best to just cancel out and not save the Previewed page.

G. Namespace detection

[edit]

Find sources links should only be emitted in the Talk header, when the template is placed on article talk pages (ns:1) or Draft talk pages (ns:119). In any other namespace, no find sources are emitted.

Expand to view description of how to run these tests

These tests may be performed in two ways: via Special:ExpandTemplates, or in situ.

Here is an example of testing with ExpandTemplates, to test whether find sources links are emitted in Draft talk space:

  1. find the name of some article in Draft that has a talk page
    • From the search box at the top of any page, type Draft talk:, and pick an article from the search suggestions dropdown list
  2. go to Special:ExpandTemplates and use one of the suggestions to test
    • paste one of the suggested 'Draft talk:' pages into 'Context Title'
    • paste the following text the input wikitext box: {{Talk header}}
  3. Expected result: the Talk header template displayed by ExpandTemplates should show find sources links which search for the Context title

The other way to execute a test case, is in situ:

  • find a Draft talk page and open it for editing
  • find the transclusion of {{talk header}} (normally at the top of the page)
  • change it to (or add one if it doesn't have it:) {{talk header}}, and hit Preview
  • Expected result: "find sources" links are found in the Talk header box for the page

Any Draft talk page may be used for these tests. After viewing the test case result in Preview mode on the page, it's best to just cancel out and not save the Previewed page.

The alternative, is to test the subtemplate directly, using the two-param method, passing the name of the Talk page in param 2. These tests follow: -->