Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Jubula » Initiate test cases
Initiate test cases [message #736038] Thu, 13 October 2011 12:31 Go to next message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
Hi,

Does anyone have a winning concept for how to initiate test cases checking all the stuff that has to be active and reset before running a new test case?

As a start there is the build in module "complex_app_init", but that one only checks if the the application is started and that the window is active. There is always more stuff to initiate to get a robust test suite.

For example how do I do a check if old projects are available and then they should be deleted? Of course I can do select of the project and delete, but if it isn't available then I will get an error when trying to select and delete something which isn't available.

One way to handle this could be if there is some way to do something like an IF statement.
IF <projects available> THEN
...
ENDIF;

Any ideas?

Regards Richard

[Updated on: Thu, 13 October 2011 13:04]

Report message to a moderator

Re: Initiate test cases [message #736053 is a reply to message #736038] Thu, 13 October 2011 13:10 Go to previous messageGo to next message
Andrey Platov is currently offline Andrey PlatovFriend
Messages: 26
Registered: July 2009
Junior Member
Hi Richard,

There are some tools on the market introducing a concept of "Contexts", which are supposed to work exactly like you described. If speak about testing of Eclipse applications some of these tools provides following types of contexts out-of-the-box, like:

* Workspace Context - ensuring that particular files/projects are present (or absent) in the workspace before test run.
* Workbench Context - ensuring specific perspective, views, editors, etc are open or closed before test run.
* Other

Very important thing about Context is it is not only to "check" that your AUT is in required state, but also force your application into required state. For example, if some test specifies that your application requires project A with concrete set of files, the tool will check these files to be presented and provision them before test run (if they are not present).

This is really cool concept, which drastically changes your way to test automation.

I do not know if it would be easy to add such concept to Jubula, however since Jubula is an open source project this would be doable. Also it looks to be nice idea to come with at Jubula Competition at the EclipseCon Smile

Kind Regards,
Andrey
Re: Initiate test cases [message #736072 is a reply to message #736038] Thu, 13 October 2011 13:53 Go to previous messageGo to next message
Felix Ziesel is currently offline Felix ZieselFriend
Messages: 13
Registered: October 2011
Junior Member
Hi Richard,

there are different ways to clean up your workspace if it contains obsolete content.
The tough one is just deleting the workspace.

If you want to ensure that your test case is in a given state (maybe a project should exists), you just should create it if it is not available.

Start with a check if your project exists. Expected value is true.
Add an event handler that will add the project you need and set the retry count to 1.

Regards,
Felix
Re: Initiate test cases [message #740462 is a reply to message #736072] Tue, 18 October 2011 14:39 Go to previous messageGo to next message
Tommy R is currently offline Tommy RFriend
Messages: 19
Registered: October 2011
Location: Hamburg
Junior Member
Hi,

like Felix said: Event Handlers are the key.

so if you want to express something like

IF <projects available> THEN
<delete project>
ENDIF;

you should create a testcase which first does the check for you. But what you are checking for is not whether there are projects but if there are no projects.
This means that: If there are no projects, the check will succeed and all is fine.
But if there projects the check will fail. Now it's the turn of an Event-Handler. The Event-Handler will now delete the project with reentry type "Retry". This means that after the deletion it will do the check for existing projects again and hopefully now does not find any more projects. This means that the check will now succeed and the test continues.
The really interesting point here is, how often you should retry. Since you have to define a specific number, this is not easy. I guess you have to know the exact number of created projects to delete all or put in a high number which you feel certain of being high enough to delete all projects.

Hope this is the answer to your question.

Regards
Re: Initiate test cases [message #741407 is a reply to message #740462] Wed, 19 October 2011 13:57 Go to previous messageGo to next message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
Great answers! Thanks! Here comes a little more tricky situation.

Let's say that I have dialogue windows hanging after running a test case in a test suite. I want to kill the dialogue windows before running the next test case and I don't want to restart the application.
How is this done ? Is it doable?

Regards Richard
Re: Initiate test cases [message #741417 is a reply to message #741407] Wed, 19 October 2011 14:04 Go to previous messageGo to next message
Tommy R is currently offline Tommy RFriend
Messages: 19
Registered: October 2011
Location: Hamburg
Junior Member
Well it's nearly the same.

Make such a testcase for each possible dialog blocking the next test. that means again:

Check if dialog did NOT appear (use unbound_modules_concrete -> Actions -> Check -> Application -> ub_app_checkExistenceOfWindow)
If check fails (Event Handler): close this dialog and make a retry, check should now succeed.

Regards
Re: Initiate test cases [message #742065 is a reply to message #741417] Thu, 20 October 2011 06:19 Go to previous messageGo to next message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
That's a solution, but not maybe the nicest one. It will be a lot of test cases to cover all dialogs. Is there any available test case to close a dialog (press the "X" in the corner of the window)?

My main question was if there is some kind of a general test case or other funtionality within Jubula that kills all hanging dialogs without knowing the name of the dialog, but probably that's not available then?

Regards Richard

[Updated on: Thu, 20 October 2011 06:25]

Report message to a moderator

Re: Initiate test cases [message #742071 is a reply to message #742065] Thu, 20 October 2011 06:27 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1193
Registered: July 2009
Senior Member
You could have a less dialog-specific way of doing it involving using ESC to cancel any open dialogs without knowing exactly which ones they are.

You'd have to play around a bit to decide how you're going to know that dialogs are open (check existence of window with a nice regex "anything other than my main window" for example would be quite nice, trying to perform a check in the menu in the main window would also be a clue that something is blocking the app if it fails). Then you could put the retry count nice and high and just keep hitting ESC as the Event Handler.

Perhaps that helps Smile

Regards,
Alex
Re: Initiate test cases [message #742115 is a reply to message #742071] Thu, 20 October 2011 07:27 Go to previous messageGo to next message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
Extremely nice answer!! Thanks!! I'll experiment a little Smile
Re: Initiate test cases [message #743101 is a reply to message #742115] Fri, 21 October 2011 05:46 Go to previous messageGo to next message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
Hi,

I have now tried some different ways without succeeding.

1.) Tried to select something in the menu bar of the main window (selectEntry_byTextpath). If not possible then there is a hanging window, and an event handler pressing ESC should be triggered. Should work but it didn't. Jubula looks for the main menu in the active window and when not found the default event handler is triggered. Couldn't find out why my written "ESC" event handler wasn't triggered??!!
2.) Tried to check existence of the hanging window with a nice regexp checking "anything other than the main window", but I couldn't figure out a good regexp.
3.) Tried to check if a component in the main window is in focus by using "checkFocus". This really triggers the event handler pressing ESC, but when checking focus of the component in the main window then the hanging window is not active anymore so pressing ESC doesn't bite on the hanging window.

Any suggestions? I can't really be the only one who wants robust test cases where everything is cleaned up. Has anyone solved this in any other way or do you have any suggestions how to get the alternatives above to work?

Regards Richard
Re: Initiate test cases [message #743194 is a reply to message #743101] Fri, 21 October 2011 08:00 Go to previous messageGo to next message
Tommy R is currently offline Tommy RFriend
Messages: 19
Registered: October 2011
Location: Hamburg
Junior Member
To 1.) Maybe you tried to catch the wrong error in the event handler, so the event handler will be unused.
To 2.) Try this one: ^((?!main window).)*$
This will match all windows which are NOT containing the substring "main window" (or what the name of your main window is)
To 3.) Guess it's hopeless then.

Regards
Re: Initiate test cases [message #743417 is a reply to message #743194] Fri, 21 October 2011 13:04 Go to previous message
Richard Skoog is currently offline Richard SkoogFriend
Messages: 48
Registered: October 2011
Member
Great! Thanks! Now both alternative 1 and 2 works.

Regards Richard
Previous Topic:I want to check the property of a table cell
Next Topic:Example web-test
Goto Forum:
  


Current Time: Mon Dec 22 10:37:57 GMT 2014

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

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