Changes between Version 3 and Version 4 of Software/EventBenchConsole


Ignore:
Timestamp:
04/06/11 16:53:57 (13 years ago)
Author:
sherbold
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Software/EventBenchConsole

    v3 v4  
    2121  - Examples: 
    2222   - {{{generateReplayfile d:/replay.xml}}} 
     23 
     24== Translating MFC Messages into Events == 
     25 
     26The messages are aggregated into events using a set of rules defined in XML. The order of the rules in the XML file defines their priority.  
     27 
     28=== Single Messages and Sequences === 
     29 
     30There is a distinction between single messages and whole sequences of messages of the same type. The former may be used for, e.g., {{{WM_LBUTTONDOWN}}} and {{{WM_LBUTTONUP}}}: 
     31{{{ 
     32<msg type="&WM_LBUTTONDOWN;"/> 
     33<msg type="&WM_LBUTTONUP;"/> 
     34}}} 
     35 
     36Sequences of the same message occur, e.g., when scrolling: 
     37{{{ 
     38<msg type="&WM_LBUTTONDOWN;"/> 
     39<msg type="&WM_HSCROLL;" multiple=true/> 
     40<msg type="&WM_LBUTTONUP;"/> 
     41}}} 
     42 
     43The distinction is using the {{{multiple}}} attribute of the {{{msg}}} node, 
     44which is per default false. If it is true, it means ``at least one'', similar to 
     45``+'' in regular expressions.  
     46 
     47=== Storage of messages === 
     48 
     49Each message or message sequence can be stored for later use, e.g., comparisons 
     50with other messages or generating replays. This is done using the {{{store}}} 
     51and {{{storeSeq}}} nodes: 
     52{{{ 
     53<msg type="&WM_LBUTTONDOWN;"> 
     54  <store var="clicked"/> 
     55</msg> 
     56<msg type=&WM_HSCROLL;" multiple=true> 
     57  <storeSeq varSeq="scrolls/> 
     58</msg> 
     59}}} 
     60 
     61When storing a message, the {{{window.hwnd}}} is automatically resolved and its 
     62target string is stored as an attribute of the message ({{{winParamType}}}). If 
     63other parameters contain HWNDs that need to be later on to address a target, 
     64they can be resolved manually and stored as a further parameter: 
     65{{{ 
     66<msg type=&WM_HSCROLL;" multiple=true> 
     67  <storeSeq varSeq="scrolls> 
     68    <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/> 
     69  </storeSeq> 
     70</msg> 
     71}}} 
     72 
     73=== Checking equalities === 
     74 
     75Only matching messages by their type is insufficient. Comparisons between their 
     76parameters are also required. This can be done using {{{equals}}} nodes: 
     77{{{ 
     78<msg type="&WM_LBUTTONDOWN;"> 
     79  <store var="clicked"/> 
     80</msg> 
     81<msg type="&WM_LBUTTONUP;"> 
     82  <equals> 
     83    <paramValue obj="this" param="window.hwnd"/> 
     84    <paramvalue obj="clicked" param="window.hwnd/> 
     85  </equals> 
     86</msg> 
     87}}} 
     88In the example above, the {{{equals}}} node compares whether the value of the 
     89parameter ``window.hwnd'' is equal for the stored variable ``clicked'' and the 
     90current message itself, i.e., ``this''.  
     91 
     92In general, each {{{equals}}} node has the same structure: 
     93{{{ 
     94<equals> 
     95  termNode1 
     96  termNode2 
     97</equals> 
     98}}} 
     99There are four types of term nodes: 
     100 1. {{{paramValue}}}: of the messages (example above) 
     101 1. {{{constValue}}}: constant value, e.g., {{{<constValue value="Button"/>}}} 
     102 1. {{{winInfoValue}}}: information about the target of the message. 
     103  - {{{<winInfoValue obj="this" winParam="class"/>}}} for the class of the target 
     104  - {{{<winInfoValue obj="this" winParam="hwnd"/>}}} for the HWND 
     105  - {{{<winInfoValue obj="this" winParam="resourceId"/>}}} for the resource Id. 
     106 1. {{{msgInfoValue}}}: information about the type and target of the message. 
     107  - {{{<msgInfoValue obj="this" msgParam="type"/>}}} for the type of the message (its integer) 
     108  - {{{<msgInfoValue obj="this" msgParam="target"/>}}} for the target of the message (its string representation) 
     109 
     110The comparison of sequence variables is not yet implemented! 
     111 
     112=== Generation of replay sequences === 
     113If a message sequence has been successfully matched to a rule, a replay sequence 
     114is generated. This is done using {{{genMsg}}} and {{{genMsgSeq}}} nodes. 
     115 
     116The first way to generate a replay message is to directly replay a message that 
     117has been stored during the matching phase: 
     118{{{ 
     119<genMsg delay="100"> 
     120  <storedVar obj=clicked"/> 
     121</genMsg> 
     122}}} 
     123The delay attribute signifies that the replaying tool pauses for 100 ms after 
     124sending the message stored in the variable ``clicked''.  
     125 
     126The second way is to ``construct'' it: 
     127{{{ 
     128<genMsg delay="100"> 
     129  <type> 
     130    <msgInfoValue obj="cmd" msgParam="type"/> 
     131  </type> 
     132  <target> 
     133    <msgInfoValue obj="cmd" msgParam="target"/> 
     134  </target> 
     135  <LPARAM> 
     136    <paramValue obj="cmd" param="sourceDesc"/> 
     137  </LPARAM> 
     138  <WPARAM> 
     139    <paramValue obj="cmd" param="WPARAM"/> 
     140  </WPARAM> 
     141</genMsg> 
     142}}} 
     143The type needs to be an integer. The target needs to be a target string.  
     144The LPARAM and WPARAM are both optional, their default values are 0. They can be 
     145either numerical or target strings. Furthermore, it is possible to define the 
     146HI and LO word of them separatly: 
     147{{{ 
     148<LPARAM> 
     149  <LOWORD> 
     150    value 
     151  </LOWORD> 
     152  <HIWORD> 
     153    value 
     154  </HIWORD> 
     155</LPARAM> 
     156}}} 
     157 
     158The value types are the same that can be used as terms for {{{equals}}} nodes.  
     159 
     160To generate message sequences, the {{{genMsgSeq}}} node is used: 
     161{{{ 
     162<genMsgSeq delay="20"> 
     163  <type> 
     164    <constValue value="&TBM_SETPOS;"/> 
     165  </type> 
     166  <target> 
     167    <seqValue seqObj="scrolls" param="scrollBarTarget"/> 
     168  </target> 
     169  <LPARAM> 
     170    <constValue value="1"/> 
     171  </LPARAM> 
     172  <WPARAM> 
     173    <seqValue seqObj="scrolls" param="scrollPos"/> 
     174  </WPARAM> 
     175</genMsgSeq> 
     176}}} 
     177The three value types used for equals are allowed. However, either the 
     178type or the target must be of a {{{seqValue}}}, otherwise the 
     179creation will fail. In case more than one {{{seqValue}}} variable is used, 
     180e.g., a different one for the LPARAM than for the target, both sequences must 
     181have the same length.  
     182