Re: [gnome-desktop-testing] patch - gedit/gedit_chains.py



On Mon, 2009-02-16 at 12:30 +0100, Ara Pulido wrote:
> Hey!
> >
> > I would prefer moving FAIL/SUCCESS and other "status codes" to something
> > like desktoptesting.check.StatusCodes and have it imported specifically
> > instead of a "import *"
> The import * was not added to trunk.
> >>  
> >>  try:
> >>  
> >> @@ -29,15 +29,15 @@
> >>      elapsed = stop_time - start_time
> >>      
> >>      testcheck = FileComparison(oracle, test_file)
> >> -    check = testcheck.perform_test()
> >> +    status = testcheck.perform_test()
> >>  
> >>      ldtp.log (str(elapsed), 'time')
> >>      
> >> -    if check == desktoptesting.check.FAIL:
> >> +    if status == FAIL:
> >>          ldtp.log ('Files differ.', 'cause')
> >>          ldtp.log ('Files differ.', 'error')
> >>  
> >> -except ldtp.LdtpExecutionError, msg:
> >> +except ldtp.LdtpExecutionError:
> >>      raise
> >>
> > Wouldn't it be better if we abstract ldtp.LdtpExecutionError into
> > desktoptesting.Exceptions.LdtpExecutionError?
> >
> We wouldn't want to add to much complexity to the framework. The 
> important thing are tests, and not maintaining a complex framework. 
> Nevertheless, your design comments are more than welcome in the wiki [1].
Either we have a complex framework but simple test cases.
Either we have a simple framework but complex test cases.
We cannot have both simple framework and simple test cases. This is
impossible.
I think it is better to put the complexity in the framework, and enable
people to write test cases easily.
This is why, I wrote ltccompiler.py a python script that takes in input
a .ltc file then translates it in a .ltc.py file .
A .ltc file can only see the ldtp namespace. i.e. : the "from ldtp
import *" is implicit. No other namespace is aloud.
Commands issued in a .ltc file are implicitly enclosed in try...except
block.
I am still working on it, there are many other features I want to put in
in it, but the goal is to absorb the complexity of writing test cases in
the framework and let people write test cases, easily an securely.
I putted some initial documentation on it here :
https://wiki.ubuntu.com/AnatomyOfATestCase

I am joining to this email to files :
creating-new-file.ltc and creating-new-file.ltc.py
The relationship beetween the two is the following:




                           -------------
creating-new-file.ltc --> | ltccompiler | ---> creating-new-file.ltc.py
                           -------------


Cheers,
Sandro

> Cheers,
> Ara
> 
> [1] http://live.gnome.org/DesktopTesting/Documentation/Design
> _______________________________________________
> http://live.gnome.org/DesktopTesting
> desktop-testing-list mailing list
> desktop-testing-list gnome org
> http://mail.gnome.org/mailman/listinfo/desktop-testing-list
#!/usr/bin/env python
#===header===
license =   'LGPLv3'
author = 'Sandro Millien <msp lloedy com>'
ltc_title = "Creating new file"
ltc_long_description =\
"""
1. First choose File->New from the menubar
---->A new page will appear in the editor (or a new window if the parent document is windowed)
---->This new document will be named newfile#1, newfile#2, newfile#3 and so on
2. Insert some text in the
3. Save the file : File->Save
"""
#===code===
program_name = 'anjuta'
window_title = 'frm*Anjuta*'
writtenfile = '/tmp/atfa-sc-001.txt'



appundertest('anjuta')
launchapp(program_name, env=1)
if not waittillguiexist(window_title):
	msg = 'Window does not exist'
	log(msg, error)
	raise LdtpExecutionError(msg)	

wait(2) #In case the messages are not yet received
selectmenuitem(window_title, 'mnuFile;mnuNew')
wait(2)
settextvalue(window_title, 'txt0', 'Hello world!')
selectmenuitem(window_title, 'mnuFile;mnuSaveAs')
waittillguiexist('dlgSavefileas')
settextvalue('dlgSavefileas', 'txtName', writtenfile)
click('dlgSavefileas', 'btnSave')
wait(2)
selectmenuitem(window_title, 'mnuFile;mnuQuit')  #Quiting Anjuta...
#!/usr/bin/env python

license =   'LGPLv3'
author = 'Sandro Millien <msp lloedy com>'
ltc_title = "Creating new file"
ltc_long_description =\
"""
1. First choose File->New from the menubar
---->A new page will appear in the editor (or a new window if the parent document is windowed)
---->This new document will be named newfile#1, newfile#2, newfile#3 and so on
2. Insert some text in the
3. Save the file : File->Save
"""
from ldtp import *
try:
	log(ltc_title, "teststart")
	#---------------------------------------------------------------------------------

	
	program_name = 'anjuta'
	window_title = 'frm*Anjuta*'
	writtenfile = '/tmp/atfa-sc-001.txt'
	
	
	
	appundertest('anjuta')
	launchapp(program_name, env=1)
	if not waittillguiexist(window_title):
		msg = 'Window does not exist'
		log(msg, error)
		raise LdtpExecutionError(msg)	
	
	wait(2) #In case the messages are not yet received
	selectmenuitem(window_title, 'mnuFile;mnuNew')
	wait(2)
	settextvalue(window_title, 'txt0', 'Hello world!')
	selectmenuitem(window_title, 'mnuFile;mnuSaveAs')
	waittillguiexist('dlgSavefileas')
	settextvalue('dlgSavefileas', 'txtName', writtenfile)
	click('dlgSavefileas', 'btnSave')
	wait(2)
	selectmenuitem(window_title, 'mnuFile;mnuQuit')  #Quiting Anjuta...

	#---------------------------------------------------------------------------------
	log(ltc_title, "testend")
except LdtpExecutionError, msg:
	log(msg, error)
	log(ltc_title, "fail")
	log(ltc_title, "testend")
	print msg
	raise LdtpExecutionError(msg)


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