Getting Teststeps from swtbot [message #506819] |
Sun, 10 January 2010 06:37  |
Eclipse User |
|
|
|
Hello,
is there a way to log the the steps of a test.
For exampel.
- Select Treeitem "test"
- click contextMenuItem "edit"
- choose shell "edit"
- deselect radiobutton "delete"
- click button "ok"
Is there a chance to get such entries or something like that.
I dont know all findWidgets texts, but the actions, which I make in the applications. I want to put them in a protocol later. So a developer, canfaster reproduce the testcase with a failure.
|
|
|
|
|
Re: Getting Teststeps from swtbot [message #508541 is a reply to message #508167] |
Tue, 19 January 2010 06:40  |
Eclipse User |
|
|
|
I guess a grep pattern is the only way to do this. You may potentially
write your own Appender implementation[1] that logs only if certain
keywords are present in the log statement.
-- Ketan
[1] -
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j /FileAppender.html
On 1/16/10 3:28 PM, Michelle Davidson wrote:
> Hello,
>
> Thanks for the answer. I have tried that. But now I have too much log
> statements. I want only action like click, activate, type or something
> like this. But I also get the log statements for sending events from the
> class Abstract SWTBot. Because both have the loglevel debug and the
> class AbstractSWTBot is in the same package like the widget classes.
> Is the chance to get only the statements for the actions and not for the
> events.
>
> I tried to set the loglevel for the class Abstract SWTBot to OFF and for
> the package ....widgets to DEBUG. But I get also this.
>
> Quote:
>> 17 Jan 2010 00:17:48.332 - WorkbenchTestable - TRACE - SWTBotButton -
>> (AbstractSWTBot.java:151) - Enquing event Deactivate [27]:
>> ShellEvent{Button {*Disposed*} time=963483308 data=null doit=true} on
>> (of type 'Button' and with mnemonic 'OK' and with style 'SWT.PUSH')
>> 17 Jan 2010 00:17:48.332 - main - TRACE - SWTBotButton -
>> (AbstractSWTBot$2.java:155) - Not notifying (of type 'Button' and with
>> mnemonic 'OK' and with style 'SWT.PUSH') is null or has been disposed
>> 17 Jan 2010 00:17:48.332 - WorkbenchTestable - TRACE - SWTBotButton -
>> (AbstractSWTBot.java:151) - Enquing event FocusOut [16]:
>> FocusEvent{Button {*Disposed*} time=963483308 data=null} on (of type
>> 'Button' and with mnemonic 'OK' and with style 'SWT.PUSH')
>> 17 Jan 2010 00:17:48.334 - main - TRACE - SWTBotButton -
>> (AbstractSWTBot$2.java:155) - Not notifying (of type 'Button' and with
>> mnemonic 'OK' and with style 'SWT.PUSH') is null or has been disposed
>> 17 Jan 2010 00:17:48.334 - WorkbenchTestable - DEBUG - SWTBotButton -
>> (SWTBotButton.java:78) - Clicked on 17 Jan 2010 00:17:48.335 -
>> WorkbenchTestable - TRACE - SWTBotTreeItem - (AbstractSWTBot.java:151)
>> - Enquing event Expand [17]: TreeEvent{Tree {} time=963483311
>> data=null item=TreeItem {Root} detail=0 x=0 y=0 width=0 height=0
>> stateMask=0 text=null doit=true} on TreeItem with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.335 - main - TRACE - SWTBotTreeItem -
>> (AbstractSWTBot$2.java:162) - Sending event Expand [17]:
>> TreeEvent{Tree {} time=963483311 data=null item=TreeItem {Root}
>> detail=0 x=0 y=0 width=0 height=0 stateMask=0 text=null doit=true} to
>> TreeItem with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.336 - main - DEBUG - SWTBotTreeItem -
>> (AbstractSWTBot$2.java:164) - Sent event Expand [17]: TreeEvent{Tree
>> {} time=963483311 data=null item=TreeItem {Root} detail=0 x=0 y=0
>> width=0 height=0 stateMask=0 text=null doit=true} to TreeItem with
>> text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.340 - WorkbenchTestable - TRACE - SWTBotTreeItem
>> - (AbstractSWTBot.java:151) - Enquing event MouseMove [5]:
>> MouseEvent{Tree {} time=963483313 data=null button=0 stateMask=0 x=0
>> y=0 count=0} on TreeItem with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.340 - main - TRACE - SWTBotTreeItem -
>> (AbstractSWTBot$2.java:162) - Sending event MouseMove [5]:
>> MouseEvent{Tree {} time=963483313 data=null button=0 stateMask=0 x=0
>> y=0 count=0} to TreeItem with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.341 - main - DEBUG - SWTBotTreeItem -
>> (AbstractSWTBot$2.java:164) - Sent event MouseMove [5]:
>> MouseEvent{Tree {} time=963483313 data=null button=0 stateMask=0 x=0
>> y=0 count=0} to TreeItem with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.341 - WorkbenchTestable - TRACE - SWTBotTreeItem
>> - (AbstractSWTBot.java:151) - Enquing event Activate [26]:
>> ShellEvent{Tree {} time=963483317 data=null doit=true} on TreeItem
>> with text {TreeItem {Root}}
>> 17 Jan 2010 00:17:48.342 - main - TRACE - SWTBotTreeItem -
>> (AbstractSWTBot$2.java:162) - Sending event Activate [26]:
>> ShellEvent{Tree {} time=963483317 data=null doit=true} to TreeItem
>> with text {TreeItem {Root}}
>
>
> That was a part of the log file.
>
> This is my log4j.xml
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
> debug="false">
>
> <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
> <param name="Target" value="System.out" />
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern"
> value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} -
> (%C{1}.java:%L) - %m%n" />
> </layout>
> </appender>
>
> <appender name="fileAppender" class="org.apache.log4j.FileAppender">
> <param name="File" value="/tmp/debug.log" />
> <param name="Append" value="true" />
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern"
> value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} -
> (%C{1}.java:%L) - %m%n" />
> </layout>
> </appender>
>
> <!-- don't log matchers, this is very high amount of chatter -->
> <category name="org.eclipse.swtbot.swt.finder.matchers">
> <priority value="OFF" />
> </category>
>
> <!--
> don't log the class AbstractSWTBot but all other classes from this package
> -->
> <category name="org.eclipse.swtbot.swt.finder.widgets">
> <priority value="ALL" />
> </category>
>
> <category name="org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot" >
> <priority value="OFF" />
> </category>
>
> <!-- don't log finders, this is moderate chatter -->
> <category name="org.eclipse.swtbot.swt.finder.finders">
> <priority value="OFF" />
> </category>
>
> <category name="org.eclipse.swtbot.swt.finder.keyboard">
> <!-- set to a value higher than debug to turn on. -->
> <priority value="DEBUG" />
> </category>
>
>
> <category name="org.eclipse.swtbot">
> <priority value="ALL" />
> </category>
>
> <root>
> <priority value="DEBUG" />
> <!--appender-ref ref="consoleAppender" /-->
> <appender-ref ref="fileAppender" />
> </root>
>
> </log4j:configuration>
|
|
|
Powered by
FUDForum. Page generated in 0.05992 seconds