Ho do you run JUnit tests with databinding ?
I can't find a way to set the default realm so every attempt to bind
widgets fails with an exception. How do you test databinding ?
Am 05.03.11 14:20, schrieb Marco Maccaferri:
> Ho do you run JUnit tests with databinding ?
> I can't find a way to set the default realm so every attempt to bind
> widgets fails with an exception. How do you test databinding ?
>
> Regards,
> Marco.
In CVS you should a find a bunch of databinding tests and my wild guess
is that they all derive from such a base class too.
Tom
Am 07.03.11 15:16, schrieb Marco Maccaferri:
> On 07/03/2011 09:14 Tom Schindl ha scritto:
>
>> The default realm is in RCP created by workbench for you so you need to
>> do it in your JUnit-Tests your own.
>
> Yes, I was hoping to find a ready to use solution.
>
> I wrote a simple TestCase subclass that overrides the run(TestResult)
> method:
>
> public class DatabindingTestCase extends TestCase {
>
> @Override
> public void run(final TestResult result) {
>
> Realm.runWithDefault(SWTObservables.getRealm(Display.getDefa ult()), new
> Runnable() {
>
> @Override
> public void run() {
> DatabindingTestCase.super.run(result);
> }
> });
> }
> }
>
> If you derive the tests from that class they should all run with the
> default Realm set without other changes. Looks to work right so far.
>
> Regards,
> Marco.