-
Notifications
You must be signed in to change notification settings - Fork 125
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
When mocha runs in parallel mode, the failed test cases appear yellow instead of red #485
Comments
@jamesmortensen , could you share structure your framework and runner?
I have tried some combinations of runs with different values jobs, with and without data annotation and always parallel mode is not work |
Hi @MASQA sorry for taking so long to get back to you. Because for the longest time Allure wouldn't work with mocha in parallel mode using mocha's parallel feature, we used the script referenced in #245 (comment):
This spawns several mocha processes to run in parallel but without using mocha's parallelism features. We still use this methodology in some tests we run daily. The issue I'm reporting here is that the allure report shows tests in yellow instead of red with mocha's default parallelism feature:
We don't use any annotations. It's a JavaScript project. I'll also say we're not running mocha programmatically. Because our tests are written in ESM, Mocha can't load reporters because it tries to "require" them, but it needs to "import" them. Instead, the wrapper script deals with this by using the execa module to spawn mocha processes from the shell: testFiles.map(testFile =>
limit(async () => {
const subProcess = execa('mocha', [testFile]); In short, we achieve parallelism using the script referenced #245 (comment). Hope this helps! |
I opened a pull request in mocha to fix the inconsistent reporting of failures in Allure. If they don't accept the change, then the next step is to hack the error type from the error stack trace, in the allure-mocha codebase, and add that to the deserialized error object. See the linked pull request for details. mochajs/mocha#4995 |
Allure-mocha now handles the parallel mode differently. We don't rely on how Mocha serializes its events anymore. Instead, we emit the results directly from the worker processes, which have access to As of [email protected], the issue is fixed. Feel free to open a new issue if it doesn't work as expected. |
Describe the bug
When we run tests, any test which fails due to an AssertionError is reported in Allure in red, as a failing test. Any other thrown Error is reported as a broken test, in yellow.
While this functionality works as expected in sequential mode, failed tests are reported as broken tests (in yellow) when run in parallel.
To Reproduce
Steps to reproduce the behavior:
The example has us run tests in sequential mode as well as parallel mode. The README also has screenshots which show the issue.
Expected behavior
Screenshots
Environment (please complete the following information):
| Test framework | [email protected] | [email protected]
| Allure adaptor | [email protected] | [email protected]
| Generate report using | [email protected] |
Additional context
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: