ViewVC logotype

Diff of /trunk/doc/manual.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by siliconforks, Wed Aug 1 13:51:53 2007 UTC revision 41 by siliconforks, Wed Aug 22 18:46:11 2007 UTC
# Line 36  Line 36 
36  </p>  </p>
38  <pre>  <pre>
39  tar jxvf jscoverage-0.1.tar.bz2  tar jxvf jscoverage-0.3.tar.bz2
40  cd jscoverage-0.1  cd jscoverage-0.3/
41  ./configure  ./configure
42  make  make
43  </pre>  </pre>
# Line 118  Line 118 
118  which is used to execute the instrumented code.  which is used to execute the instrumented code.
119  </p>  </p>
121  <h3>2. Executing instrumented code</h3>  <h3>2. Running instrumented code in the web application</h3>
123  <p>  <p>
124  Open <code>jscoverage.html</code> in your web browser.  Open <code>jscoverage.html</code> in your web browser.
# Line 215  Line 215 
215  <h3>3. Generating the coverage report</h3>  <h3>3. Generating the coverage report</h3>
217  <p>  <p>
218  Once you have executed the JavaScript code, you will be instructed to click on the  Once you have executed the JavaScript code, you are instructed to click on the
219  "Summary" tab.  "Summary" tab.
220  </p>  </p>
222  <img src="screenshot4.png" alt="Screenshot">  <img src="screenshot4.png" alt="Screenshot">
224  <p>  <p>
225  From the "Summary" tab, you can click the links to get a detailed view of a JavaScript source file.  You can click the checkbox to show a list of statements missed during execution.
226  </p>  </p>
228  <img src="screenshot5.png" alt="Screenshot">  <img src="screenshot5.png" alt="Screenshot">
230    <p>
231    You can click one of the links to get a detailed view of a JavaScript source file.
232    </p>
234    <img src="screenshot6.png" alt="Screenshot">
236    <h2>Inverted mode</h2>
238    <p>
239    In some situations it may be difficult to execute your code within the
240    JSCoverage "Browser" tab. For example, the code may assume that it is running in
241    the top-level browser window, generating errors if it is executed from within a
242    frame. JSCoverage has an alternative mode of operation, called <dfn>inverted
243    mode</dfn>, which may be useful in this case.
244    </p>
246    <p>
247    Normally you load <code>jscoverage.html</code> in your web browser, and in its
248    "Browser" tab you launch your test code. In inverted mode, you do the
249    opposite: you load your test page directly in your web browser, and from there
250    you launch JSCoverage. To do this you need to add some code to your test page:
251    </p>
253    <pre>
254    window.open("path/to/jscoverage.html");
255    </pre>
257    <p>
258    The <code>"path/to/jscoverage.html"</code> should be a URL pointing to the
259    location of the <code>jscoverage.html</code> file (remember, this will be in the
260    top level of the <var>DESTINATION-DIRECTORY</var> you specified when running
261    the <code>jscoverage</code> executable).
262    </p>
264    <p>
265    You can place this code wherever you like in your page: for example, you could
266    attach it to a button:
267    </p>
269    <pre>
270    &lt;button onclick='window.open("path/to/jscoverage.html");'&gt;Coverage report&lt;/button&gt;
271    </pre>
273    <p>
274    Note that you <em>must</em> use a <code>window.open</code> call; simply making a
275    link to <code>jscoverage.html</code> is not sufficient.
276    </p>
278    <p>
279    An example is located in the <code>doc/example-inverted</code> directory.
280    You can instrument the code and launch the <code>index.html</code> page:
281    </p>
283    <pre>
284    jscoverage doc/example-inverted doc/instrumented-inverted
285    firefox "doc/instrumented-inverted/index.html"
286    </pre>
288    <p>
289    From this page, you select one of the radio buttons and then click the "Coverage
290    report" button to launch the JSCoverage report.
291    </p>
293    <h2>Command line options</h2>
295    <p>
296    The <code>jscoverage</code> program accepts the following options:
297    </p>
299    <dl>
300    <dt><code>-h</code>, <code>--help</code>
301    <dd>Display a brief help message.
302    <dt><code>-V</code>, <code>--version</code>
303    <dd>Display the version of the program.
304    <dt><code>-v</code>, <code>--verbose</code>
305    <dd>Explain what is being done.
306    <dt><code>--exclude=<var>PATH</var></code>
307    <dd>The command
308    <pre>
309    jscoverage --exclude=<var>PATH</var> <var>SOURCE-DIRECTORY</var> <var>DESTINATION-DIRECTORY</var>
310    </pre>
311    copies <var>SOURCE-DIRECTORY</var> to <var>DESTINATION-DIRECTORY</var>
312    recursively, but does not copy <var>SOURCE-DIRECTORY</var>/<var>PATH</var>.
313    <var>PATH</var> must be a complete path relative to <var>SOURCE-DIRECTORY</var>.
314    <var>PATH</var> can be a file or a directory (in which case the directory and
315    its entire contents are skipped). This option may be given multiple times.
316    <dt><code>--no-instrument=<var>PATH</var></code>
317    <dd>The command
318    <pre>
319    jscoverage --no-instrument=<var>PATH</var> <var>SOURCE-DIRECTORY</var> <var>DESTINATION-DIRECTORY</var>
320    </pre>
321    copies <var>SOURCE-DIRECTORY</var> to <var>DESTINATION-DIRECTORY</var>
322    recursively, but does not instrument any JavaScript code in
323    <var>SOURCE-DIRECTORY</var>/<var>PATH</var>. <var>PATH</var> must be a complete
324    path relative to <var>SOURCE-DIRECTORY</var> <var>PATH</var> can be a
325    (JavaScript) file or a directory (in which case any JavaScript files located
326    anywhere underneath the directory are not instrumented). This option may be
327    given multiple times.
328    </dl>
330    <h2>Query string options</h2>
332    <p>
333    When accessing <code>jscoverage.html</code> in a web browser, you may provide a
334    query string consisting of options separated by ampersand (<code>&amp;</code>)
335    or semicolon (<code>;</code>). Any option not containing an equals sign
336    (<code>=</code>) is considered to be a URL which will be loaded in the "Browser"
337    tab.
338    </p>
340    <dl>
341    <dt><code>u=<var>URL</var></code>, <code>url=<var>URL</var></code>
342    <dd>Load <var>URL</var> in the "Browser" tab.  (This is the same as specifying
343    an option without an equals sign.)
344    <dt><code>m=<var>BOOLEAN</var></code>, <code>missing=<var>BOOLEAN</var></code>
345    <dd>Determines whether to initially display the "Missing" column in the "Summary"
346    tab.  <var>BOOLEAN</var> can be
347    <code>true</code>, <code>t</code>, <code>yes</code>, <code>y</code> <code>on</code>, <code>1</code>
348    (to display the "Missing" column), or
349    <code>false</code>, <code>f</code>, <code>no</code>, <code>n</code>, <code>off</code>, <code>0</code>
350    (to hide the "Missing" column).  By default, the "Missing" column is not displayed.
351    </dl>
353  <h2>Caveats</h2>  <h2>Caveats</h2>
355  <ul>  <ul>
# Line 246  Line 369 
370  <address>  <address>
371    Copyright &copy; 2007 siliconforks.com<br>    Copyright &copy; 2007 siliconforks.com<br>
372    Last updated July 8, 2007<br>    Last updated August 20, 2007<br>
373    <a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>    <a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>
374  </address>  </address>

Removed from v.2  
changed lines
  Added in v.41

  ViewVC Help
Powered by ViewVC 1.1.24