{"id":22071703,"url":"https://github.com/chinthakagodawita/codeception-timekeeper","last_synced_at":"2025-03-23T19:17:49.429Z","repository":{"id":62501786,"uuid":"273932262","full_name":"chinthakagodawita/codeception-timekeeper","owner":"chinthakagodawita","description":"A Codeception extension \u0026 Robo task that records test runtimes and lets you split tests into equal runtime-based groups for parallel runs","archived":false,"fork":false,"pushed_at":"2020-07-10T14:58:31.000Z","size":63,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T02:24:23.169Z","etag":null,"topics":["codeception","codeception-extension","php-library","robo","robo-task","test-automation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinthakagodawita.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-21T15:30:34.000Z","updated_at":"2020-07-10T14:56:45.000Z","dependencies_parsed_at":"2022-11-02T12:01:45.603Z","dependency_job_id":null,"html_url":"https://github.com/chinthakagodawita/codeception-timekeeper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinthakagodawita%2Fcodeception-timekeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinthakagodawita%2Fcodeception-timekeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinthakagodawita%2Fcodeception-timekeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinthakagodawita%2Fcodeception-timekeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinthakagodawita","download_url":"https://codeload.github.com/chinthakagodawita/codeception-timekeeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245153892,"owners_count":20569408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeception","codeception-extension","php-library","robo","robo-task","test-automation"],"created_at":"2024-11-30T20:33:40.137Z","updated_at":"2025-03-23T19:17:49.403Z","avatar_url":"https://github.com/chinthakagodawita.png","language":"PHP","readme":"# Codeception TimeKeeper\n\nA [Codeception](https://codeception.com/) extension \u0026 [Robo](https://robo.li) task that records test runtimes and lets you split tests into equal runtime-based groups for parallel runs.\n\nThis can be hugely useful when running your tests in an automated fashion, such as in a Continuous Integration system. You can schedule multiple parallel test runs, each with roughly-equal runtimes.\n\nThis extension supports the following Codeception version:\n* 3.x\n* 4.x\n\n# Usage\nFirst, install this package:\n```bash\ncomposer require chinthakagodawita/codeception-timekeeper\n```\n\n## Codeception time reporting extension\n\nUpdate your `codeception.yml` with:\n```yaml\nextensions:\n    enabled:\n        - ChinthakaGodawita\\CodeceptionTimekeeper\\Reporter:\n              report_location: _data/time_report.json\n```\n\nThen run your tests, a report with runtimes for each test will be output to `_data/time_report.json`. This isn't much use on its own, read on for how you can use this to run your tests in parallel.\n\n## Parallel test runs via Robo\n\n[Install Robo](https://robo.li/):\n```bash\ncomposer require --dev consolidation/robo\n```\n\nUpdate your `Robofile`:\n```php\n\u003c?php\n\nclass RoboFile extends \\Robo\\Tasks {\n\n    use \\ChinthakaGodawita\\CodeceptionTimekeeper\\SplitsTestsByTime;\n\n    public function taskSplitTests(): \\Robo\\Result\n    {\n        $groups = 3;\n        $timeReportLocation = '_data/time_report.json';\n        return $this-\u003etaskSplitTestsByTime($groups, $timeReportLocation)\n          -\u003eprojectRoot('.')\n          -\u003etestsFrom('tests')\n          -\u003egroupsTo('tests/_data/timekeeper/group_')\n          -\u003erun();\n    }\n\n}\n```\n\nThen update your `codeception.yml` file with:\n```yaml\ngroups:\n  timekeeper_*: tests/_data/timekeeper/group_*\n```\n\nThis tells Codeception about the existence of the test groups we've just created.\n\nYou'll be able to split tests using:\n```shell script\nphp vendor/bin/robo split:tests\n```\n\nAnd run these test groups using:\n```shell script\nphp vendor/bin/codecept run -g timekeeper_0\nphp vendor/bin/codecept run -g timekeeper_1\nphp vendor/bin/codecept run -g timekeeper_2\n# etc.\n```\n\nSee [the Codeception documentation](https://codeception.com/docs/07-AdvancedUsage#group-files) for more information.\n\n# Troubleshooting\n\n### Some of my tests depend on each other\nThis extension does not _currently_ support tests with dependencies. [Support for this is coming soon](https://github.com/chinthakagodawita/codeception-timekeeper/issues/2).\n\n### Help! I'm seeing strange PHP compatibility errors\nIf you're seeing errors similar to any of the below, then you've hit a variation of [codeception/codeception#5031](https://github.com/Codeception/Codeception/issues/5031)\n* ```ERROR: Declaration of Codeception\\Test\\Test::run(?PHPUnit\\Framework\\TestResult $result = NULL) must be compatible with PHPUnit\\Framework\\Test::run(?PHPUnit\\Framework\\TestResult $result = NULL): PHPUnit\\Framework\\TestResult```\n* ```ERROR: Declaration of Codeception\\Test\\Test::toString() must be compatible with PHPUnit\\Framework\\SelfDescribing::toString(): string```\n\nThe simplest way to fix this, [till a real fix lands upstream](https://github.com/Codeception/Codeception/pull/5894), is to add the following to the very top of your `Robofile` instead of just relying on Composer's autoloader:\n\n```php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\nrequire_once 'vendor/codeception/codeception/autoload.php';\n```\n\nUpdate these paths depending on where your `Robofile` lives in relation to Composer's `vendor` directory.\n\nThis forces Codeception's autoloader to fire and redeclare the PHPUnit classes that it needs to function.\n\n# Inspiration\n* [robo-paracept](https://github.com/Codeception/robo-paracept) from the Codeception folks\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinthakagodawita%2Fcodeception-timekeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinthakagodawita%2Fcodeception-timekeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinthakagodawita%2Fcodeception-timekeeper/lists"}