Closed Bug 507007 Opened 17 years ago Closed 17 years ago

Needs for ordered Mozmill test runs and for enabling/disabling specific tests

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: whimboo, Unassigned)

Details

Now that we get more and more tests for Mozmill a previous request raises again how we should handle the ordering of how Mozmill tests are run. Right now all of them are processed in an alphabetical order. Which is bad if we have tests which rely on other tests. I know that we can make use of dependencies but that should only happen for a couple of tests which need some pre-processing. We cannot make all tests depend on other ones. See for example the software update test. This test should be run in-front of all other tests as the first test in a test-run. That makes sure that we run all the remaining tests against the most recent version of Firefox. I like the way how reftests, crashtests are handling the ordering and activation/deactivation: http://mxr.mozilla.org/mozilla-central/source/layout/reftests/reftest.list http://mxr.mozilla.org/mozilla-central/source/layout/reftests/backgrounds/reftest.list That way we can specify an order how tests should be run inside a test folder and even the ordering of test folders. Deactivating tests could be done by uncommenting the line which lists the test in the list file. There is no need to rename a whole folder or test file. If that is something which cannot be implemented we really should find a way how to refactor our Mozmill-test repository. No idea if this is easier.
Allowing for ordered tests breaks two other features. Ordered tests make individual test files depend on the order of other tests in their directory, which makes running individual tests impossible. This is why we use the dependency system instead. This also breaks the current ease of breaking up the tests and running them in parallel because we can't effectively divide tests below the directory level. The comment I don't understand is this > I know that we can make use of dependencies but that should only happen for a > couple of tests which need some pre-processing. We cannot make all tests > depend on other ones. Adding test ordering means that all the tests in a directory depend on each other which is ridiculous. Tests should limit their inter-dependencies, test ordering encourages these kinds of dependencies and makes the tests harder to break up and run in parallel. While all the test *files in a directory* are run in alphabetical order the *test functions in a given file* are not, they are run in order. This is the highest level of test ordering I am comfortable allowing because of the larger implications.
(In reply to comment #1) > Allowing for ordered tests breaks two other features. Ordered tests make > individual test files depend on the order of other tests in their directory, > which makes running individual tests impossible. This is why we use the > dependency system instead. This also breaks the current ease of breaking up the > tests and running them in parallel because we can't effectively divide tests > below the directory level. I don't understand this. Right now the collector searches all subfolders for directories and files starting with "test". Those files are considered to run sequentially in an alphabetical order. With a given ordering of the tests the dependencies inside a test will not change. > Adding test ordering means that all the tests in a directory depend on each > other which is ridiculous. Tests should limit their inter-dependencies, test > ordering encourages these kinds of dependencies and makes the tests harder to > break up and run in parallel. Nothing will change. Even right now they depend on each other. It's only another sorting with my proposal. Instead of marking the individual test files to run directly when the collector fetchs the directory information they should get an additional flag given by the list file. Only with this flag set a test file should be run as a top level test. Dependencies will not be affected. > While all the test *files in a directory* are run in alphabetical order the > *test functions in a given file* are not, they are run in order. This is the > highest level of test ordering I am comfortable allowing because of the larger > implications. Right. And this is fine. Test files should be independent from other files but included tests can be entered in the correct order by ourself.
You seem to be assuming that a test run will run *all* the tests, it won't. You can run a single test, or a subdirectory of tests. The fact that all the files are imported by the collector is irrelevant, they won't necessarily be run but they need to be imported in case they are depended on by MODULE_NAME. The runner is responsible for resolving the dependency chain for a targeted test and running required tests before it. There is no way to create another dep chain system for a series of tests nor is it all that useful since tests *should not depend on ordering in this way*. Ordered tests are certainly simpler to understand and much simpler to implement than the system we have for using individual test metadata. Even a module heirarchy system like windmill has would have been easier. The reason the dependency chain is created this way is for the maximum possible flexibility in breaking up large sets of tests and running them in parallel. I don't really have time to explain every individual detail of the test framework nor respond to every feature request that is out of scope. Test dependencies should be used lightly, tests should try only to depend on shared modules and *not share state between test files*. If they do, then we start to limit how much they can be distributed and how easily individual tests can be debugged. Features that start to encourage different behavior are unlikely to be implemented.
So what should we do when we wanna have the following ordering: restart tests: testSoftwareUpdate testExtensionInstallUninstall testThemeInstallUninstall normal tests: testContent testSecurity testBookmarks The only way I can see is to run mozmill and mozmill-restart against the specific folders which require also restarts for mozmill tests. There would no possibility anymore to run the tests directly against the firefox/restartTests folder.
First, testSecurity and testBookmarks should *not* depend on testContent. If they do then we can't run them individually and we can't distribute them. Second, the restart test framework is completely separate from the normal mozmill framework, it does not have dependencies but instead has specified ordering between restarts. Those tests need to stay contained and separate and any other mozmill tests can't depend on them. Third, as it stands all those restart tests will run against different profiles anyway, so any ordering is irrelevant. If there is some special case where we want to automate the install of a bunch of plugins and restart, then run our normal tests that will have to be a separate tool that subclasses the other Mozmill stuff.
Thanks Mikeal. Given your comments we should do something like the following? 1. Seperate the software update tests to a different (its own) folder which is not part of the mozmill and mozmill-restart tests 2. Run the mozmill-restart tests in firefox/testRestartTests 3. Run the mozmill tests in firefox Should we rearrange the tests in the mozmill repository which makes this more obvious? Something like: firefox mozmill mozmill-restart software-update
I think the easiest thing to do is rename testRestartTest to restartTests. This way the default collector won't find it and that directory will need to be passed to the mozmill-restart command line in order to work.
That's the way how it already works since a couple of weeks. My problem are the software update tests. Depending on the different tests we will have to run them several times. So they don't really fit under restartTests. I don't want to introduce another level. So shall we have something like: firefox restartTests softwareUpdateTests testSoftware1 testSoftware2 ... testBookmarks ...
yeah, that's a good idea. whenever you want explicitly separate the runs just break them into a folder that doesn't start with test.
Ok. Clint, are you happy with the solution in comment 8 or shall we better use the way in comment 6? Mikeal, so for the enable/disable part we can only rename the file in the repository? Means if tests fail we remove the test prefix from the test until it has been fixed. But that's kinda bad when checking the history of that file. Would renaming the functions in the test be a better way?
You currently can disable any test function like this: var testFunction = function () {}; testFunction.__force_skip__ = true; Sorry this wasn't documented, it's actually an internal framework bit that we set when tests fail their requirements check or are disabled on a particular platform. Looking at the existing code, just setting it will skip the tests, so don't set it to false thinking that you re-enabled the test :)
well, you could disable all the test functions in a file rather than renaming it. that would be better since you would be able to leave a comment in the file and the version tracking for the file would show that history.
(In reply to comment #10) > Ok. Clint, are you happy with the solution in comment 8 or shall we better use > the way in comment 6? > I think the way you're doing it in comment 8 looks good to me.
Alright. So everything has been solved. Thanks Mikeal and Clint!
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.