ldtp.myfastforum.org Forum Index ldtp.myfastforum.org
Linux Desktop Testing Project - http://ldtp.freedesktop.org
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   Join! (free) Join! (free)
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Logging the status

 
Post new topic   Reply to topic    ldtp.myfastforum.org Forum Index -> LDTP Test scripts (http://ldtp.freedesktop.org)
View previous topic :: View next topic  
Author Message
nagappan



Joined: 01 Jan 2008
Posts: 8
Location: Mountain View

PostPosted: Tue Jan 01, 2008 3:33 pm    Post subject: Logging the status Reply with quote

Logging is required to analyze the result of execution. LDTP provides logging using the Python Logger.
Sample LDTP runner xml test.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<ldtp>
        <logfile>teststatus.xml</logfile>
        <category>
                <!-- optional tag starts -->
                <name>category1</name>
                <!-- optional tag ends -->
                <group>
                        <!-- optional tag starts -->
                        <name>group1</name>
                        <!-- optional tag ends -->
                        <script>
                                <testcase>testing log</testcase>
                                <name>test.py</name>
                        </script>
                </group>
        </category>
</ldtp>

LDTP script (FAIL) test.py
Code:
from ldtp import *

launchapp ('gedit')
click ('*-gedit', 'btnFind')
waittillguiexist ('dlgFind')
click ('dlgFind', 'btnClose')
raise LdtpExecutionError ('Hello')

from prompt you can execute like:
$ ldtprunner test.xml
On executing the above command, teststatus.xml will be generated and it looks like the following Output XML/b]
Code:
<ldtp>
<category name="category1">
<group name="group1">
<script name="test.py">
<test name="testing log">
<ERROR>Traceback (most recent call last):
  File "/usr/bin/ldtprunner", line 415, in executescript
    execfile (scriptname, scriptglobal)
  File "test.py", line 6, in &lt;module&gt;
    raise LdtpExecutionError ('Hello')
LdtpExecutionError: 'Hello'
</ERROR>
<CAUSE>'Hello'</CAUSE>
<pass>0</pass>
</test>
</script>
<timeinfo start="15:23:03 PM on 01-Jan-2008" elapsed="0:0:5"></timeinfo>
<groupsstatus total="1" pass="0" fail="1"></groupsstatus>
</group>
</category>
<totaltimeinfo start="15:23:03 PM on 01-Jan-2008" elapsed="0:0:5"></totaltimeinfo>
<categorystatus total="1" pass="0" fail="1"></categorystatus>
</ldtp>

[b]LDTP script (PASS)
test.py
Code:
from ldtp import *

launchapp ('gedit')
click ('*-gedit', 'btnFind')
waittillguiexist ('dlgFind')
click ('dlgFind', 'btnClose')

from prompt you can execute like:
$ ldtprunner test.xml
On executing the above command, teststatus.xml will be generated and it looks like the following [b]Output XML/b]
Code:
<ldtp>
<category name="category1">
<group name="group1">
<script name="test.py">
<test name="testing log">
<pass>1</pass>
</test>
</script>
<timeinfo start="15:34:48 PM on 01-Jan-2008" elapsed="0:0:5"></timeinfo>
<groupsstatus total="1" pass="1" fail="0"></groupsstatus>
</group>
</category>
<totaltimeinfo start="15:34:48 PM on 01-Jan-2008" elapsed="0:0:5"></totaltimeinfo>
<categorystatus total="1" pass="1" fail="0"></categorystatus>
</ldtp>


Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    ldtp.myfastforum.org Forum Index -> LDTP Test scripts (http://ldtp.freedesktop.org) All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Create your own free forum | Buy a domain to use with your forum
Linux Desktop Testing Project - http://ldtp.freedesktop.org