Evilweed / protractor-beautiful-reporter

An npm module which provides html reports of your Protractor tests with screenshots
MIT License
169 stars 40 forks source link

Report failed to consolidate all specs results when run in parallel mode #189

Open nikhilgupta1789 opened 4 years ago

nikhilgupta1789 commented 4 years ago

Issue: When running protractor multiple spec files in parallel mode then beautiful report failed to consolidate all specs executed results and in meantime it also got deleted automatically.

It would be good if it can be handle in a parallel mode nowadays parallel execution is in fashion to reduce execution time. Hope this feature would be added soon.

miller45 commented 4 years ago

It is just not supported. You can either dump the result in different folders, or you can run against multiple browsers with shard test files. But the current implementation is only able to read and write to single results file without locking/synchronization of multiple "threads"

praveendvd commented 4 years ago

It is just not supported. You can either dump the result in different folders, or you can run against multiple browsers with shard test files. But the current implementation is only able to read and write to single results file without locking/synchronization of multiple "threads"

How to put it in different folder ? is there a way to get thread id

praveendvd commented 4 years ago

Hi I figured out that running in multiple capabilities will fix this issue,

multiCapabilities: [{
  'browserName': 'chrome',
specs:['blabla1'],
}, {
  'browserName': 'chrome',
specs:['blabla2']
}]

Else you have to set preserverootdirectory to true , and also sort the result if using sharded tests

jasmine.getEnv().addReporter(new HtmlReporter({
    baseDirectory: 'tmp/screenshots',
    preserveDirectory: true,
    sortFunction:function sortFunction(a, b) {
    if (a.instanceId < b.instanceId) return -1;
    else if (a.instanceId > b.instanceId) return 1;

    if (a.timestamp < b.timestamp) return -1;
    else if (a.timestamp > b.timestamp) return 1;

    return 0;
}
}).getJasmine2Reporter());
nikhilgupta1789 commented 4 years ago

@praveendvd Tried with your first solution as also given in the npm beautiful protractor report but question here is how many times you will keep specs/test cases in specs[]? it is unrealistic and not a correct way of mentioning specs for an example if wanted to run suites then what will be the syntax for it? And for second solution also it overrides the results I tried with different combinations and several times ran the scripts and the result is it overrides the result and in report it shows result of last ran spec file, not a consistent.

I hope @miller45 @Evilweed come up with better solution to add feature supporting of parallel execution of specs in shardTestFiles:true and consolidate all specs result in single report.

Please add this feature soon, people are waiting for this feature because no other protractor reports supports parallel execution.

praveendvd commented 4 years ago

@praveendvd Tried with your first solution as also given in the npm beautiful protractor report but question here is how many times you will keep specs/test cases in specs[]? it is unrealistic and not a correct way of mentioning specs for an example if wanted to run suites then what will be the syntax for it? And for second solution also it overrides the results I tried with different combinations and several times ran the scripts and the result is it overrides the result and in report it shows result of last ran spec file, not a consistent.

I hope @miller45 @Evilweed come up with better solution to add feature supporting of parallel execution of specs in shardTestFiles:true and consolidate all specs result in single report.

Please add this feature soon, people are waiting for this feature because no other protractor reports supports parallel execution.

For second solution you don't have to give spec files , you can set maxInstance property in protractor config and it will work fine as expected

nikhilgupta1789 commented 4 years ago

Hi Praveen @praveendvd , could you please attach a configuration file to run specs in parallel and get all executed results in a consolidated report. It will be very helpful for me to run and see the results in a consolidated report with parallel execution without getting overriding the results.

rahulkedia1409 commented 4 years ago

Let's say i want to keep a count of fail and passed specs and at the end of the suite do some post action like to email the result how can it be achieved any pointers will be much appriciated.

bose1413 commented 3 years ago

Hi I figured out that running in multiple capabilities will fix this issue,

multiCapabilities: [{
  'browserName': 'chrome',
specs:['blabla1'],
}, {
  'browserName': 'chrome',
specs:['blabla2']
}]

Else you have to set preserverootdirectory to true , and also sort the result if using sharded tests

jasmine.getEnv().addReporter(new HtmlReporter({
    baseDirectory: 'tmp/screenshots',
    preserveDirectory: true,
    sortFunction:function sortFunction(a, b) {
    if (a.instanceId < b.instanceId) return -1;
    else if (a.instanceId > b.instanceId) return 1;

    if (a.timestamp < b.timestamp) return -1;
    else if (a.timestamp > b.timestamp) return 1;

    return 0;
}
}).getJasmine2Reporter());

Hi @praveendvd . second solution is working fine.. Thanks for the solution.. cheers

bose1413 commented 3 years ago

Hi Praveen @praveendvd , could you please attach a configuration file to run specs in parallel and get all executed results in a consolidated report. It will be very helpful for me to run and see the results in a consolidated report with parallel execution without getting overriding the results.

conf.txt

Just do follow Configuration uploaded above.. you will get Perfect result for parallel execution with consolidated report