Re: [gnome-desktop-testing] Mago logging



Some great ideas here. The more I think about it, the more I think we need some kind of logger import or object. A magic log of LDTP calls is great but would also be nice to:

Logger.info("Beginning phase 2")
[...]
Logger.success("So far so good")

To have that show up in the log for the test case would be pretty handy.

I'll poke around with decorators and the observer pattern. Pyhton metaclasses let you decorate all calls to a class, though, which is why I mentioned them in the first place. The logger is a little trickier. Either the runner needs to pass down a logger object, which would have to bubble through the suite to the applcation library, or we'd have to use some kind of global state like a singleton. I am not a fan of global state :(

On Tue, Sep 8, 2009 at 12:00 PM, Michael Fletcher <m fletcher theplanet ca> wrote:

* Add a main index page linking to the test suites
* Show test logs from previous mago invocations
Cool. Those would be really nice features to have. The first, i.e. would be easy to implement and indeed would be helpful.
+1


There are a lot of options for implementing it. The first one that came to mind was wrapping the ooldtp context object and doing a little bit of magic there. Perhaps instead of:

save_dialog = ooldtp.context(self.SAVE_DLG)

you might invoke:

save_dialog = magoldtp.context(self.SAVE_DLG, logger)
Mmm, I don't think I like the idea of having mago wrappers for all ooldtp and ldtp methods. It would be too complex.
I agree with Ara.  These would be difficult to maintain.
 
If we don't like the wording of the LDTP messages to the user, we might think about proposing changes in the LDTP code, instead. Nagappan (LDTP's main dev) is always happy to accept contributions.
Changing the message returned by LDTP looks pretty straightforward.



I agree that displaying the detail of each test would be really useful.  I'd suggest adding an Observer pattern to LDTP and hooking mago into that.  Its more difficult because you need to get patches accepted in two different projects however in the long run it would be easier to maintain for both projects.

What I mean by observer is something like this (and pardon my python):

class LDTPObserver:
   def button_clicked(self, component_name)
       print("Button " + component_Name + " was clicked.")

   def button_error(self, component_name)
       print("Button " + component_name + " did not exist.")

   # etc ....

o = LDTPObserver()

ldtp.register_observer(o)
ldtp.click('frmFoo','btnBar')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]