lain / laravel-test-generator
Laravel package for generating api test automatically
v1.0.3
2022-10-18 09:58 UTC
Requires
- php: ^8.0
- fakerphp/faker: ^1.20
- laravel/framework: ^8.0 || ^9.0
Requires (Dev)
- orchestra/testbench: ^7.6
- phpunit/phpunit: ^9.5
README
Laravel package for generating api test automatically.
Installation
$ composer require lain/laravel-test-generator
Configuration
Copy the package config to your local config with the publish command:
$ php artisan vendor:publish --tag=test-generator
This will add a new config to config/test-generator.php
:
return [ 'get_token' => 'app(Helper::class)->getAccessTokenForEmailToOrg()', ];
Usage
Create test-swagger.json
in your project root directory, It contains the api tests that need to be created, Please make sure it conforms to OpenAPI format (swaager 3.0).
To do so, simply run php artisan test:generate TEST_FILE_NAME
in your project root. This will write all the test cases into the file based on test-swagger json.