codeceptjs / codeceptjs/CodeceptJS

Run-workers doesn't start Data() tests with generated values(faker) in DataTable

Aperta
#2,550 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
4.2k
Fork
757
Merge medio
2g 9h
PR unite (30g)
16

Descrizione

#### What are you trying to achieve?
I have some Data tests where I add new objects in DataTable.
In Object1 and Object3 I have only constant fields.
In Object2 I have faker to generate new value for every new object.

When I start this test with run-workers there are only cases with Object1 and Object3 will start.

It is happens because we compile tests in main thread and generate testId(I think from test data) than divides tests among workers.
Than we compile tests again in workers and receive new value inside object so we have new testId.
For example, for 3 workers we will have testId in main thread and 3 different testId for workers and all 4 testId for one testcase in Datatest. So workers will not find testId for this case in publicWorker.workerData.tests array and will not start it.

I have already changed my tests, but I found this problem when I was moving for run-multiple and checked tests quantity in reporter.
Some people can lose tests because of this problem and don't realize it.

```js
const table = new DataTable(['param1', 'param2']);
table.add(['df', new Object1()]);
table.add(['ddf', new Object2()]);
table.add(['nv', new Object3()]);

class Object1 {
constructor() {
this.someField = 'asdfa';
}
}

class Object2 {
constructor() {
this.someField = faker.random.alphaNumeric(5);;
}
}

class Object3 {
constructor() {
this.someField = 'asdfsdfa';
}
}
```

### Details

* CodeceptJS version: 2.6.5
* NodeJS Version: 12
* Operating System: win/linux
* puppeteer || webdriverio || protractor || testcafe version (if related)
* Configuration file:

```js
tests: './tests/**/*_test.js',
output: './output',
helpers: {
WebDriver: {
url: 'http://localhost',
browser: 'chrome',
smartWait: 10000,
waitForTimeout: 10000,
restart: true,
windowSize: 'maximize',
desiredCapabilities: {
chromeOptions: {
prefs: {
'plugins.always_open_pdf_externally': true,
'profile.default_content_settings.popups': 0,
'profile.default_content_setting_values.automatic_downloads': 1,
'download.prompt_for_download': false,
'download.default_directory': path.join(process.cwd(), 'output', 'downloads'),
},
},
},
},
ChaiWrapper: {
require: 'codeceptjs-chai',
},
FileSystem: {},
},
include,
bootstrap: null,
name: 'simple',
plugins: {
wdio: {
enabled: true,
services: ['selenium-standalone'],
},
screenshotOnFail: {
enabled: true,
fullPageScreenshots: true,
},
allure: {},
},
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.