async run()

in suite.js [52:75]


    async run() {
        logger.log("Suite.run started");
        logger.log("suiteData: " + utils.stringify(this.suiteData));
        // We will divide the tests into batches. Batch size is determined by env var "BatchSize" (default 3).
        const batchSize = parseInt(process.env["BatchSize"]) ? parseInt(process.env["BatchSize"]) : config.defaults.defaultBatchSize;
        let testPromises = [];
        try {
            for (let i=0; i<this.suiteData.testData.length; i++) {
                const currTestData = this.suiteData.testData[i];
                testPromises.push(this.runTest(currTestData));
                if ((i+1)%batchSize === 0) { // If end of batch is reached
                    await Promise.all(testPromises); // Wait for batch run to end
                }
                else { // Sleep for 1 second between tests of the same batch (and avoid sleeping between batches).
                    await sleep(1000);
                }
            }
            this.results = await Promise.all(testPromises); // Wait for last batch (can be smaller than batchSize).
        }
        catch (err) {
            throw new Error("Error occurred while executing a test: " + err);
        }
        this.summarizeTestsResults();
    }