-
PluginNone I have an idea!There is no possibility to calculate coverage for integration tests. To write integration test we need to run roadrunner via phpunit e.g. for Temporal plugin - https://github.com/temporalio/sdk-php/tree/master/testing#quick-start, but the same can be happen for GRPC plugin. So when we run test PS output looks like that: phpunit -> roadrunner -> workers.
I tried pcov and xdebug and result is the same - code is not covered. Generally I don't have idea how solve this problem, so I will raise it here to open discussion. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 31 replies
-
Hey @cv65kr 👋🏻
I guess this is a good idea, but this is hard for me to help here since I never run a Might be @butschster / @wolfy-j might give the advice here 💯 |
Beta Was this translation helpful? Give feedback.
-
I would also be interested in supporting some way to collect code coverage in RoadRunner, for integration/E2E tests. I have only tried using |
Beta Was this translation helpful? Give feedback.
-
Long story short: If you want to have a integration test, on the beginning of test you need to run roadrunner (and this is separate process).
According to way how coverage is calculated in phpunit - https://github.com/sebastianbergmann/php-code-coverage/blob/main/src/Driver/PcovDriver.php the test block looks like
So in general main process in this case phpunit is not able to calculate and sum coverage from detached php workers. Actual behaviour: coverage is calculated without php workers So @acelaya the idea to add pcov start/end in worker is good start, but it's kinda bad solution because you need to have production and testing workers - so you need to maintain two things. The problem is still the same, phpunit as a main process still is not able to calculate coverage from detached processes.
pcov/xdebug functions not printing anything to stdout: |
Beta Was this translation helpful? Give feedback.
I actually didn't think about the
-w
flag!I suppose the working directory is inferred from the rr.yaml config file location, if not specified. What I did was moving that file to the project root.
However, I have just tried moving the file to its original subfolder, and specified the working directory via
-w
, and that also worked, with the only implication that routes inside the rr.yaml file needed to be adjusted to be relative to the project root, not the file location.So I guess you can document those two approaches.