Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Dirty editor causes failing SWTBot test to block on 'Save changes?' dialog
Dirty editor causes failing SWTBot test to block on 'Save changes?' dialog [message #507873] Thu, 14 January 2010 18:22 Go to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Hi there,

I've got a test that exercises a JDT source editor. If the test fails
at a point when an editor is "dirty" (has unsaved changes), then the
test hangs indefinitely at the standard 'dirty dialog':

MyTest.java has been modified. Save changes?
No Cancel Yes

Ok, it may not be indefinite, but much longer than the nominal timeout
and longer than my patience allows. :-)

This is obviously undesirable, since it the failing test would prevent
the rest of the test suite from proceeding.

Has anyone seen this? Is there anything I can do to prevent or work
around this?

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: Dirty editor causes failing SWTBot test to block on 'Save changes?' dialog [message #507889 is a reply to message #507873] Thu, 14 January 2010 20:56 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
The normal way to do this is to add a cleanup method in *all* test
classes that cleanup :)

@AfterClass public static cleanup(){
resetWorkbench();
}

For an implementation of resetWorkbench() see [1]

-- Ketan

[1] -
http://github.com/ketan/swtbot/blob/b1359050430337018242a3ab 77cd3461b2210e5f/org.eclipse.swtbot.eclipse.dsl/src/org/ecli pse/swtbot/eclipse/dsl/DefaultWorkbench.java#L89


On 1/14/10 3:08 PM, Robert M. Fuhrer wrote:
> Hi there,
>
> I've got a test that exercises a JDT source editor. If the test fails
> at a point when an editor is "dirty" (has unsaved changes), then the
> test hangs indefinitely at the standard 'dirty dialog':
>
> MyTest.java has been modified. Save changes?
> No Cancel Yes
>
> Ok, it may not be indefinite, but much longer than the nominal timeout
> and longer than my patience allows. :-)
>
> This is obviously undesirable, since it the failing test would prevent
> the rest of the test suite from proceeding.
>
> Has anyone seen this? Is there anything I can do to prevent or work
> around this?
>
Re: Dirty editor causes failing SWTBot test to block on 'Save changes?' dialog [message #507897 is a reply to message #507889] Thu, 14 January 2010 21:16 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Many thanks!

On 1/14/10 8:28 PM, Ketan Padegaonkar wrote:
> The normal way to do this is to add a cleanup method in *all* test
> classes that cleanup :)
>
> @AfterClass public static cleanup(){
> resetWorkbench();
> }
>
> For an implementation of resetWorkbench() see [1]
>
> -- Ketan
>
> [1] -
> http://github.com/ketan/swtbot/blob/b1359050430337018242a3ab 77cd3461b2210e5f/org.eclipse.swtbot.eclipse.dsl/src/org/ecli pse/swtbot/eclipse/dsl/DefaultWorkbench.java#L89
>
>
>
> On 1/14/10 3:08 PM, Robert M. Fuhrer wrote:
>> Hi there,
>>
>> I've got a test that exercises a JDT source editor. If the test fails
>> at a point when an editor is "dirty" (has unsaved changes), then the
>> test hangs indefinitely at the standard 'dirty dialog':
>>
>> MyTest.java has been modified. Save changes?
>> No Cancel Yes
>>
>> Ok, it may not be indefinite, but much longer than the nominal timeout
>> and longer than my patience allows. :-)
>>
>> This is obviously undesirable, since it the failing test would prevent
>> the rest of the test suite from proceeding.
>>
>> Has anyone seen this? Is there anything I can do to prevent or work
>> around this?

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: Dirty editor causes failing SWTBot test to block on 'Save changes?'dialog [message #507977 is a reply to message #507897] Fri, 15 January 2010 11:45 Go to previous message
Petar Petrov is currently offline Petar PetrovFriend
Messages: 10
Registered: July 2009
Junior Member
Hello Robert,

Sometimes saving the edited file is not desired. For this reason we use the
following code in our set up method:

SaveableHelper.testSetAutomatedResponse(1);

This will cause the editor to close without asking for saving the file and
without actually saving it. Keep in mind that this is an internal class,
so may change in the future.

Thanks!
Petar P


> Many thanks!
>
> On 1/14/10 8:28 PM, Ketan Padegaonkar wrote:
>
>> The normal way to do this is to add a cleanup method in *all* test
>> classes that cleanup :)
>>
>> @AfterClass public static cleanup(){
>> resetWorkbench();
>> }
>> For an implementation of resetWorkbench() see [1]
>>
>> -- Ketan
>>
>> [1] -
>> http://github.com/ketan/swtbot/blob/b1359050430337018242a3ab 77cd3461b
>> 2210e5f/org.eclipse.swtbot.eclipse.dsl/src/org/eclipse/swtbo t/eclipse
>> /dsl/DefaultWorkbench.java#L89
>> On 1/14/10 3:08 PM, Robert M. Fuhrer wrote:
>>
>>> Hi there,
>>>
>>> I've got a test that exercises a JDT source editor. If the test
>>> fails at a point when an editor is "dirty" (has unsaved changes),
>>> then the test hangs indefinitely at the standard 'dirty dialog':
>>>
>>> MyTest.java has been modified. Save changes?
>>> No Cancel Yes
>>> Ok, it may not be indefinite, but much longer than the nominal
>>> timeout and longer than my patience allows. :-)
>>>
>>> This is obviously undesirable, since it the failing test would
>>> prevent the rest of the test suite from proceeding.
>>>
>>> Has anyone seen this? Is there anything I can do to prevent or work
>>> around this?
>>>
> --------------------------------
> Robert M. Fuhrer
> Research Staff Member
> Programming Technologies Dept.
> IBM T.J. Watson Research Center
> IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
> X10: Productive High-Performance Parallel Programming
> (http://x10.sf.net)
>
Previous Topic:Drag & drop
Next Topic:Can't access Console view?
Goto Forum:
  


Current Time: Thu Mar 28 20:47:34 GMT 2024

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

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

Back to the top