I have a slightly complicated test structure so bear with me,
I have a series of testng test cases and during each I collect some data about the test( not directly but using a library which I wrote). This library once it gets the data kicks off an analysis program on another thread and the main thread proceeds with executing the rest of the test. (I do this because the analysis is slightly time consuming and I don't want the main test to block).
At the end only a few analysis program threads are left but testng still shuts the test down and the data for the last few test cases could not be analysed.
I don't want a hardcoded sleep at the end. Is there a way I can direct TestNG to wait until any threads spawned by this test (directly or via associated libraries) finish?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…