title: How to share state between test classes in a suite with TestNG and Maven?
body: <p>I have a Java test framework set up using TestNG and Maven. My tests are organized into suites via TestNG XML files.</p>
  
  <p>I would like to share state between different test classes in the same suite. Specifically, I want to share the ID for a 'test plan' created in my TestRail test case manager at the start of the test suite execution.</p>
  
  <p>How exactly would I do that? TestNG doesn't seem to offer any functionality for transferring information between test classes, and I'm unsure of how to do it at the Maven level either. Would a static variable in a parent class work, or would it leak or cause too many thread-safety issues?</p>
  
  <p><strong>Update:</strong> I have decided to solve my problem by using a static variable in my parent class (which also holds various state about what tests are running). For my use case, I'm not likely to run multiple instances of the parent class concurrently in the same JVM in a way that needs the static variable to be threadsafe. </p>
  
  <p>However, I am still open to other ideas on how to accomplish this, because I enjoy learning new things.</p>