-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests #833
Comments
Adding tests to workerman is what I have always wanted to do. But I don't have much experience in tests It would be great if you could send a PR and provide a sample template. |
In the TechEmpower benchmark, I'm using the master branch. Now tested with PHP 8.2 RC5, without any problem. |
After thinking about which E2E test system to use. So I started an sketch code for create it, with the same style as Postman, Insomnia, ... |
Many thanks. |
Yes, we need tests. And I really like to use Pest. But we don't need too many unit tests, only for some classes. We need more URGENT to have functional tests.It's better to test the behavior than the code in Workerman. Apache and Nginx use functional testsApache: Nginx: Also Ngx-php use the functional test from Nginx: https://github.com/rryqszq4/ngx-php/blob/master/t/001-hello.t Both use perl, because are veterans projects, and at that time is what they have at hand. PHP use functional testsA better example, is the same PHP.
We need an slight modified .phpt tests. And try to be language agnostic. And I think more in have an echo server in some parts, like in https://httpbin.org Other optionsWe can start fast and use ready made solutions, but they have disadvantages too. Thunder Client Negative:
Rest client Easy to create, and with autocomplete in IDEs of .rest and .http files (both have RFCs) Very good way, perhaps better than .phpt for Workeman. Also separated in dirs and easy to review changes in commits. Negative:
What is better to use? Link to PR #904 |
I'm creating an HTTP protocol test in Adapterman, to be added later to Workerman. But as the tests can be used also with: swoole, amp, reatchphp, ngx-php, .... and also symfony HTTP kernel and variants. It'll be a nightmare to synchronize in 2, 3 or n different repositories. So I'll try to move the test to a repo, and it can be run locally or in GH actions only including it in composer. And we can receive feedback PRs from the others. Locally I have +500 assertions, and working with Adapterman, Workerman, Php cli server and Nginx for now. When it's ready the new tests repo, I'll add to Workerman in local and GH actions to be tested with all event loops. Anybody is invited to help with these tests sending PRs !! https://github.com/joanhey/AdapterMan/tree/master/tests PD: the first gain is that we can make fast changes to the HTTP protocol and underlying architecture without errors |
I'll try to make it agnostic of the Http-client. |
Hi Walkor,
If we have tests, will be faster to develop.
Unit tests
Will be very beneficial but a lot of work, with the release versions (3, 4, 5).
Functional and E2E tests
Will be easier and faster. Not necessarily with PHP.
And will work with all the versions.
We can chose a system, to all align in the efforts.
PHP static analysers
This is really fast to use it.
We don't have test, but the static code analysers can help a lot with the code.
(phpstan, psalm, ...)
And all installed with Github actions.
Talk later !
The text was updated successfully, but these errors were encountered: