[Databinding] testing [message #326667] |
Thu, 27 March 2008 16:33  |
Eclipse User |
|
|
|
How should I write my junit tests to test these beans and the binding? I
would like to automate as much as possible. I understand how to write the
tests I need to make sure the beans start with the correct values, but do
not understand how to test the values that could change by the user.
|
|
|
Re: [Databinding] testing [message #326691 is a reply to message #326667] |
Fri, 28 March 2008 13:13  |
Eclipse User |
|
|
|
Jay,
Could you be more specific about what you're trying to test? If you
want to make sure that a binding is working, you could do something like:
testNameBinding() {
person.setName("test");
IObservableValue model = BeansObservables.observeValue(person, "name");
IObservableValue target = SWTObservables.observeText(personText,
SWT.Modify);
dbc.bind(target, model, null, null);
assertEquals("test", target.getValue());
target.setValue("test2");
assertEquals("test2", model.getValue());
}
Is this what you had in mind?
If so, take a look at AbstractDefaultRealmTestCase in the tests plugin.
This will ease the burden of testing observables.
Matthew
Jay Simpson wrote:
> How should I write my junit tests to test these beans and the binding? I
> would like to automate as much as possible. I understand how to write the
> tests I need to make sure the beans start with the correct values, but do
> not understand how to test the values that could change by the user.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03241 seconds