Template:Talk header/testcases3

A. Using search_term to change the default search
By default, the pagename is used as the argument to find sources. This can be altered with the use of search_term.

C. Opt-out find sources
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 1 to simulate the correct namespace so it would be included, then use the opt-out params to hide it again.

Redo same trio, using alias main:

D. Param 'search-domain'
Article on medical topics get a different set of links generated by find medical sources rather than the regular template.

E. WikiProject detection
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.

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   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: yes must be included to prevent a runaway script from searching for endless, non-existent archives)
 * 1) 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   into 'Context Title' (Note: this article belongs only to WP:WikiProject Video games.)
 * 2) paste the following text into the input wikitext box:


 * 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  (normally at the top of the Talk page; or add one)
 * 3) change it to  (+ 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


 * 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:


 * Talk:Darkwing Duck (Capcom video game)
 * Talk:Illyriad
 * Talk:Microsoft Flight Simulator (2020 video game)


 * 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


 * Talk:Giardiasis
 * Talk:Myelodysplastic syndrome
 * Talk:Amoxicillin
 * Talk:Major depressive disorder

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

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;


 * CMedWikiProject 0 in-links in Talk space
 * Wikiproject_med 0 in-links
 * Wikiproject_Med 0 in-links
 * Wikiproject_medicine 6 in-links
 * Wikiproject_Medicine > 500 in-links (main; not redirect)
 * Wikiproject_Medicines 0 in-links
 * WP Med 4 in-links
 * WP Medicine 240 in-links
 * WP:MED 0 in-links
 * Wpmed 5 in-links
 * WPMed 18 in-links
 * WPMED > 500 in-links
 * WPMedical 0 in-links
 * WPMedicine 47 in-links
 * WPMEDICINE 6 in-links

Some examples for testing: (expected result: medical sources links are displayed in the TPH.
 * Talk:Bacillus cereus
 * Talk:Botulism
 * Talk:Causes of mental disorders
 * Talk:Dengue
 * Talk:Guillain–Barré syndrome
 * Talk:Lacosamide
 * Talk:List of infectious diseases
 * Talk:Pearl Index
 * Talk:Psychosis
 * Talk:Psychosurgery
 * Talk:Tuberculosis

Sample article TPs for pages using other redirects to project Medicine:
 * Wikiproject Medicine – Talk:Serpin, Talk:Diethyl ether
 * WPMED – Talk:Hangover, Talk:Tuberculosis
 * WP Medicine – Talk:Clinistrip, Talk:Silver nanoparticle (chemotherapy)
 * Wikiproject Medicine – Talk:Diethyl ether
 * Wikiproject medicine – Talk:Skin infection, Talk:Vaccine exemption
 * WP Med – Talk:Leo Galland, Talk:Prevalence of rabies
 * WPMed – Talk:MedicineNet, Talk:J147
 * wpmed – Talk:Microinfarct
 * WPMedicine – Talk:Cell damage, Talk:Trauma shears
 * WPMEDICINE – Talk:Urethraplasty, Talk:Mayer waves


 * 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


 * Talk:Edgar Poe
 * Talk:Anne Brontë
 * Talk:Charlotte Brontë


 * 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 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:


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

Expected result: Medical links (results match )


 * Talk:Álvaro Luiz Maior de Aquino
 * Talk:Gary Onik
 * Talk:Joan Bailey-Wilson
 * Talk:Clive Wearing
 * Talk:Marie McCormick

E-4b – video & biographical:


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

Expected result: Video links (results match )


 * Talk:TobiWan
 * Talk:Garry M. Gaber
 * Talk:David W. Bradley


 * 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)


 * Talk:Great Fransham
 * Talk:Internal energy
 * Talk:Chocó woodpecker

F. WikiProject override
Please read the instructions in section 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   into 'Context Title'. (Note: this article belongs to WP:WikiProject Video games)
 * 3) paste the following text into the input wikitext box:

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 (normally at the top of the page)
 * change it to (or add:), 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 (or ) and Preview
 * observe that the find sources links in the Talk header change to those of find medical sources
 * change the header to ( or ) and Preview
 * observe that the find sources links in the Talk header change to those of find video game sources
 * change the header to or ( 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 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
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.

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
 * 2) * From the search box at the top of any page, type, and pick an article from the search suggestions dropdown list
 * 3) go to Special:ExpandTemplates and use one of the suggestions to test
 * 4) * paste one of the suggested 'Draft talk:' pages into 'Context Title'
 * 5) * paste the following text the input wikitext box:
 * 6) 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 (normally at the top of the page)
 * change it to (or add one if it doesn't have it:), 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: -->