The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TestRail::Utils::Find - Find runs and tests according to user specifications.

VERSION

version 0.052

DESCRIPTION

FUNCTIONS

findRuns

Find runs based on the options HASHREF provided. See the documentation for testrail-runs, as the long argument names there correspond to hash keys.

The primary routine of testrail-runs.

HASHREF OPTIONS - flags acceptable by testrail-tests
TestRail::API HANDLE - TestRail::API object

Returns ARRAYREF of run definition HASHREFs.

getTests(opts,testrail)

Get the tests specified by the options passed.

HASHREF OPTS - Options for getting the tests
STRING PROJECT - name of Project to look for tests in
STRING RUN - name of Run to get tests from
STRING PLAN (optional) - name of Plan to get run from
ARRAYREF[STRING] CONFIGS (optional) - names of configs run must satisfy, if part of a plan
ARRAYREF[STRING] USERS (optional) - names of users to filter cases by assignee
ARRAYREF[STRING] STATUSES (optional) - names of statuses to filter cases by

Returns ARRAYREF of tests, and the run in which they belong.

findTests(opts,case1,...,caseN)

Given an ARRAY of tests, find tests meeting your criteria (or not) in the specified directory.

HASHREF OPTS - Options for finding tests:
STRING MATCH - Only return tests which exist in the path provided, and in TestRail. Mutually exclusive with no-match, orphans.
STRING NO-MATCH - Only return tests which are in the path provided, but not in TestRail. Mutually exclusive with match, orphans.
STRING ORPHANS - Only return tests which are in TestRail, and not in the path provided. Mutually exclusive with match, no-match
BOOL NO-RECURSE - Do not do a recursive scan for files.
BOOL NAMES-ONLY - Only return the names of the tests rather than the entire test objects.
STRING EXTENSION (optional) - Only return files ending with the provided text (e.g. .t, .test, .pl, .pm)
CODE FINDER (optional) - Use the provided sub to get the list of files on disk. Provides the directory & extension based on above options as arguments. Must return list of tests.
ARRAY CASES - Array of cases to translate to pathnames based on above options.

Returns tests found that meet the criteria laid out in the options. Provides absolute path to tests if match is passed; this is the 'full_title' key if names-only is false/undef. Dies if mutually exclusive options are passed.

getCases

Get cases in a testsuite matching your parameters passed

findCases(opts,@cases)

Find orphan, missing and needing-update cases. They are returned as the hash keys 'orphans', 'missing', and 'updates' respectively. The testsuite_id is also returned in the output hashref.

Option hash keys for input are 'no-missing', 'orphans', and 'update'.

Returns HASHREF.

getResults(options, @cases)

Get results for tests by name, filtered by the provided options, and skipping any runs found in the provided ARRAYREF of run IDs.

Probably should have called this findResults, but we all prefer to get results right?

Returns ARRAYREF of results, and an ARRAYREF of seen plan IDs

Valid Options:

plans - ARRAYREF of plan names to check.
runs - ARRAYREF of runs names to check.
plan_ids - ARRAYREF of plan IDs to NOT check.
run_ids - ARRAYREF of run IDs to NOT check.
pattern - Pattern to filter case results on.
defects - ARRAYREF of defects of which at least one must be present in a result.
fast - Whether to get only the latest result from the test in your run(s). This can significantly speed up operations when gathering metrics for large numbers of tests.

SPECIAL THANKS

Thanks to cPanel Inc, for graciously funding the creation of this module.

AUTHOR

George S. Baugh <teodesian@cpan.org>

SOURCE

The development version is on github at https://github.com/teodesian/TestRail-Perl and may be cloned from git://github.com/teodesian/TestRail-Perl.git

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by George S. Baugh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.