What is the best way to create a test case for a wxPython application? Would you do anything differently than my version below? Please read the comments in the code.
import unittest
import wx
import simpleapp # This is the wxPython application that we are testing
class WidgetFunctionality(unittest.TestCase):
def setUp(self):
self.applicationObject = simpleapp.SimpleApp() # This is a wx.App() subclass, i.e. the application object
self.window = simpleapp.Window(parent=None) # And this is a wx.Frame() subclass, i.e. the main frame
def tearDown(self):
self.applicationObject.Destroy() # Is this really necessary? Does the Python garbage collector handles the destruction?
def testTextFieldInitialValue(self):
self.assertEqual(self.window.textField.GetValue(), ‘’) # Check that the initial value of wx.TextCtrl() is blank (an empty string)
if name == ‘main’:
unittest.main()
What are you trying to test?
I ask because in the current project I am working on I tried to use
dogtail to build an out-of-process test framework for the UI,
unfortunately their isn't enough accessibility stuff implemented for
me to use it effectively. However I still use that sort of appraoch as
it allow me to test the UI behaviour from the highest level.
I would love to find a workable alternative for myself too, but
haven't seen one yet.
Of course the model part of my app has it own independent unittests as
well.
TTFN
···
On Apr 2, 9:21 am, Boštjan Mejak <bostjan.me...@gmail.com> wrote:
What is the best way to create a test case for a wxPython application? Would
you do anything differently than my version below? Please read the comments
in the code.
>
What is the best way to create a test case for a
wxPython
application? Would you do anything differently than my
version
below? Please read the comments in the code.
What are you trying to test?
I ask because in the current project I am working on I
tried to
use dogtail to build an out-of-process test framework for
the UI, > unfortunately their isn’t enough accessibility stuff
implemented
for me to use it effectively. However I still use that sort
of
appraoch as it allow me to test the UI behaviour from the
highest
level.
I would love to find a workable alternative for myself too,
but > haven’t seen one yet.
Of course the model part of my app has it own independent
unittests
as well.
TTFN
A quote from comp.lang.announce that may help you both follows:
Gadget/Steve
"""
PyUseCase is an unconventional GUI testing tool for PyGTK,
Tkinter,
wxPython and SWT
along with a framework for testing Python GUIs in general.
Instead of recording GUI mechanics directly, it asks the user for
descriptive names and hence builds up a "domain language" along
with a
“UI map file” that translates this language into actions on the
current GUI widgets. The point is to reduce coupling, allow very
expressive tests, and ensure that GUI changes mean changing the UI
map
file but not all the tests.
Instead of an "assertion" mechanism, it auto-generates a log of
the
GUI appearance and changes to it. The point is then to use that as
a
baseline for text-based testing, using TextTest.
It also includes support for instrumenting code so that "waits"
can be
recorded, making it far easier for a tester to record correctly
synchronized tests without having to explicitly plan for this.
Homepage: Download: Mailing list:
Bugs: Source: “”"
···
bostjan.me...@gmail.com
http://www.texttest.org/index.php?page=ui_testing
http://sourceforge.net/projects/pyusecase
https://lists.sourceforge.net/lists/listinfo/texttest-users
https://bugs.launchpad.net/pyusecase/
https://code.launchpad.net/pyusecase/
Steve, I didn’t understand a word you have said. Can you be more noob-aware? Thanks.
I have just installed pyusecase via easy_install. How can I use this GUI testing tool now? Is there any documentation. I don’t have a clue about its use. Please give a noob some advice.
Bo�tja,
I have to admit that I have not used the tool in any serious cases as
yet bit if you have a look at the documentation at
http://texttest.carmen.se/index.php?page=ui_testing I think it gives you
a good starting point - have a good read and then start to play is
usually good advice - (having backed everything up first of course - you
did say speak nube!) - if you find you are getting stuck then the
textest user group,
(texttest-users List Signup and Options), would
probably be a good place to ask for more help.
Gadget/Steve
···
On 03/04/2011 5:53 PM, Bo�tjan Mejak wrote:
I have just installed pyusecase via easy_install. How can I use this
GUI testing tool now? Is there any documentation. I don't have a clue
about its use. Please give a noob some advice. --
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
PyUseCase sounds interesting to me. I don't know if it meets your
requirements or not ?? I just know it has support for many python
GUIs (including wxPython).
Here is an announcement that was posted recently to the python-
announce list.
Hi all,
PyUseCase now includes support for SWT/Eclipse RCP, using Jython
and SWTBot.
This is alongside earlier support for wxPython, Tkinter and PyGTK.
There are also a
fair few enhancements to the "shortcut" mechanism for test
refactoring.
Full details are in the ChangeLog in the download.
Regards,
Geoff Bache
A bit more detail:
PyUseCase is an unconventional GUI testing tool for PyGTK,
Tkinter,
wxPython and SWT
along with a framework for testing Python GUIs in general.
Instead of recording GUI mechanics directly, it asks the user for
descriptive names and hence builds up a "domain language" along
with a
"UI map file" that translates this language into actions on the
current GUI widgets. The point is to reduce coupling, allow very
expressive tests, and ensure that GUI changes mean changing the UI
map
file but not all the tests.
Instead of an "assertion" mechanism, it auto-generates a log of
the
GUI appearance and changes to it. The point is then to use that as
a
baseline for text-based testing, using TextTest.
It also includes support for instrumenting code so that "waits"
can be
recorded, making it far easier for a tester to record correctly
synchronized tests without having to explicitly plan for this.
Homepage: http://www.texttest.org/index.php?page=ui_testing
Download: http://sourceforge.net/projects/pyusecase
Mailing list: texttest-users List Signup and Options
Bugs: Bugs : StoryText
Source: Code : StoryText
Cheers, Brendan.
···
On Apr 3, 7:58 am, Roger Gammans <rgamm...@computer-surgery.co.uk> wrote:
On Apr 2, 9:21 am, Boštjan Mejak <bostjan.me...@gmail.com> wrote:> What is the best way to create a test case for a wxPython application? Would
> you do anything differently than my version below? Please read the comments
> in the code.
What are you trying to test?
I ask because in the current project I am working on I tried to use
dogtail to build an out-of-process test framework for the UI,
unfortunately their isn't enough accessibility stuff implemented for
me to use it effectively. However I still use that sort of appraoch as
it allow me to test the UI behaviour from the highest level.
I would love to find a workable alternative for myself too, but
haven't seen one yet.
Of course the model part of my app has it own independent unittests as
well.
PyUseCase certainly looks interesting but I'm not sure it is going to
be any better than dogtail . Dogtail dos the same thing by querying
the accessibility interface rather than having tobuild maps (AIUI) .
Unfortunately under GTK there is no accessibility information for a
wxTreeCtrl. And PyUseCase doesn't seem to support wxTreeCtrl either.
Unfortunately my main windows is based on a TreeCtrl.....
···
On 3 April 2011 23:42, Brendan <brendanjsimon@gmail.com> wrote:
On Apr 3, 7:58 am, Roger Gammans <rgamm...@computer-surgery.co.uk>
I ask because in the current project I am working on I tried to use
dogtail to build an out-of-process test framework for the UI,
unfortunately their isn't enough accessibility stuff implemented for
me to use it effectively. However I still use that sort of appraoch as
it allow me to test the UI behaviour from the highest level.
PyUseCase sounds interesting to me. I don't know if it meets your
requirements or not ?? I just know it has support for many python
GUIs (including wxPython).
What about TextTest? Are PyUseCase and TextTest related? Please tell which is better…
Just found about PyUseCase and TextTest and their relationship. I also found an app called Dogtail. I don’t know how to use all this testing apps. I don’t event know what to do with them. I have my wxPython to test, but how – in pure layman terms – am I about to start testing those out? Also, what does mocking mean and what is a stub? Please help me out. I don’t understand this sh**.