{
    "content": [
        {
            "type": "text",
            "text": "# WWW::Search::Test (perldoc)\n\n## NAME\n\nWWW::Search::Test - utilities to aid in testing WWW::Search backends\n\n## SYNOPSIS\n\n$oTest = new WWW::Search::Test('HotBot,Yahoo,Excite');\n$oTest->test('HotBot', 'Kingpin', 'one', $sQuery, $TESTRANGE, 1, 10);\n\n## DESCRIPTION\n\nSee file test.pl in the WWW-Search-HotBot distribution for a detailed \"real-world\" example.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS AND FUNCTIONS** (2 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "WWW::Search::Test",
        "section": "",
        "mode": "perldoc",
        "summary": "WWW::Search::Test - utilities to aid in testing WWW::Search backends",
        "synopsis": "$oTest = new WWW::Search::Test('HotBot,Yahoo,Excite');\n$oTest->test('HotBot', 'Kingpin', 'one', $sQuery, $TESTRANGE, 1, 10);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "METHODS AND FUNCTIONS",
                "lines": 66,
                "subsections": [
                    {
                        "name": "Shortcuts for running backend tests",
                        "lines": 45
                    },
                    {
                        "name": "native_query",
                        "lines": 8
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "WWW::Search::Test - utilities to aid in testing WWW::Search backends\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "$oTest = new WWW::Search::Test('HotBot,Yahoo,Excite');\n$oTest->test('HotBot', 'Kingpin', 'one', $sQuery, $TESTRANGE, 1, 10);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "See file test.pl in the WWW-Search-HotBot distribution for a detailed \"real-world\" example.\n",
                "subsections": []
            },
            "METHODS AND FUNCTIONS": {
                "content": "findwebsearch\nReturns the full path of an executable WebSearch program, or undef if none can be found.\n\nnew\nCreate a new WWW::Search::Test object. All arguments are strings, names of backends that this\nobject will be able to test. If no arguments are given, will be able to test all backends.\n\nmode\nSet / get the test mode of this object. If an argument is given, sets the mode to that value.\nReturns the current (or newly set) value.\n\nThere are three test modes available. They are:\n\n$MODEINTERNAL: parse URLs out of saved pages (as a sanity check or regression test);\n$MODEEXTERNAL: send the query to the search engine \"live\", parse the results, and compare them to the previously saved results;\nand\n$MODEUPDATE: send the query to the search engine \"live\", parse the results, and save them for future testing.\n\nrelevanttest\nGiven the name of a backend, returns true if this Test object is able to test that backend.\n\nevaltest\nGiven the name of a backend, grabs the $TESTCASES variable from that backend and evaluates it.\n\ntest\nRun test(s) for a backend. Arguments are, in order: name of a backend to test (string,\nrequired); name of backend maintainer (string, if undef $backend::MAINTAINER will be used);\nfilename for results storage/comparison (string, required); query to be sent to backend (string,\nrequired); test method (required, one of the following).\n\nSeveral test methods are possible:\n\n$TESTEXACTLY: list of URLs must match exactly (line for line, in order);\n$TESTBYCOUNTING: test passes if number of resulting URLs is equal;\n$TESTGREATERTHAN: test passes if we get more than N result URLs;\nand\n$TESTRANGE: like $TESTGREATERTHAN but constrained on both ends.\n\nnotest\nPrints a message stating that this backend does not have a test suite. Takes two arguments, the\nbackend name and the name of the maintainer.\n\nnotworking\nPrints a message stating that this backend is known to be broken. Takes two arguments, the\nbackend name and the name of the maintainer.\n\nnotworkingwithtests\nPrints a message stating that this backend is known to be broken even though it has a test\nsuite. Takes two arguments, the backend name and the name of the maintainer.\n\nnotworkingandabandoned\nPrints a message stating that this backend is known to be broken and is not being actively\nmaintained. Takes two arguments, the backend name and the name of the maintainer.\n\nreseterrorcount\nReset the counter of errors to zero. You probably want to call this before each call to test()\nor evaltest().\n\nwcl (private, not a method)\nGiven a filename, count the number of lines of text contained within the file. (I.e. simulate\nrunning UNIX command \"wc -l\" on a file)\n\ndiff (private, not a method)\nGiven two files, returns TRUE if contents are line-by-line different, or FALSE if contents are\nline-by-line same. (I.e. like the UNIX command diff, but just reports true or false)\n",
                "subsections": [
                    {
                        "name": "Shortcuts for running backend tests",
                        "content": "WWW::Search::Test keeps its own count of test numbers, so if you want to mix-and-match these\nfunctions with your own tests, use the $WWW::Search::Test::iTest counter.\n\nnewengine\nOne argument: the name of a backend suitable to be passed to WWW::Search::new(). Prints 'ok' or\n'not ok' and the test number. Creates a WWW::Search object internally, to be used for all\nsubsequent calls to runtest and runguitest (see below).\n\ntmnewengine\nSame as newengine(), but uses Test::More instead of just printing 'ok'.\n\nruntest\nThree arguments: a query string, NOT escaped; a minimum number of expected results; and a\nmaximum number of expected results. Optional fourth argument: integer value to be used as the\nsearchdebug. Optional fifth argument: send any true value to dump the search results. Optional\nsixth argument: reference to hash of search options (see backend documentation). Optional\nseventh argument: send any true value to NOT escape the query string.\n\nIf the minimum is undef, assumes zero. If the maximum is undef, does not check.\n\nPrints 'ok' or 'not ok' and the test number.\n\nrunguitest\nSame as runtest(), but calls guiquery() instead of nativequery().\n\ntmruntest\nSame as runtest(), but uses Test::More rather than just printing 'ok'.\n\nNote: If you use this function inside a TODO block, you must set global variable $TODO rather\nthan a local $TODO, and you must set the global $TODO back to empty-string (or undef) at the end\nof your TODO block. For example:\n\nTODO:\n{\n$TODO = 'I have not fixed this yet';\ntmruntest(...);\n$TODO = '';\n} # end of TODO block\n\ntmruntestnoapprox\nSame as tmruntest, but does NOT check the approximateresultcount.\n\ncountresults\nRun a query, and return the actual (not approximate) number of hits. Required first argument\ndetermines which backend query method to call: 'gui' to call guiquery(), anything else to call"
                    },
                    {
                        "name": "native_query",
                        "content": "skiptest\nYou can call this function instead of runtest() or runguitest() if the current test must be\nskipped for any reason.\n\ntestmostresults\nGiven an arrayref of things to test, runs all those things against all the results of the\nmost-recently executed test search.\n"
                    }
                ]
            }
        }
    }
}