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.

Bug 16876 - Suggest ability to run each test in its own VM
Summary: Suggest ability to run each test in its own VM
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: xtest (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: issues@obsolete
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-23 18:22 UTC by Jesse Glick
Modified: 2010-04-01 14:43 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-10-23 18:22:03 UTC
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.
Comment 1 Jesse Glick 2001-10-30 20:23:18 UTC
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.
Comment 2 Martin Brehovsky 2001-12-21 17:12:26 UTC
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.
Comment 3 Jesse Glick 2002-05-28 21:00:53 UTC
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.
Comment 4 Martin Brehovsky 2002-05-29 15:14:20 UTC
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.