app icon indicating copy to clipboard operation
app copied to clipboard

Logger doesn't work for parallel test runs

Open cjol opened this issue 1 year ago • 2 comments

Describe the bug When tests are executed in parallel, the logging section disappears completely.

To Reproduce Steps to reproduce the behavior:

  1. Clone the mocha example repo
  2. Run the example tests in parallel with npm run tests -- --parallel --jobs=2
  3. Click on the report URL, and observe that the report for "logs should be added to the testomatio report" has no logs attached image

Expected behavior Logs should be displayed on the test run (as they are if the parallelism is disabled)

Additional context I assume that the test log capture is based on timing which might make it too difficult to capture logs and associate the correct test. If that's the case, and running tests in parallel is not supported, then the documentation should be updated to reflect this.

cjol avatar Jun 24 '24 10:06 cjol

@cjol did you checked?

https://docs.testomat.io/getting-started/running-automated-tests/#reporting-parallel-tests

poliarush avatar Jun 24 '24 15:06 poliarush

Thanks for the link, I did not see that at first. However it seems to describe a different problem "you might end with multiple reports per each executed process".

Just in case, I have tried "Strategy 2" as described in that document, but that makes no difference to the outcome.

TESTOMATIO_SHARED_RUN=1 TESTOMATIO_TITLE="UniqTitleForThisBuild" npm test -- --parallel --jobs=5
image

cjol avatar Jun 24 '24 16:06 cjol

@cjol please tell which logs do you expect? I assume you have some logs in your terminal on testrun but they are not uploaded to Testomat? Share screenshot.

olexandr13 avatar Nov 15 '24 14:11 olexandr13

Hi, the reproduction in the issue I reported is from your own test suite.

https://github.com/testomatio/examples/blob/master/mocha-ts-multi-reporters/spec/logger.spec.ts#L5-L7

cjol avatar Nov 15 '24 14:11 cjol

@cjol the reason is that some time ago we disabled automatic console logs sending to testomat. to enable, set TESTOMATIO_INTERCEPT_CONSOLE_LOGS=1

Image

olexandr13 avatar Nov 16 '24 13:11 olexandr13