UI testing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

UI testing

Usman Bhatti
Hi all,

Is there anything in Pharo that supports UI testing?
What I would like to achieve is to be able to simulate a click, select a menu item, input some text in text fields, Ok/Cancel button click, and some other basic task for the automation of my tests. 

With Glamour, I can simulate transmissions programatically and then test for the display values in the presentations or dig the resulting morph structure to test for specific information. The problem with dialog boxes is that once launched, I cannot perform anything in the system because my test code is active only when dialog boxes get their intended input and are validated.

So, if there is anything for simulating testing "scenarios" (click on second button -> select third menu item -> fill up text field -> select color -> ok button -> test fourth PanelMorph in the window ), it would be really helpful and make my testing much more productive.

regards,

usman
Reply | Threaded
Open this post in threaded view
|

Re: UI testing

Marcus Denker-4

On 30 Sep 2014, at 11:00, Usman Bhatti <[hidden email]> wrote:

> Hi all,
>
> Is there anything in Pharo that supports UI testing?
> What I would like to achieve is to be able to simulate a click, select a menu item, input some text in text fields, Ok/Cancel button click, and some other basic task for the automation of my tests.
>
> With Glamour, I can simulate transmissions programatically and then test for the display values in the presentations or dig the resulting morph structure to test for specific information. The problem with dialog boxes is that once launched, I cannot perform anything in the system because my test code is active only when dialog boxes get their intended input and are validated.
>
> So, if there is anything for simulating testing "scenarios" (click on second button -> select third menu item -> fill up text field -> select color -> ok button -> test fourth PanelMorph in the window ), it would be really helpful and make my testing much more productive.
>

There is UITestCase (see the subclasses), e.g.

testSimulateClick
        "self run: #testSimulateClick"

        morph := TextMorph new contents: ''; openInWorld.
        morph simulateClick.
        self assert: morph hasKeyboardFocus.


But it definitely needs more e.g. for pressing buttons and things like that.

        Marcus

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: UI testing

Usman Bhatti
Tx Marcus.
I'll have a look at what this infrastructure already offers to see if I can use it directly or with some enhancements.

usman

On Tue, Sep 30, 2014 at 11:22 AM, Marcus Denker <[hidden email]> wrote:

On 30 Sep 2014, at 11:00, Usman Bhatti <[hidden email]> wrote:

> Hi all,
>
> Is there anything in Pharo that supports UI testing?
> What I would like to achieve is to be able to simulate a click, select a menu item, input some text in text fields, Ok/Cancel button click, and some other basic task for the automation of my tests.
>
> With Glamour, I can simulate transmissions programatically and then test for the display values in the presentations or dig the resulting morph structure to test for specific information. The problem with dialog boxes is that once launched, I cannot perform anything in the system because my test code is active only when dialog boxes get their intended input and are validated.
>
> So, if there is anything for simulating testing "scenarios" (click on second button -> select third menu item -> fill up text field -> select color -> ok button -> test fourth PanelMorph in the window ), it would be really helpful and make my testing much more productive.
>

There is UITestCase (see the subclasses), e.g.

testSimulateClick
        "self run: #testSimulateClick"

        morph := TextMorph new contents: ''; openInWorld.
        morph simulateClick.
        self assert: morph hasKeyboardFocus.


But it definitely needs more e.g. for pressing buttons and things like that.

        Marcus

Reply | Threaded
Open this post in threaded view
|

Re: UI testing

Sven Van Caekenberghe-2
Spec UI are reasonably testable as well, this tutorial contains a sub section doing just that:

  https://medium.com/@svenvc/rediscovering-the-ux-of-the-legendary-hp-35-scientific-pocket-calculator-d1d497ece999

But testing dialogs is indeed a challenge ;-)

On 30 Sep 2014, at 11:32, Usman Bhatti <[hidden email]> wrote:

> Tx Marcus.
> I'll have a look at what this infrastructure already offers to see if I can use it directly or with some enhancements.
>
> usman
>
> On Tue, Sep 30, 2014 at 11:22 AM, Marcus Denker <[hidden email]> wrote:
>
> On 30 Sep 2014, at 11:00, Usman Bhatti <[hidden email]> wrote:
>
> > Hi all,
> >
> > Is there anything in Pharo that supports UI testing?
> > What I would like to achieve is to be able to simulate a click, select a menu item, input some text in text fields, Ok/Cancel button click, and some other basic task for the automation of my tests.
> >
> > With Glamour, I can simulate transmissions programatically and then test for the display values in the presentations or dig the resulting morph structure to test for specific information. The problem with dialog boxes is that once launched, I cannot perform anything in the system because my test code is active only when dialog boxes get their intended input and are validated.
> >
> > So, if there is anything for simulating testing "scenarios" (click on second button -> select third menu item -> fill up text field -> select color -> ok button -> test fourth PanelMorph in the window ), it would be really helpful and make my testing much more productive.
> >
>
> There is UITestCase (see the subclasses), e.g.
>
> testSimulateClick
>         "self run: #testSimulateClick"
>
>         morph := TextMorph new contents: ''; openInWorld.
>         morph simulateClick.
>         self assert: morph hasKeyboardFocus.
>
>
> But it definitely needs more e.g. for pressing buttons and things like that.
>
>         Marcus
>


Reply | Threaded
Open this post in threaded view
|

Re: UI testing

Tudor Girba-2
In reply to this post by Usman Bhatti
Hi,

Glamour comes with an extensive Morphic test suite.

You can check it here in the subclasses of GLMMorphicTest. The superclass also has a number of utility methods. The checking is done via excellent additions to Morphic (I believe by Sean).

See for example this:
GLMTextMorphicTest>>testAcceptKeyCanBeOverriden
| composite textMorph overriden |
overriden := false.
composite := GLMCompositePresentation new with: [ :a | a text act: [ :text | overriden := true ] on: $s entitled: 'Override'].
window := composite openOn: 4.
textMorph := self find: PluggableTextMorph in: window.
textMorph simulateClick.
self simulateKeyStroke: $s command.
self simulateKeyStroke: $s control.
self simulateKeyStroke: $s alt.
self assert: overriden.

Cheers,
Doru



On Tue, Sep 30, 2014 at 11:00 AM, Usman Bhatti <[hidden email]> wrote:
Hi all,

Is there anything in Pharo that supports UI testing?
What I would like to achieve is to be able to simulate a click, select a menu item, input some text in text fields, Ok/Cancel button click, and some other basic task for the automation of my tests. 

With Glamour, I can simulate transmissions programatically and then test for the display values in the presentations or dig the resulting morph structure to test for specific information. The problem with dialog boxes is that once launched, I cannot perform anything in the system because my test code is active only when dialog boxes get their intended input and are validated.

So, if there is anything for simulating testing "scenarios" (click on second button -> select third menu item -> fill up text field -> select color -> ok button -> test fourth PanelMorph in the window ), it would be really helpful and make my testing much more productive.

regards,

usman



--

"Every thing has its own flow"