Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to define the saucelabs job name for a scenario? #7

Open
rovens opened this issue Aug 27, 2015 · 6 comments
Open

How to define the saucelabs job name for a scenario? #7

rovens opened this issue Aug 27, 2015 · 6 comments

Comments

@rovens
Copy link

rovens commented Aug 27, 2015

How do you define the job name for a scenario test running at sauce labs? Sauce labs docuementation states you set the 'name' property as a desiredcapability for the webdriver. Although you can set this is the app.config, it means you cannot set the name per scenario. Are you able to give me a suggestion as to where this might go? Love the project be the way :-)
Robert.

@tuleiko
Copy link

tuleiko commented Nov 10, 2015

Having the same issue. @rovens did you find a solution?

@modo-lv
Copy link

modo-lv commented Nov 10, 2015

Same here. We tried registering a new IWebDriver dependency in a before-scenario hook by providing a custom instance of RemoteWebDriver created at runtime, but that just resulted in the test being run twice — once with the proper name (set at runtime) and once with the static name from App.config.

It seems that instead of overriding the IWebDriver dependency it just registers another one (despite using the same type and name), causing Selenium to run the tests twice. Not that it would be a particularly good solution if it worked, but at least it would be a solution. Right now there doesn't appear to be one.

@rovens
Copy link
Author

rovens commented Nov 10, 2015

In the end I was forced to abandon this package.

  1. Doesn't allow you to define the test name.
  2. No opportunity to capture session id so you can update your cloud test service like saucelabs or browserstack with the test outcome.
  3. Can't run tests in parallel.

I wrote a yeoman based scaffolder to create a solution that does all these things. I've added a repo with a sample solution https://github.com/rovens/specflowdemo. If you want the yeoman generator let me know.
Rob.

@TheCodeKing
Copy link

I was able to resolve this by changing the config to use the SauceLabsWebDriver. I then hooked AfterStep, got the Driver from the context as ISauceLabsWebDriver.

You can then query the ScenarioContext.Current.ScenarioInfo.Title and ScenarioContext.Current.TestError and call the UpdateSauceLabsResult method on ISauceLabsWebDriver.

@modo-lv
Copy link

modo-lv commented Nov 13, 2015

@TheCodeKing Thanks, we were coming up to a similar solution. But doesn't that mean that the name will only change after the test is complete and still have the incorrect name while it's running?

@TheCodeKing
Copy link

It will set the name as soon as the first step executes, until then I use the test name "Pending" set in the config. AfterStep seems to be the only hook that gets called on error and is the only place with access to the Driver (unless you create the driver yourself).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants