question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bootstrap/bootstrapAll not executed when using run-workers parameter

See original GitHub issue

What are you trying to achieve?

I want to run my tests in parallel with run-workers but the functions i have defined in a bootstrap/bootstrapAll file are not executed beforehand and therefor all my tests are failing.

What do you get instead?

When i run codeceptjs run-workers 3 -c codecept.conf.js there is no output from the console.log inside the bootstrap/bootstrapAll functions. (so they are not executed at all)

Additional info: when i run codeceptjs run-multiple parallel -c codecept.conf.js with the same bootstrap file + codeceptjs config, the output from the console.log in the bootstrap file is printed correct.

Provide bootstrap & codecept.conf.js file content:

// bootstrap file:
module.exports = {

  bootstrapAll: async function(done) {
    console.log("within bootstrapAll");
    done();
  },
  bootstrap: async function(done) {
    console.log("within bootstrap");
    done();
  }
};
//codecept.conf.js (relevant part):
 bootstrapAll: "../bootstrap/prepareDataResources.js",
  bootstrap: "../bootstrap/prepareDataResources.js",
  multiple: {
    parallel: {
      chunks: 20
    }
  },

Details

  • CodeceptJS version: tested with 2.4.3 & 2.6.0
  • NodeJS Version: v12.10.0
  • Operating System: MacOS Catalina (10.15.3)
  • Configuration file: see above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
PeterNgTrcommented, Apr 2, 2020
....
  bootstrap: (done) => {
    console.log("bootstrap is called");
      done();
  },
  teardown: (done) => {
    console.log("teardown is called");
    done();
  },
....

@chwolf the bootstrap and teardown are called when I ran with --verbose

MBP-Thanh-Home:amazon-ui-tests thanhnguyen$ npx codeceptjs run-workers 1 --grep @test --verbose
DEPRECATION NOTICE:
You are using webdriverio v5. It is recommended to update to webdriverio@6.
Support of webdriverio v5 is deprecated and will be removed in CodeceptJS 3.0

CodeceptJS v2.6.0
Running tests in 1 workers...

DEPRECATION NOTICE:
You are using webdriverio v5. It is recommended to update to webdriverio@6.
Support of webdriverio v5 is deprecated and will be removed in CodeceptJS 3.0

4
bootstrap is called
CodeceptJS v2.6.0
Using test root "/Users/thanhnguyen/Desktop/amazon-ui-tests"
Helpers: WebDriver
[1] Search functionality --
Plugins: screenshotOnFail

Search functionality --
    [1] Starting recording promises
    Emitted | suite.before ([object Object])
  Search function is displayed @test
    Emitted | test.before ([object Object])
    Emitted | hook.start ([object Object])
    Emitted | step.before (I am on page "/")
    Emitted | step.after (I am on page "/")
    Emitted | step.start (I am on page "/")
    I am on page "/"
    Emitted | step.passed (I am on page "/")
    Emitted | step.finish (I am on page "/")
    Emitted | hook.passed ([object Object])
    Emitted | test.start ([object Object])
    Emitted | step.before (I dont see element "#twotabsearchtextbox")
    Emitted | step.after (I dont see element "#twotabsearchtextbox")
    Emitted | step.before (I see element "input[type="submit"]")
    Emitted | step.after (I see element "input[type="submit"]")
    Emitted | step.start (I dont see element "#twotabsearchtextbox")
    I dont see element "#twotabsearchtextbox"
    [1] Error | Error
[1]   ✖ Search function is displayed @test in 160ms
    Emitted | step.failed (I dont see element "#twotabsearchtextbox")
    Emitted | step.finish (I dont see element "#twotabsearchtextbox")
    [1] Error | Error
    Emitted | step.failed (I see element "input[type="submit"]")
    Emitted | step.finish (I see element "input[type="submit"]")
    [1] Error | Error
    [1] Starting <teardown> session
    Emitted | test.failed ([object Object])
    Emitted | test.finish ([object Object])
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, saving screenshot
 › Screenshot has been saved to /Users/thanhnguyen/Desktop/amazon-ui-tests/output/Search_fun_1585839218.failed.png
  ✖ FAILED in 865ms

    [2] Starting recording promises
    Emitted | test.after ([object Object])
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) Search functionality
       Search function is displayed @test:
     expected elements of #twotabsearchtextbox not to be seen
  
  Scenario Steps:
  
  - I.dontSeeElement("#twotabsearchtextbox") at Test.<anonymous> (tests/search/search_tests.js:10:7)
  
  


  FAIL  | 0 passed, 1 failed   // 5s
teardown is called
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])


-- FAILURES:

  1) Search functionality
       Search function is displayed @test:
     expected elements of #twotabsearchtextbox not to be seen
  
  Scenario Steps:
  
  - I.dontSeeElement("#twotabsearchtextbox") at Test.<anonymous> (/Users/thanhnguyen/Desktop/amazon-ui-tests/tests/search/search_tests.js:10:7)
0reactions
cwolf24commented, Apr 16, 2020

@PeterNgTr sorry, i did not think about providing a repo - which would it make easier to investigate… i will create a repo when i find some time. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution Parameters does not display label · Issue #4890
Issue Summary: When the pipeline is executed, the label of the parameter is not displayed. Environment: spinnaker version: 1.16.0.
Read more >
Kotlin: function parameters sent in but not executed?
I have the following code that pass in an Integer and two functions. choseNavigation(childPos, {Toast.makeText(ctx, "hello1", Toast.LENGTH_SHORT) ...
Read more >
Examples of the COND parameter - IBM
PROCSTP1 is the first step in the job because of the RESTART specification, and the COND parameter test is not valid because no...
Read more >
if we dont use callback parameter for oncelledit i... - ServiceNow
Hi,. callback: a callback that continues the execution of any other related cell edit scripts. If true is passed as a parameter, ...
Read more >
Execution Model — Luigi 2.8.13 documentation - Read the Docs
The most important aspect is that no execution is transferred. When you run a Luigi workflow, the worker schedules all tasks, and also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found