0

I have a python module abc.py which has numerous class and some class inherting from another classes. The entire file has classes that are connected to each other with objects/instantiation.

The function calls are all based off of GUI button clicks. So, functions get called in abc.py, when buttons are clicked.

I need to write a script which does exactly the same function of button clicking, but without me clicking on the actual GUI - you can imagine it automated.

The issue is, the button on the GUI, when clicked, an event is triggered and the button is associated with a function call "def button_press" which takes (self, event) as parameters.

How would I pass it self and event? I want to use the classes/functions in the module "abc.py" as is and also simulate the button click.. Could you give me some pointers on how I could do this?

Thanks

2 Answers 2

0

You can either:

  1. Create an appropriate event, fill it with your test data and call self.button_press(your_test_event), from within your gui.

  2. As above but from outside your gui call, app.topframe..button_press(your_test_event),

  3. If your event handler does not use any data from the event then if you def button_press(self, evt=None) you can do a or b without creating an event first,

  4. you can use any one of the excellent python GUI Test tools available - some are listed here.

Sign up to request clarification or add additional context in comments.

Comments

0

You'll probably want to look at wx.PostEvent to send events to a button. Or if you're using wxPython 2.9.2 or better, then you can use the new UIActionSimulator, which you can read about here:

I've heard a number of people who use sikuli for GUI testing. There's also COBRA, which I keep seeing listed on the Tested in Python user's group as a tool for GUI testing, although I'm not entirely sure if you can use it on a wxPython app.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.