Closed Bug 603820 Opened 14 years ago Closed 13 years ago

Use registerCleanupFunction in our tests

Categories

(Firefox Graveyard :: Panorama, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: iangilman, Unassigned)

Details

As noted in bug 603530, our test failures wouldn't cascade if we use registerCleanupFunction. We should update our existing tests to use this function. 

From https://developer.mozilla.org/en/Browser_chrome_tests : 

If you need to do special clean up after running your test, you can register a cleanup function that is guaranteed to be run after your test finishes. You can call registerCleanupFunction() at any point in your test, even in head.js if you need to register a clean up function for all tests in that folder. Notice that you can register as many clean up functions as you will. Clean up functions are also guaranteed to be called if your test timeouts, so you can ensure that in case of timeouts you won't pollute next running tests and causing them to fail.

 registerCleanupFunction(function() {
   // Clean up test related stuff here.
 });

 function test() {
   // Add some test related stuff.
 }
Blocks: 585689
No longer blocks: 585689
bugspam
No longer blocks: 603789
We are using registerCleanupFunction in our new tests.  

What should we do with this bug now?  Shall we check all tests and add registerCleanupFunction to them?
(In reply to comment #2)
> What should we do with this bug now?  Shall we check all tests and add
> registerCleanupFunction to them?

I think we should have a look at all our older tests and add registerCleanupFunction() only where it seems important - like new windows and prefs, private browsing, etc.
bugspam
No longer blocks: 653099
bugspam
Blocks: 660175
bugspam

(Fx7 was branched, removing open bugs from Fx7 meta bug, we won't create new meta bugs for upcoming Fx versions)
No longer blocks: 660175
Marking this as fixed because most of our tests do now use registerCleanupFunction(), newly written tests have to use it where appropriate and we haven't had cascading failures for quite a while.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.