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

Getting driverConfigurationException for remotedriver with cause NO BaseStepListener has been registered when use @beforeClass annotation #2708

Closed
remyanekkuth opened this issue Feb 16, 2022 · 8 comments

Comments

@remyanekkuth
Copy link

In my framework, I have cucumber tests also junit test. Cucumber test runs with @RunWith(cucumberwithSerenity.class) . I gave parameterised test that runs with @RunWith(SerenityParameterizedRunner.class). All my test cases were working.

As part of my enhancement, I added a new method which contains info that needs to be printed or returned before each class . So I used @BeforeClass annotation.

Surprisingly, after that my test failing with couldn’t instantiate chrome remote driver and caused by is “No baseListener registered”.
My jUnit test cases is working fine though.

When I remove @BeforeClass my test is working fine. Is there is any work around to make this work.

Please help

@wakaleo
Copy link
Member

wakaleo commented Feb 16, 2022

This is normal behaviour. The Webdriver instances are created as part of the test lifecycle, and are not available in @BeforeClass or @BeforeAll methods. What problem are you trying to solve?

@remyanekkuth
Copy link
Author

@wakaleo Oh ok. Then why jUnit test cases are passing when I’m giving @BeforeClass. Only the classes which has RunWith CucumberWithSerenity and data driven tests are failing. The map that I’m returning, I can still see it in console but right after that I am getting error for cucumber and datadriven tests.

I am trying to return a map which includes from where the test triggered, session id, browser name etc.
I need this info printed only once not in test level. Is there any work around to return this if annotations won’t work.

@wakaleo
Copy link
Member

wakaleo commented Feb 16, 2022

There will be a different browser session for each test, or each feature, or each execution thread, and sometimes multiple browsers per test, so having the browser name/session id captured only once doesn't make much sense in the context of a Serenity test suite. In each test you can see this sort of details in the Info page, e.g

image

@remyanekkuth
Copy link
Author

remyanekkuth commented Feb 16, 2022

@wakaleo The requirement for me is, if test is triggered from Jenkins I have to return the key and value for that, along with nodeId, sessionId, etc. if running from IDE , I will return MANUAL as a value for source. Along with that, I will return the browserName and all in console .

having each @test returns these info doesn’t have a value added, since we are mentioning the browser, version etc in Jenkins or as part of run configuration. We are running test with grid, so sessionId and nodeId will also be for that entire session.

eg:
SourceName: JENKINS
Browser: chrome
Version: 96.xx
SessionID: 1234

Is there a way to print it once.

@wakaleo
Copy link
Member

wakaleo commented Feb 16, 2022

No. As I said, the Session ID will be different for each browser instance, and therefore for each test. If you just want to log this information once, as part of your Jenkins build, do it as part of your Jenkins build job, not as part of the Serenity tests.

@remyanekkuth
Copy link
Author

Got it. Thank you so much for your prompt response.

@wakaleo
Copy link
Member

wakaleo commented Feb 16, 2022

No problem. In that case can we close this issue or is there something else you wanted to clarify?

@remyanekkuth
Copy link
Author

No problem. In that case can we close this issue or is there something else you wanted to clarify?

No . I’m good. Thanks again

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

No branches or pull requests

2 participants