Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98814

Cucumber: Initilizing and then Passing data between Step-definitions?

$
0
0

Trying to share information between step definitions.

The problem is that using pico-container way of doing it does not work for me ....

I need the PARENT of my "initial/base" step-definition to do the initialization and the setup the context data. Then the other step-definition should reuse those variables.

I can not change the PARENT class, which is in a jar.

Also only one StepDefinition file can extend PARENT, because it does other stuff which can not be repeated (for one I should not recreate webdriver every step-def).

here is pseudo example :

class PARENT { //... init selenium webdriver ..
  WebDriver driver = new ....;
}

class StepDef1 extends PARENT {

   StepDef1(Context ctx) {
      ctx.driver = this.driver
   }

}

class StepDef2  {
   WebDriver driver;
   StepDef2(Context ctx) {
      this.driver = ctx.driver
   }
}


class StepDef3  {
   WebDriver driver;
   StepDef3(Context ctx) {
      this.driver = ctx.driver
   }
}

How can I make this work ?


Viewing all articles
Browse latest Browse all 98814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>