uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.93k stars 570 forks source link

We need a test suite #208

Closed ghost closed 4 years ago

ghost commented 4 years ago

I want nice JavaScript tests but I have no time to write them myself.

If you want to add tests, good tests, you can PR them. If you write good tests, you can own them and maintain them as you see fit.

I'm thinking uWebSockets.js (server) + websockets/ws (client) + mocha (for tests)

Anyone interested?

aadityataparia commented 4 years ago

👍 I would be interested, I anyway have tests for sifrr-server (based on your awesome lib) in mocha.

Let me know what all test scenarios, we need to test. I can open a PR when I get time.

ghost commented 4 years ago

Test writing would include also coming up with ideas. One thing to test is the recent subscription bug where two subscriptions to the same topic would crash.

IhsanMujdeci commented 4 years ago

@alexhultman can you give an exact example of that bug? @aadityataparia have you made any ground?

ghost commented 4 years ago

https://github.com/uNetworking/uWebSockets/issues/962

ghost commented 4 years ago

Nobody has made any progress

ghost commented 4 years ago

We need integration tests such as posting data to a server, piping that data to md5 checksum and comparing the result with the md5 of that file.

And similar integration tests running actual servers. Using curl or any such tools. A basic test suite for checking basic functionality.

behroozk commented 4 years ago

@alexhultman I'm interested to help as well. One addition to the library that will make integration testing much easier and allows collecting test coverage, is to add an inject method that will manually invoke an endpoint. here is an example from another library https://github.com/fastify/fastify/blob/master/docs/Testing.md.

I'm not sure if this would be possible considering the fact that some parts of the library are native C++ code, but if possible, it would be great. This way we can avoid testing using external tools such as curl.

ghost commented 4 years ago

Fastify is nothing but a router, so testing it with a simple unit test makes sense like that. That's no different to how the router is tested already: https://github.com/uNetworking/uWebSockets/blob/master/tests/HttpRouter.cpp

What I want here is an integration test that is more about checking if things actually work together

fact that some parts of the library are native C++ code

It's all C++, 100%

ghost commented 4 years ago

Closing, will move tests to C++ project instead