Close
jGuru Forums
Posted By: Clay_McCoy Posted On: Tuesday, December 14, 2004 07:59 AM
So I write my first TestCase class. Lets call it MyTestCase. It works great by itself. It fakes some data that it will need, then runs through some tests to make sure everything works right. Great! Now what I want to do is instantiate MyTestCase from another TestCase and have it run through the tests. The reason that I want to do this is because the other TestCase (lets call it AnotherTestCase) is going to feed it the fake data that I want. So I also have made a constructor for loading the fake data in MyTestCase. I would have thought this would be simple. This is the code that I would think that I could put in a test method of AnotherTestCase and have it run the tests of MyTestCase: TestCase ts = new MyTestCase(FakeData); ts.run(); But when I execute AnotherTestCase, it executes these lines, but ts.run() does not cause the tests in MyTestCase to run. The Setup() of MyTestCase runs, but no tests. What is run used for then, and how do I do what I am tryign to do? Even using the regular constructor I can't make this work. If I set up a static suite method in MyTestCase then I can run the tests, but not on the specific MyTestCase that I instantiated. I want to run the tests for this specific instance that I created. The run() is after all an instance method. I can't find any information about how to do this. I must be thinking about this wrong. Help would be greatly appreciated. Thanks
TestCase ts = new MyTestCase(FakeData); ts.run();
Re: Instantiated TestCase won't run tests
Posted By: Anonymous Posted On: Wednesday, December 15, 2004 12:26 AM