Skip to content

Run-multiple - Output directory path appended to test root path by codecept, So unable to create output directories #571

Closed

Description

@shrikanthkm07

What are you trying to achieve?

After upgrading to codeceptjs@0.6.3 for run-multiple

I am using run-multiple command for parallel execution. I am using mocha-reporter to generate output xml file. So I pass my custom directory path in output: /Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports
I am expecting the report file to be saved in this path.

What do you get instead?

Internally codecept is appending the "test root path" which is /Users/madhusus/hydra-dev/src/node_modules/nextgen-test/ to the path which I have passed in output.

So the end result for output directory will be '/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports/desktop_browser_chrome_1' which is invalid.

Provide console output if related. Use --verbose mode for more details.

creating output directory: /Users/madhusus/hydra-dev/src/node_modules/nextgen-test/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports/desktop_browser_chrome_1
fs.js:922
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: ENOENT: no such file or directory, mkdir '/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports/desktop_browser_chrome_1'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:922:18)
    at Command.module.exports (/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/node_modules/codeceptjs/lib/command/run.js:26:8)
    at Command.listener (/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:106:13)
    at Command.emit (events.js:191:7)
    at Command.parseArgs (/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/node_modules/commander/index.js:615:12)
    at Command.parse (/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/node_modules/commander/index.js:458:21)
    at Object.<anonymous> (/Users/madhusus/hydra-dev/src/node_modules/nextgen-test/node_modules/codeceptjs/bin/codecept.js:106:9)
    at Module._compile (module.js:570:32)

Provide test source code if related

// paste test

Details

  • CodeceptJS version: 0.6.3
  • NodeJS Version: v6.9.4
  • Operating System: MAC OS Sierra v10.12.5
  • WebDriverIO
  • Configuration file:

Activity

  1. APshenkin commented on Jun 25, 2017

    @APshenkin
    Contributor

    @shrikanthkm07 Could you, please, provide your codecept.conf.js file? Are you using something like mocha-multi or mochawesome?

    I see only one place, where we override output path

    overriddenConfig = replaceValue(overriddenConfig, 'output', path.join(config.output, outputDir));
    overriddenConfig = replaceValue(overriddenConfig, 'reportDir', path.join(config.output, outputDir));
    

    where config.output is output from config and outputDir is
    suite + JSON.stringify(browserConfig).replace(/[^\d\w]+/g, '_') + suiteId

  2. shrikanthkm07 commented on Jun 27, 2017

    @shrikanthkm07
    Author

    @APshenkin here is the config I export to codecept. I have filled the values.
    As you can see, I am passing output value here, which means all my test results should be saved here but codecept is internally appending test root path to the output. So, the resulting output path will be test root + output, which will look like this.

    /Users/madhusus/hydra-dev/src/node_modules/nextgen-test/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports/desktop_browser_chrome_1

    where

    /Users/madhusus/hydra-dev/src/node_modules/nextgen-test/ is the test-root

    and

    Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports/desktop_browser_chrome_1

    is what I pass custom folder path

    Codecept.conf.js

       tests: "<tests>",
        timeout: 20000,
        output: "/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports",
        helpers: {
            Codecept: {
                require: "<helpersjs>"
            }
        },
        include: {
            I: "<stepsjs>"
        },
        mocha: {
            "reporterOptions": {
                "mochaFile": "/Users/madhusus/hydra-dev/src/node_modules/consumer-automation/test-reports" + "/" + "Acceptance_results.xml"
            }
        },
        multiple: {
            "basic": {
                "browsers": ["chrome", "firefox"]
            },
            "sauce": {
                "browsers": [
                    {
                        browser: 'chrome',
                        "browserName": "chrome",
                        "name": "TEST_CHROME",
                        "platform": "ANY",
                        "version": "55.0",
                        "screenResolution": "1280x960",
                        "unexpectedAlertBehaviour": "ignore",
                        "chromeOptions": {
                            "args": [
                                "disable-extensions"
                            ]
                        },
                        "parentTunnel": "adplm"
                    },
                    {
                        browser: 'firefox',
                        "browserName": "firefox",
                        "name": "TEST_FIREFOX",
                        "platform": "ANY",
                        "version": "51.0",
                        "screenResolution": "1280x960",
                        "parentTunnel": "adplm"
                    }
                ]
            }
        },
        name: "nextgen-test"
    }
    
  3. shrikanthkm07 commented on Jun 27, 2017

    @shrikanthkm07
    Author

    @APshenkin
    I found that , this line is appending test-root path to output path in run.js when we use run-multiple command.
    PR : https://github.com/Codeception/CodeceptJS/pull/482/files
    Any idea on this ?

  4. APshenkin commented on Jun 27, 2017

    @APshenkin
    Contributor

    @shrikanthkm07 I think, we should call @DavertMik for this)

  5. shrikanthkm07 commented on Jun 28, 2017

    @shrikanthkm07
    Author

    @DavertMik Can you look into this..?
    Thanks in advance

  6. shrikanthkm07 commented on Aug 29, 2017

    @shrikanthkm07
    Author

    Is there any update on this ? @DavertMik @APshenkin I am still facing this issue. Thanks

  7. APshenkin commented on Aug 29, 2017

    @APshenkin
    Contributor

    @shrikanthkm07 I will take a look on it this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions