Introduce TestSuiteCollection context

hello,
i’m implementing custom reporting using ExtentReports.
one of options is to have more that 1 test suite in report. Unfortunately in listeners i’m not able to implement reporting in such way because test suites are executed within their fresh new context and don’t know about each other.
thank you for reading and consideration.
reports:

1 Like

@devalex88 There is a significant weakness in the programming model here, too. If we had:

callTestSuite(suite_or_collection_name)

and/or

def beforeTestSuite(TestSuiteContext context) {
  if(context.isCollection) { 
   println(context.collectionName)

… life would be a lot easier :wink:

i have feeling that this would not be so easy to implement…

Pseudocodally (hey! new word! :wink: ) I imagine something like this:

collectionName = getCollectionProperty("name")

collection.iterator { suite ->
  suite.context["isCollection"] = true
  suite.context["collectionName"] = collectionName 

  beforeTestSuite(suite.context)
  suite.execute()
  afterTestSuite(suite.context)
}

Looks feasible. Only @devalex88 will know if it’s practical.

Of course, I have no idea if any of that would move you forward with ExtentReports, but I imagine it might.

Would definitely help if you open an issue on Github:

1 Like

the problem i run into was that each test suite is executed separately. what i mean by that is no object i created survived to execution of 2nd test suite … so from listeners perspective existence starts and ends with test suite.

to catch execution of 2nd TS i would need context that knows about that execution…

i’ll create improvement in github and we will see …

btw i like pseudocodal programming :wink:

1 Like

Better?

collectionName = getCollectionProperty("name") 

beforeCollection(collectionContext)

collection.iterator { suite -> 
  suite.context["isCollection"] = true 
  suite.context["collectionName"] = collectionName 

  beforeTestSuite(suite.context)
  suite.execute() 
  afterTestSuite(suite.context) 
}

afterCollection(collectionContext)

1 Like