I'll try and take a look tomorrow.
Alasdair
The problem is that your test is using the wrong annotations. You need
to use the ThreadedTest annotation to indicate which methods you want
the framework to run. See below.
// This method is run by JUnit. Name it testXXX, or use the @Test annotation
public void testThreading() {
ThreadedTestRunner runner = new ThreadedTestRunner();
// Run all Weaver tests in this class, using DateTime as the Class
Under Test.
runner.runTests(this.getClass(), DateTime.class);
}
// This test method is invoked by the ThreadWeaver framework
// AFTER the framework has loaded and instrumented the test classes.
@ThreadedTest
public void runDateTimeTest() throws Throwable {
MainTest main = new MainTest();
SecondaryTest secondary = new SecondaryTest();
Explanation - in order to pause your test at the right time,
Threadweaver has to load your classes via a special classloader, so
that it can add some instrumentation. The ThreadedTestRunner is
responsible for reloading your test classes with a custom classloader
that does the necessary work.
BUT, I'm afraid that this approach still isn't going to work for you.
The reason is that the InterleavedRunner only does single
interleaving. For example, if you method has 4 lines then it will:
start thread 1 and pause at line 1
let thread 2 run
resume thread 1
reset all objects
start thread 1 and pause at line 2
let thread 2 run
resume thread 1
....
So you won't get the complex interleaving you need.
For that to work, you'd need to use explicit breakpoints, or the
scripting interface, so that you can run thread 1, then pause it and
run thread 2, then pause that and rerun thread 1, and so forth. See
the Wiki for more details.
Hope this helps,
Alasdair