tags:

views:

20

answers:

1

Hello,

Is there currently any possible way to report progress of my unit test? I have a test that could take up to a hour, and I don't want to sit there not knowing what % it is done with. I have tried writing with debug.print and trace.writeline, neither of which seem to work.

Thanks in advance,

Anthony F Greco

A: 

This probably won't answer your question directly, but most guides on Unit Testing advocate a Unit Test taking a very small amount of time.

Please share what your unit test is doing that could make it take up to an hour.

UPDATE: Based on your comments it is clear that this is not a Unit Test - it is an Integration Test.

thehowler
To my understanding a unit test is simply to test validation of a function. Well I have a function that spiders statistical information on a domain from several sources and combines them into a solid, readable, XML. Problem is some of the sources send back data inconsistently, meaning specific parts of my data were missing. I changed my pattern I looked for to fix it. Here's where the unit test comes in. Checking 1 domain manually doesn't tell me "hey this will work for all domains people may use". To verify it does I would like to give a list of domains and let it run, 1 by 1
Anthony Greco
Now lets assume I send 1000 domains into this unit test to make sure my functions passes all domains I throw at it. This may take up to a hour (if not more) because I am hitting multiple sources and have to take pauses to follow rate limits / TOS. I'd be very helpful after 10 to know im 1% done, as apposed to sitting there wondering "hey what % am I at". Get what I mean?
Anthony Greco
I get what you mean, but by definition that your test is dependant upon external sources, it is not a Unit Test; it is an Integration Test. You have to stub those external dependencies to return prescribed data for your function. That way you are testing your function reliably and in a timely fashion. Like I say, this doesn't answer your question directly, but you shouldn't have to report progress of a Unit Test as it should take a very small amount of time. Have a look at http://en.wikipedia.org/wiki/Unit_testing#Separation_of_interface_from_implementation that describes what I am saying.
thehowler
This is why there is no inbuilt functionality for reporting a Unit Test's progress - it's simply not required as the test should run extremely quickly as you control (inject) all of the external dependencies.
thehowler
I don't really see why they wouldn't just build in simple tracing just in case someone wants to. I see where you are coming from but it is 100% more efficient and easier to just make a unit test for this type of testing then to have to code my testing into my application. Thanks for trying
Anthony Greco