Skip to content

Commit

Permalink
Add steps to execute tests with prepare-chunk
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Spalek <[email protected]>
  • Loading branch information
Spalek committed May 6, 2020
1 parent d460e9d commit b975771
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
4 changes: 3 additions & 1 deletion v2.0/Developer_manuals/BaseX_ETS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,12 @@ Once the listener is implemented, the whole generation of the
[[the-prepare-chunk-document]]
=== The prepare-chunk document
A prepare-chunk.xq document is optional but can be used to preprocess testdata.

Example usage: Prepare a spatial index and extract all objects with erroneous geometry before executing the tests.
[NOTE]
======================================
* For every given chunk, prepare-chunk.xq will be executed.
* The name of the chunk is passed to the document by the variable `$dbName`.
* The name of the chunk is passed to the document through the variable `$dbName`.
======================================

[[spatial-tests]]
Expand Down
11 changes: 11 additions & 0 deletions v2.0/Developer_manuals/BaseX_ETS_GUI.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ declare variable $etsFile external := $projDir || file:dir-separator() || "ets-t

Executing the XQuery should now execute the test suite.

There are additional steps, in case the testproject uses a prepare-chunk document (see link:#the-prepare-chunk-document[below] for more information). Here is an example of necessary steps before executing the XQuery document:

* Run the query `db:create("etf-test-000-isolated", <dummy/>, "isolate-db.xml")` to create a database where erroneous objects will be stored.
* Set three external variables:
** `$dbName = <name_of_your_database>`
** `$isolate:dbName = etf-test-000-isolated`
** `$isolate:dbNames = etf-test-000-isolated`
* Open and run the prepare-chunk document

Executing the XQuery document should now execute the test suite.

==== Best practices

During the development of a test suite, it may be handy to compile a
Expand Down
37 changes: 36 additions & 1 deletion v2.0/Developer_manuals/Developing_Executable_Test_Suites.html
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,38 @@ <h4 id="_executing_tests">3.2.2. Executing tests</h4>
<div class="paragraph">
<p>Executing the XQuery should now execute the test suite.</p>
</div>
<div class="paragraph">
<p>There are additional steps, in case the testproject uses a prepare-chunk document (see <a href="#the-prepare-chunk-document">below</a> for more information). Here is an example of necessary steps before executing the XQuery document:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Run the query <code>db:create("etf-test-000-isolated", &lt;dummy/&gt;, "isolate-db.xml")</code> to create a database where erroneous objects will be stored.</p>
</li>
<li>
<p>Set three external variables:</p>
<div class="ulist">
<ul>
<li>
<p><code>$dbName = &lt;name_of_your_database&gt;</code></p>
</li>
<li>
<p><code>$isolate:dbName = etf-test-000-isolated</code></p>
</li>
<li>
<p><code>$isolate:dbNames = etf-test-000-isolated</code></p>
</li>
</ul>
</div>
</li>
<li>
<p>Open and run the prepare-chunk document</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Executing the XQuery document should now execute the test suite.</p>
</div>
</div>
<div class="sect3">
<h4 id="_best_practices">3.2.3. Best practices</h4>
Expand Down Expand Up @@ -1469,6 +1501,9 @@ <h3 id="the-prepare-chunk-document">3.7. The prepare-chunk document</h3>
<div class="paragraph">
<p>A prepare-chunk.xq document is optional but can be used to preprocess testdata.</p>
</div>
<div class="paragraph">
<p>Example usage: Prepare a spatial index and extract all objects with erroneous geometry before executing the tests.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
Expand All @@ -1482,7 +1517,7 @@ <h3 id="the-prepare-chunk-document">3.7. The prepare-chunk document</h3>
<p>For every given chunk, prepare-chunk.xq will be executed.</p>
</li>
<li>
<p>The name of the chunk is passed to the document by the variable <code>$dbName</code>.</p>
<p>The name of the chunk is passed to the document through the variable <code>$dbName</code>.</p>
</li>
</ul>
</div>
Expand Down

0 comments on commit b975771

Please sign in to comment.