title: Create an object to share data between multiple TestNG classes
body: <p>I have created following relationship with object</p>
  
  <pre><code>public class Parent {
    //Making API calls to get some data which can be used
    //across multiple test classes
  }
  </code></pre>
  
  <p>Then I'm inherting the Test classes as</p>
  
  <pre><code>public class Child1 extends Parent {
   //I need data collected in Parent class
  }
  </code></pre>
  
  <p>Again I have second class as</p>
  
  <pre><code>public class Child2 extends Parent {
   //I also need the same  data collected in Parent class
  }
  </code></pre>
  
  <p>My <code>TestNG</code> suite is as given below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" &gt;
  &lt;suite name="e2e-suite" verbose="1"&gt;
  
      &lt;test name="e2e tests" preserve-order="true"&gt;
          &lt;classes&gt;
              &lt;class name="com.abc.test.Child1" /&gt;
              &lt;class name="com.abc.test.Child2" /&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>But , when I trigger the test suites , my <code>Parent</code> class API data collection logic get invoked properly, I also get data that is direct available to first class which consumes it i.e <code>Child1</code></p>
  
  <p>But, for <code>Child2</code> class , the Parent class logic isn't get invoked again <em>(even I don't want it to execute again)</em>. The question is how the data that I collected in Parent class can be shared &amp; persistent across other Child objects like <code>Child2</code>.</p>
  
  <p>Currently, I'm using <code>static</code> Parent class Fields to share data. I'm looking for some Implementation which can allow me to store data from Parent class to another object which can be used across all Child Test objects (If any other better way to share data collected in parent class to later test classes is also fine for me)</p>