Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] testing
[Databinding] testing [message #326667] Thu, 27 March 2008 16:33 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.
>
>
Previous Topic:[Databinding] databinding arrays and lists of strings
Next Topic:Publishing error on a dynamic web app project
Goto Forum:
  


Current Time: Fri Mar 21 04:33:54 EDT 2025

Powered by FUDForum. Page generated in 0.03241 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top