Report is working weird when used from 2 threads

Bug reports.

Report is working weird when used from 2 threads

Postby Pavlo » Mon Feb 27, 2012 12:36 pm

Hi

I found pretty strange behavior of Report after implementing second thread (to watch AUT unhandled exceptions).
So what I have:
1. Main working thread that is executing tests steps
2. Second thread: simple infinite loop that is watching to unhandled exceptions+call report.error(...) + call report.screenshot() and closing exception form (so main thread can try to continue tests)
3. Also I have DebugLogger class extending default Report and simply write all text into debug.txt file (just for debug purpose, so I can access logs in run-time and still have some logs if I cancel debug session and xml file with nice report is not available)

Results(issues):
When unhandled exception happened:
1. second thread found exception form, reported error, reported screenshot, closed exception form (this is good and expected behavior)
2. debug.txt file contains 2 lines for each Report.Error(...) calls (this is not expected behavior, but not critical error. I've expected to have one line for one Report.Error(...) call)
3. report.xml - nice and formatted xml file with all results doesn't contain information from Report.Error(..) called from second thread (this is critical error for me, because manual QAEs will not review debug.txt file and will only review report.xml file for test results)

Notes:
1. Application is on .Net C# with DevExpress
2. Ranorex version is 3.2.1.15734
3. Tests are implemented on C# and executed from nUnit
4. Both threads have STA attribute (and [assembly:RequriesSTA] class attribute was set so nUnit also executes tests with STA thread apartment state)
Pavlo
 
Posts: 43
Joined: Fri Dec 30, 2011 10:55 am

Re: Report is working weird when used from 2 threads

Postby Support Team » Mon Feb 27, 2012 3:53 pm

Hi,

Thank you for posting this bug. We already know this bug and it will be fixed with Ranorex 3.2.2, which should be available this or next week.

Regards,
Peter
Ranorex Team
.
Image
User avatar
Support Team
Site Admin
Site Admin
 
Posts: 9172
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Report is working weird when used from 2 threads

Postby Pavlo » Mon May 21, 2012 2:20 pm

Hi again

I forgot about my problem for a while but now it is reproduced again :(
If there are 2 threads and one is working in backgroud and reports error - those errors don't appear in report
And I'm using Ranorex v3.2.3.

Can you please check if this was fixed in Ranorex 3.2.2 ?

-re
Pavlo
Pavlo
 
Posts: 43
Joined: Fri Dec 30, 2011 10:55 am

Re: Report is working weird when used from 2 threads

Postby Support Team » Tue May 22, 2012 8:39 am

Hi,

Pavlo wrote:If there are 2 threads and one is working in backgroud and reports error - those errors don't appear in report

Sorry, but I've mixed something up. Currently it is not possible to write with two threads to one report, but this feature is already in our TFS System and will be available in one of our Minor/Major releases. With the new fix "Fixed report when TestReport.Setup is called from different threads" you are able to call the TestReport.Setup from different threads but you cannot write from another thread to your main report.

Regards,
Peter
Ranorex Team
.
Image
User avatar
Support Team
Site Admin
Site Admin
 
Posts: 9172
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Report is working weird when used from 2 threads

Postby Pavlo » Tue May 29, 2012 9:49 am

I'm not sure that I understood you :(

Will this flow work or not ?
1. Main thread : TestReport.Setup(...)
2. Main thread : TestReport.BeginTestSuite(...)
3. Main thread : TestReport.BeginTestCase(...)
4. Main thread : TestReport.BeginModule(...)
5. Main thread : Report.Info(...)
6. PopupHandler thread: Report.Error(..)
7. PopupHandler thread: Report.Screenshot(..)
8. Main thread: TestReport.EndTestModule()
9. Main thread: TestReport.EndTestCase()
10. Main thread: TestReport.SaveReport();
11. Main thread: Report.End();
12. Main thread: ActivityStack.Clear();

Expected result: to have single report with error and screenshot reported from PopupHandler thread (actually it's almost the same solution as described in Ranorex blog http://www.ranorex.com/blog/handling-di ... up-windows )

-regards
Pavlo
Pavlo
 
Posts: 43
Joined: Fri Dec 30, 2011 10:55 am

Re: Report is working weird when used from 2 threads

Postby Support Team » Tue May 29, 2012 3:25 pm

Hi Pavlo,

At the moment it is not really possible to save the logged information from different threads into a single report file.
You just can save it to a new log file (without structure just text entries).
If you want to do so you have to call TestReport.Setup(…) in the second thread and then the information is logged and when the thread is closed you have to call TestReport.Save(), the same holds for the main thread and these actions should also be synchronized, because you cannot save two different reportings at the same time.
I have already added a feature request to enable logging from more threads but I cannot tell you when this feature will be implemented because it is not so easy to manage this and we also want to find a way which handles it in the best and user friendliest way.

Regards,
Markus
Ranorex Support Team
.
Image
User avatar
Support Team
Site Admin
Site Admin
 
Posts: 9172
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Report is working weird when used from 2 threads

Postby artur_gadomski » Wed May 30, 2012 12:02 pm

Like Pavlo, I would like this feature in. We also have a separate thread(or task or whatever) dismissing unwanted dialogs and seeing some sort of info in reports would be a good thing. I don't want to create a second report just to see messages like 'Dismissing dialog, trying again'. Looking forward to this feature.
User avatar
artur_gadomski
 
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests