I'm not sure if this is a suitable title for the problem. Please suggest.
We have end-to-end payments tests being run in several threads. (It is a mobile testing: Java, Appium, and TestNg) There are many countries and for each of them different payment methods need to be test.
Each test consists of:
- logging in under a specific email address associated with a specific payment method and country
- adding products to cart
- choosing payment method
- proceeding to payment and payment itself
Afterwards a page with total amount and order number info appears. Then we go to inbox and compare the data from the page with the data in the email.
Delay to get email is about 30-60 sec. So each test need to wait for such amount of time. That doesn't make us happy.
So the idea is to collect all info (email-orderNumber-totalInfo) somewhere and check data match after all tests passed. As there are several threads being run so we come up with next ideas:
1.Adding specific ThreadContext for each thread in @BeforeTest method and then at the end of each test (when total info appears) save data to file name as ThreadContext.json And then in @AfterTest method read data and check all emails at once per each thread. But we faced with a problem that we need to keep json valid we need firstly read file then add new JsonObject and save altogether. Problem was with reading/writing to files. Sometimes exceptions occurred so some checks skipped.
-
Then we try to save it to csv files. But again exceptions appeared from time to time.
-
Now there is an idea to use ThreadLocals for keeping data and then use at the end. But I am not sure for stability and performance.
Could you please give your point of view which solution would be the best?
Aucun commentaire:
Enregistrer un commentaire