This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
My original message: --- How can I run each test in a class (test1(), test2() etc.) each in its own VM? Do I have to make physically separate Java classes for each VM I want to spawn? Since there is (unfortunately) a lot of NetBeans code that uses static variables and so on, sometimes just running one test affects the result of another one in the same VM. Does XTest have any support for this (e.g. a different test executor, or special TestCase subclass)? IMHO it would be useful. --- Sorry, I have no idea how to implement it using JUnit.
Also a possibility: the opposite, i.e. run a bunch of tests in the same VM (solely to improve test speed), if none of them make any static changes to the VM. You can run them in "ide" mode of course but this pops up a full GUI and other annoying things.
The possibility of running each test method in a separate VM is not easy to achieve in XTest, because on it's dependency on JUnit (or more precisely on some old version of JUnit task from Ant) which always uses one VM instance for one testing class. I can only suggest a workaround. Create proxy classes, which would always contain just one method, which would create the relevant instance of class and run the requires test method. Concerning the second comment, you can create a special executor, which would run your tests in the same VM as XTest is running. Look at the lib/module_harness.xml script in xtest (trunk), target junit_test. You can see nbjunit task, which use attribute junit.fork. This attribute is a flag, whether each test suite should run in a separate VM, or in the same VM as the testing script. You might try to set this variable to 'no' or 'false' in you special executor, before calling the original original executor. This way of execution is actually used when running tests internally in IDE. Please note, that your tests can in this case crash whole excecution of xtest script, because they will run in the same instance of VM as XTest.
Just found another case where this would be really useful. I think I may have to manually split up a test into five or so classes because this feature is missing.
Well, I think this feature can be included in the next version of XTest (we should start to work on it this summer), but since workaround exists, I don't think this feature will be added to the current release.