bjoern icon indicating copy to clipboard operation
bjoern copied to clipboard

Port of test scripts to unit tests

Open hoefling opened this issue 5 years ago • 10 comments

Closes #52.

hoefling avatar Aug 01 '19 17:08 hoefling

This is really great. Thanks a million.

Minor suggestions in the review.

Maybe you can also add some proper test description docstrings rather than tests/fileabc.py -- at this point you know better than I what the tests do! (Single sentence should be enough!)

One thing we have to think about is that some of the tests are useful only when called 1000s of times, for example the exception tests, which are used to check for memory leaks. Not sure if that's easily automated; otherwise there should be a way to run a list of WSGI applications without the actual test code so we can use the "old" way of bombarding bjoern using make ab etc

jonashaag avatar Aug 02 '19 08:08 jonashaag

One thing we have to think about is that some of the tests are useful only when called 1000s of times, for example the exception tests, which are used to check for memory leaks.

I will look into it, however I'm not sure whether it is a task for unit tests and pytest. Does it look more like load testing? Usually I write load tests with locust, would it be an option for you?

hoefling avatar Aug 02 '19 16:08 hoefling

I will look into it, however I'm not sure whether it is a task for unit tests and pytest. Does it look more like load testing? Usually I write load tests with locust, would it be an option for you?

Sorry for the delay!

Locust is fine for me, or any other tool pretty much.

Yes it's more like load testing. Best case we can load test a bjoern instance and monitor memory use

jonashaag avatar Aug 21 '19 07:08 jonashaag

BUT some of the tests I also used for manual load/performance testing, for example when comparing requests/s for two revisions of bjoern. So if we could have a way to start an instance with a single test case WSGI app that would be awesome

jonashaag avatar Aug 21 '19 07:08 jonashaag

Is there any plans to merge this PR? Its great for helping development.

gcavalcante8808 avatar Nov 05 '19 23:11 gcavalcante8808

Yes when the things I mentioned above are implemented.

jonashaag avatar Nov 05 '19 23:11 jonashaag

I think that an idea could be to merge this PR and add an issue (improvement) for missing tests, probably, if @hoefling are currently busy, other contributors could help on. @jonashaag what do you think about?

mamico avatar Nov 07 '19 04:11 mamico

No. That does not solve the problem that nobody is working on this PR at the moment. The current version is strictly less valuable than the one in the repo.

jonashaag avatar Nov 07 '19 05:11 jonashaag

This PR (and the other one I have started working at for #121) were parts of making bjoern pass the requirements of our internal QA & security team. Since then, we have moved from WSGI, so bjoern is not a requirement anymore; I thus don't have the time to work on the tests anymore. Feel free to use the code in this PR if you want to finish the task - just create your own PR and apply the diff from this one.

However, I don't see any issues with merging the current state as IIRC the existing test scripts are not removed so they are still usable for manual load tests.

hoefling avatar Nov 12 '19 23:11 hoefling

You have a policy that 3rd party application test suites must be automated? 😀

jonashaag avatar Nov 13 '19 09:11 jonashaag