zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #17784
[Merge] lp:~zorba-coders/zorba/fix_bug_918173 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_918173 into lp:zorba.
Commit message:
- fix for lp:918173
- updated the results according to the latest version of 2011/QT3-test-suite/ReportingResults/results.xsd
- added the reporting:W3C-reporting function that generates a submission report for W3C
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #918173 in Zorba: "add auto generation of the FOTS conformance reports to lp:zorba"
https://bugs.launchpad.net/zorba/+bug/918173
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_918173/+merge/146465
- fix for lp:918173
- updated the results according to the latest version of 2011/QT3-test-suite/ReportingResults/results.xsd
- added the reporting:W3C-reporting function that generates a submission report for W3C
--
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_918173/+merge/146465
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots_driver/FOTSZorbaManifest.xml'
--- test/fots_driver/FOTSZorbaManifest.xml 2012-11-14 14:02:58 +0000
+++ test/fots_driver/FOTSZorbaManifest.xml 2013-02-04 16:53:36 +0000
@@ -1,66 +1,59 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<FOTS-test-suite-result xmlns="http://www.w3.org/2010/09/qt-fots-catalog">
- <implementation name="Zorba" version="trunk" anonymous-result-column="false">
- <organization name="http://www.zorba-xquery.com" anonymous="false"/>
- <submitter name="Sorin Nasoi" email="spungi@xxxxxxxxx"/>
- </implementation>
- <dependencies-satisfied>
- <dependency type="feature" value="collection-stability" satisfied="true"/> <!-- Is this correct? -->
- <dependency type="feature" value="directory-as-collection-uri" satisfied="true"/> <!-- Is this correct? -->
- <dependency type="feature" value="higherOrderFunctions" satisfied="false"/>
- <dependency type="feature" value="moduleImport" satisfied="true"/>
- <dependency type="feature" value="namespace-axis" satisfied="false"/> <!-- Is this correct? -->
- <dependency type="feature" value="schema-location-hint" satisfied="false"/> <!-- Is this correct? -->
- <dependency type="feature" value="schemaAware" satisfied="true"/>
- <dependency type="feature" value="schemaImport" satisfied="true"/>
- <dependency type="feature" value="schemaValidation" satisfied="true"/>
- <dependency type="feature" value="staticTyping" satisfied="false"/>
- <dependency type="feature" value="xpath-1.0-compatibility" satisfied="true"/> <!-- Is this correct? -->
-
- <dependency type="spec" value="XP10 XQ10" satisfied="true"/>
- <dependency type="spec" value="XP10+" satisfied="true"/>
- <dependency type="spec" value="XP20 XQ10" satisfied="true"/>
- <dependency type="spec" value="XP20+" satisfied="true"/>
- <dependency type="spec" value="XP30+" satisfied="true"/>
- <dependency type="spec" value="XP30+ XQ10+" satisfied="true"/>
- <dependency type="spec" value="XP30+ XQ30+" satisfied="true"/>
- <dependency type="spec" value="XQ10" satisfied="true"/>
- <dependency type="spec" value="XQ10 XP20" satisfied="true"/>
- <dependency type="spec" value="XQ10+" satisfied="true"/>
- <dependency type="spec" value="XQ10+ XP20+" satisfied="true"/>
- <dependency type="spec" value="XQ10+ XP30+" satisfied="true"/>
- <dependency type="spec" value="XQ30" satisfied="true"/>
- <dependency type="spec" value="XQ30 XP30" satisfied="true"/>
- <dependency type="spec" value="XQ30+" satisfied="true"/>
- <dependency type="spec" value="XQ30+ XP30+" satisfied="true"/>
- <dependency type="spec" value="XT30+" satisfied="false"/>
-
- <dependency type="xml-version" value="1.0" satisfied="true"/>
- <dependency type="xml-version" value="1.0:4-" satisfied="true"/>
- <dependency type="xml-version" value="1.0:5+ 1.1" satisfied="false"/>
- <dependency type="xml-version" value="1.1" satisfied="false"/>
-
- <dependency type="language" value="de" satisfied="false"/> <!-- Is this correct? -->
- <dependency type="language" value="en" satisfied="true"/>
- <dependency type="language" value="xib" satisfied="false"/> <!-- Is this correct? -->
-
- <!-- Are these correct? -->
- <dependency type="limits" value="year_lt_0" satisfied="true"/>
- <dependency type="calendar" value="CB" satisfied="true"/>
- <dependency type="format-integer-sequence" value="Α" satisfied="true"/>
- <dependency type="format-integer-sequence" value="α" satisfied="true"/>
- <dependency type="format-integer-sequence" value="١" satisfied="true"/>
- <dependency type="format-integer-sequence" value="①" satisfied="true"/>
- <dependency type="format-integer-sequence" value="⑴" satisfied="true"/>
- <dependency type="format-integer-sequence" value="⒈" satisfied="true"/>
- <dependency type="format-integer-sequence" value="一" satisfied="true"/>
- <dependency type="format-integer-sequence" value="ﯴ" satisfied="true"/>
- <dependency type="default-language" value="en" satisfied="true"/>
- <dependency type="unicode-normalization-form" value="FULLY-NORMALIZED" satisfied="true"/>
- <dependency type="unicode-normalization-form" value="NFD" satisfied="true"/>
- <dependency type="unicode-normalization-form" value="NFKC" satisfied="true"/>
- <dependency type="unicode-normalization-form" value="NFKD" satisfied="true"/>
- <dependency type="xsd-version" value="1.0" satisfied="true"/>
- <dependency type="xsd-version" value="1.1" satisfied="false"/>
- </dependencies-satisfied>
-</FOTS-test-suite-result>
+<test-suite-result xmlns="http://www.w3.org/2010/09/qt-fots-catalog">
+ <dependency type="feature" value="collection-stability" satisfied="true"/> <!-- Is this correct? -->
+ <dependency type="feature" value="directory-as-collection-uri" satisfied="true"/> <!-- Is this correct? -->
+ <dependency type="feature" value="higherOrderFunctions" satisfied="false"/>
+ <dependency type="feature" value="moduleImport" satisfied="true"/>
+ <dependency type="feature" value="namespace-axis" satisfied="false"/> <!-- Is this correct? -->
+ <dependency type="feature" value="schema-location-hint" satisfied="false"/> <!-- Is this correct? -->
+ <dependency type="feature" value="schemaAware" satisfied="true"/>
+ <dependency type="feature" value="schemaImport" satisfied="true"/>
+ <dependency type="feature" value="schemaValidation" satisfied="true"/>
+ <dependency type="feature" value="staticTyping" satisfied="false"/>
+ <dependency type="feature" value="xpath-1.0-compatibility" satisfied="true"/> <!-- Is this correct? -->
+
+ <dependency type="spec" value="XP10 XQ10" satisfied="true"/>
+ <dependency type="spec" value="XP10+" satisfied="true"/>
+ <dependency type="spec" value="XP20 XQ10" satisfied="true"/>
+ <dependency type="spec" value="XP20+" satisfied="true"/>
+ <dependency type="spec" value="XP30+" satisfied="true"/>
+ <dependency type="spec" value="XP30+ XQ10+" satisfied="true"/>
+ <dependency type="spec" value="XP30+ XQ30+" satisfied="true"/>
+ <dependency type="spec" value="XQ10" satisfied="true"/>
+ <dependency type="spec" value="XQ10 XP20" satisfied="true"/>
+ <dependency type="spec" value="XQ10+" satisfied="true"/>
+ <dependency type="spec" value="XQ10+ XP20+" satisfied="true"/>
+ <dependency type="spec" value="XQ10+ XP30+" satisfied="true"/>
+ <dependency type="spec" value="XQ30" satisfied="true"/>
+ <dependency type="spec" value="XQ30 XP30" satisfied="true"/>
+ <dependency type="spec" value="XQ30+" satisfied="true"/>
+ <dependency type="spec" value="XQ30+ XP30+" satisfied="true"/>
+ <dependency type="spec" value="XT30+" satisfied="false"/>
+
+ <dependency type="xml-version" value="1.0" satisfied="true"/>
+ <dependency type="xml-version" value="1.0:4-" satisfied="true"/>
+ <dependency type="xml-version" value="1.0:5+ 1.1" satisfied="false"/>
+ <dependency type="xml-version" value="1.1" satisfied="false"/>
+
+ <dependency type="language" value="de" satisfied="false"/> <!-- Is this correct? -->
+ <dependency type="language" value="en" satisfied="true"/>
+ <dependency type="language" value="xib" satisfied="false"/> <!-- Is this correct? -->
+
+ <!-- Are these correct? -->
+ <dependency type="limits" value="year_lt_0" satisfied="true"/>
+ <dependency type="calendar" value="CB" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="Α" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="α" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="١" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="①" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="⑴" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="⒈" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="一" satisfied="true"/>
+ <dependency type="format-integer-sequence" value="ﯴ" satisfied="true"/>
+ <dependency type="default-language" value="en" satisfied="true"/>
+ <dependency type="unicode-normalization-form" value="FULLY-NORMALIZED" satisfied="true"/>
+ <dependency type="unicode-normalization-form" value="NFD" satisfied="true"/>
+ <dependency type="unicode-normalization-form" value="NFKC" satisfied="true"/>
+ <dependency type="unicode-normalization-form" value="NFKD" satisfied="true"/>
+ <dependency type="xsd-version" value="1.0" satisfied="true"/>
+ <dependency type="xsd-version" value="1.1" satisfied="false"/>
+</test-suite-result>
=== added file 'test/fots_driver/W3C_submission_template.xml'
--- test/fots_driver/W3C_submission_template.xml 1970-01-01 00:00:00 +0000
+++ test/fots_driver/W3C_submission_template.xml 2013-02-04 16:53:36 +0000
@@ -0,0 +1,17 @@
+<test-suite-result xmlns="http://www.w3.org/2012/08/qt-fots-results">
+ <submission anonymous="false">
+ <created by="Sorin Nasoi"
+ email="sorin.marian.nasoi_at_gmail.com"
+ organization="FLWOR Foundation"
+ on="2013-01-24"/>
+ <test-run test-suite-version="CVS"
+ date-run="2013-01-24"/>
+ <notes/>
+ </submission>
+ <product vendor="FLWOR Foundation"
+ name="Zorba"
+ version="2.8"
+ released="true"
+ open-source="true"
+ language="XQ30"/>
+</test-suite-result>
=== modified file 'test/fots_driver/cli.xq'
--- test/fots_driver/cli.xq 2013-01-31 17:30:51 +0000
+++ test/fots_driver/cli.xq 2013-02-04 16:53:36 +0000
@@ -198,7 +198,7 @@
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod-Literal -e verbose:=false -o result.xml --indent",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e testSetName:=prod-Literal -e testCaseName:=Literals001 -o result.xml --indent",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-and-report -o report.xml --indent",
- "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e resultsFilePath:=failures.xml -e verbose:=false -o report.xml --indent",
+ "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e resultsFilePath:=failures.xml -o results_Zorba_XQ30.xml --indent",
"zorba -f -q /path/to/cli.xq -e mode:=generate-expected-failures -e resultsFilePath:=failures.xml -o ExpectedFailures.xml --indent",
""
), "
")
@@ -331,19 +331,14 @@
r:run-and-report($fotsPath,
$fotsZorbaManifestPath,
$exceptedTestCases,
- $exceptedTestSets,
- (: the reports to W3C are always generated with verbose set to false:)
- fn:false())
+ $exceptedTestSets)
}
case "report"
return
{
- r:report($fotsPath,
- $resultsFilePath,
- $exceptedTestCases,
- $exceptedTestSets,
- xs:boolean($verbose))
+ r:report($fotsZorbaManifestPath,
+ $resultsFilePath)
}
case "generate-expected-failures"
=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq 2013-01-31 18:06:16 +0000
+++ test/fots_driver/environment.xq 2013-02-04 16:53:36 +0000
@@ -133,7 +133,7 @@
: enviroment specified either at the test-set level or at the catalog
: level and is referenced by the test-case.
: @param $envCase the local environment of the test-case, if any.
- : @return the text for thee default element namespace declaration.
+ : @return the text for the default element namespace declaration.
:)
declare function env:decl-def-elem-namespace(
$env as element(fots:environment)?,
=== modified file 'test/fots_driver/feedback.xq'
--- test/fots_driver/feedback.xq 2013-01-31 18:06:16 +0000
+++ test/fots_driver/feedback.xq 2013-02-04 16:53:36 +0000
@@ -97,39 +97,31 @@
$verbose as xs:boolean
) as element(fots:test-case)?
{
- variable $info := "Test case failed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt";
+ variable $info := 'Test case failed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt';
+ variable $status := 'pass';
if ($verbose)
- then {
- let $tmp := $case
- return {
- insert node
- attribute result{'pass'}
- as last into $tmp;
-
- insert node
- attribute comment{$info}
- as last into $tmp;
-
- insert node
- <fots:info>
- {$env}
- <fots:query>{$zorbaQuery}</fots:query>
- {($result/fots:expected-result,
- $result/fots:result,
- $result/fots:errors)}
- </fots:info>
- as last into $tmp;
-
- delete node $tmp/fots:description;
- delete node $tmp/fots:created;
- delete node $tmp/fots:result;
+ then
+ {
+ {
+ (insert node attribute result{$status} as last into $case,
+ insert node attribute comment{$info} as last into $case,
+ insert node
+ <fots:info>
+ {$env}
+ <fots:query>{$zorbaQuery}</fots:query>
+ {$result/descendant::*}
+ </fots:info>
+ as last into $case,
+ delete node $case/fots:description,
+ delete node $case/fots:created,
+ delete node $case/fots:result);
- $tmp
+ $case
}
}
else <fots:test-case name="{data($case/@name)}"
- result="pass"
+ result="{$status}"
comment="{$info}" />
};
@@ -149,54 +141,38 @@
$verbose as xs:boolean
) as element(fots:test-case)?
{
+ let $status := if(exists($result/fots:errors))
+ then 'wrongError'
+ else 'pass'
+ return
if ($verbose)
- then {
- let $tmp := $case
- return {
- insert node
- attribute result{'pass'}
- as last into $tmp;
-
- if (exists($result/fots:errors))
- then
- insert node
- attribute correctError{'false'}
- as last into $tmp;
- else ();
-
- if (exists($result/fots:errors))
- then
- insert node
- attribute comment{$result/fots:errors}
- as last into $tmp;
- else ();
-
- insert node
- attribute executionTime{$duration}
- as last into $tmp;
-
- insert node
+ then
+ {
+ {
+ (insert node attribute result{$status} as last into $case,
+ if (exists($result/fots:errors))
+ then
+ insert node
+ attribute comment{$result/fots:errors}
+ as last into $case
+ else (),
+ insert node attribute executionTime{$duration} as last into $case,
+ insert node
<fots:info>
{$env}
<fots:query>{$zorbaQuery}</fots:query>
{$result/descendant::*}
</fots:info>
- as last into $tmp;
-
- delete node $tmp/description;
- delete node $tmp/created;
- delete node $tmp/fots:result;
-
- $tmp
+ as last into $case,
+ delete node $case/fots:description,
+ delete node $case/fots:created,
+ delete node $case/fots:result);
+
+ $case
}
}
- else if (empty($result/fots:errors))
- then <fots:test-case name="{data($case/@name)}"
- result="pass"
- executionTime="{$duration}" />
else <fots:test-case name="{data($case/@name)}"
- result="pass"
- correctError="{empty($result/fots:errors)}"
+ result="{$status}"
executionTime="{$duration}" />
};
@@ -221,48 +197,39 @@
trace($testSetName, "test set name");
trace("above test case failed", "result");
- variable $info := "Test case passed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt";
+ variable $info := 'Test case passed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt';
+ variable $status := 'fail';
if ($verbose)
- then {
- let $tmp := $case
- return {
- insert node
- attribute result{'fail'}
- as last into $tmp;
-
- if ($expectedFailure)
- then
- insert node
- attribute comment{$info}
- as last into $tmp;
- else ();
-
- insert node
- <fots:info>
- {$env}
- <fots:query>{$zorbaQuery}</fots:query>
- {($result/fots:expected-result,
- $result/fots:result,
- $result/fots:errors)}
- </fots:info>
- as last into $tmp;
-
- delete node $tmp/fots:description;
- delete node $tmp/fots:created;
- delete node $tmp/fots:result;
-
- $tmp
+ then
+ {
+ {
+ (insert node attribute result{$status} as last into $case,
+ if ($expectedFailure)
+ then insert node attribute comment{$info} as last into $case
+ else (),
+ insert node
+ <fots:info>
+ {$env}
+ <fots:query>{$zorbaQuery}</fots:query>
+ {$result/descendant::*}
+ </fots:info>
+ as last into $case,
+ delete node $case/fots:description,
+ delete node $case/fots:created,
+ delete node $case/fots:result);
+
+ $case
}
}
else if ($expectedFailure)
then <fots:test-case name="{data($case/@name)}"
- result="fail"
+ result="{$status}"
comment="{$info}"
executionTime="{$duration}"/>
else <fots:test-case name="{data($case/@name)}"
- result="fail"
+ result="{$status}"
executionTime="{$duration}"/>
};
@@ -282,11 +249,13 @@
trace(data($case/@name), "processing test case :");
trace("Above test case was not run.","");
+ let $status := 'notRun'
+ return
if ($verbose)
then
{
{
- (insert node attribute result {'notRun'} as last into $case,
+ (insert node attribute result {$status} as last into $case,
delete node $case/fots:description,
delete node $case/fots:created);
@@ -295,7 +264,8 @@
}
else
{
- <fots:test-case name="{$case/@name}" result="notRun" />
+ <fots:test-case name="{$case/@name}"
+ result="{$status}" />
}
};
@@ -317,30 +287,25 @@
trace(data($case/@name), "processing test case :");
trace($dependencyError, "Dependency error :");
+ let $status := 'n/a'
+ return
if ($verbose)
- then {
- let $tmp := $case
- return {
- insert node
- attribute result{'not applicable'}
- as last into $tmp;
-
- insert node
- attribute comment{$dependencyError}
- as last into $tmp;
-
- insert node
- <fots:info>{$env}</fots:info>
- as last into $tmp;
-
- delete node $tmp/fots:description;
- delete node $tmp/fots:created;
-
- $tmp
- }
+ then
+ {
+ {
+ (insert node attribute result{$status} as last into $case,
+ insert node attribute comment{$dependencyError} as last into $case,
+ insert node
+ <fots:info>{$env}</fots:info>
+ as last into $case,
+ delete node $case/fots:description,
+ delete node $case/fots:created);
+
+ $case
+ }
}
else
<fots:test-case name="{data($case/@name)}"
- result="not applicable"
+ result="{$status}"
comment="{$dependencyError}" />
};
=== modified file 'test/fots_driver/reporting.xq'
--- test/fots_driver/reporting.xq 2013-01-31 18:06:16 +0000
+++ test/fots_driver/reporting.xq 2013-02-04 16:53:36 +0000
@@ -38,129 +38,92 @@
"http://www.w3.org/2005/xqt-errors";
declare namespace fots =
"http://www.w3.org/2010/09/qt-fots-catalog";
+declare namespace results =
+ "http://www.w3.org/2012/08/qt-fots-results";
+
+declare default element namespace
+ "http://www.w3.org/2012/08/qt-fots-results";
declare namespace ann =
"http://www.zorba-xquery.com/annotations";
(:~
- : Loops through the test-sets, runs then and creates statistics.
+ : Loops through the test-sets, executes them and reports results.
: @param $FOTSCatalogFilePath path to the FOTS catalog file.
: @param $FOTSZorbaManifestPath path to the FOTS Zorba manifest file.
- : @param $testSetPrefixes name/criteria for the test sets( empty string means
- : all).
- : @param $testCasePrefixes name/criteria for the test cases(empty string means
- : all).
- : @param $exceptedTestCases lists of test cases that are not run( empty string
- : means all tests will be run).
- : @param $exceptedTestSets lists of test sets that are not run(empty string
- : means all tests will be run).
- : @param $verbose if set to TRUE it will also output the actual failures.
- : @return a report of tests run.
+ : @param $exceptedTestCases lists of test cases that are not run( empty
+ : sequence means all test cases will be run).
+ : @param $exceptedTestSets lists of test sets that are not run(empty sequence
+ : means all test sets will be run).
+ : @return a report of tests that were executed.
:)
declare %ann:sequential function reporting:run-and-report(
$FOTSCatalogFilePath as xs:string,
$FOTSZorbaManifestPath as xs:string,
$exceptedTestCases as xs:string*,
- $exceptedTestSets as xs:string*,
- $verbose as xs:boolean
+ $exceptedTestSets as xs:string*
)
{
-try {
+ try
{
- variable $FOTSCatalog := doc(trace(resolve-uri($FOTSCatalogFilePath),
- "Path to FOTS catalog.xml set to: "));
-
- variable $catalogBaseURI := resolve-uri(util:parent-folder($FOTSCatalogFilePath));
-
- variable $FOTSZorbaManifest := doc(trace(resolve-uri($FOTSZorbaManifestPath),
- "Path to FOTSZorbaManifest set to:"));
-
- variable $failures := <fots:FOTS-test-suite-result>{
- ( $FOTSZorbaManifest//fots:implementation,
- $FOTSZorbaManifest//fots:dependencies-satisfied,
- driver:run-fots($FOTSCatalogFilePath,
- $FOTSZorbaManifestPath,
- (),
- $exceptedTestSets,
- (),
- $exceptedTestCases,
- '',
- (),
- $verbose,
- '',
- 'run-test-sets')
- )
- }</fots:FOTS-test-suite-result>;
-
- file:write("failures.xml",
- $failures,
- $util:writeXML);
-
- reporting:do-reporting($FOTSCatalog,
- $catalogBaseURI,
- $failures,
- $exceptedTestCases,
- $exceptedTestSets,
- $verbose)
- }
-}
-catch *
-{
- error($err:code,
- $err:description,
- concat("
Please make sure the passed 'fotsPath' points to the ",
- "exact location of the FOTS catalog.xml:
",
- resolve-uri($FOTSCatalogFilePath),
- "
and that the passed 'fotsZorbaManifestPath' points to",
- " a file in the same folder as cli.xq:
",
- resolve-uri($FOTSZorbaManifestPath)))
-}
-};
-
-(:~
- : Loops through the test cases report and creates statistics.
- : @param $pathFOTSCatalog path to the FOTS catalog file.
- : @param $pathResults path to the FOTS results.
- : @param $exceptedTestCases lists of test cases that are not run( empty string
- : means all tests will be run).
- : @param $exceptedTestSets lists of test sets that are not run(empty string
- : means all tests will be run).
- : @param $verbose if set to TRUE it will also output the actual failures.
- : @param $showResult if set to TRUE it will also show the actual result of the
- : Query run.
- : @return a report of tests run.
- :)
-declare %ann:nondeterministic function reporting:report(
- $FOTSCatalogFilePath as xs:string,
- $pathResults as xs:string,
- $exceptedTestCases as xs:string*,
- $exceptedTestSets as xs:string*,
- $verbose as xs:boolean
-) as element(fots:report)
-{
- try {
{
- if (not(file:is-file($pathResults)))
- then
- {
- error($fots-err:errNA,
- "The file results file was not found. Suggestion: use driver:run-fots to generate it or use reporting:run-and-report function.");
- }
- else ();
-
- variable $results := parse-xml(file:read-text($pathResults));
-
variable $FOTSCatalog := doc(trace(resolve-uri($FOTSCatalogFilePath),
"Path to FOTS catalog.xml set to: "));
variable $catalogBaseURI := resolve-uri(util:parent-folder($FOTSCatalogFilePath));
- reporting:do-reporting($FOTSCatalog,
- $catalogBaseURI,
- $results,
- $exceptedTestCases,
- $exceptedTestSets,
- $verbose)
+ variable $FOTSZorbaManifest := doc(trace(resolve-uri($FOTSZorbaManifestPath),
+ "Path to FOTSZorbaManifest set to:"));
+
+ variable $results := driver:run-fots($FOTSCatalogFilePath,
+ $FOTSZorbaManifestPath,
+ (),
+ $exceptedTestSets,
+ (),
+ $exceptedTestCases,
+ '',
+ (),
+ fn:false(),
+ '',
+ 'run-test-sets');
+
+ file:write("results.xml",
+ $results,
+ $util:writeXML);
+
+ reporting:W3C-reporting($results,
+ $FOTSZorbaManifestPath)
+ }
+ }
+ catch *
+ {
+ error($err:code,
+ $err:description,
+ concat("
Please make sure the passed 'fotsPath' points to the ",
+ "exact location of the FOTS catalog.xml:
",
+ resolve-uri($FOTSCatalogFilePath),
+ "
and that the passed 'fotsZorbaManifestPath' points to",
+ " a file in the same folder as cli.xq:
",
+ resolve-uri($FOTSZorbaManifestPath)))
+ }
+};
+
+(:~
+ : Loops through the test sets, executes them and reports results.
+ : @param $FOTSZorbaManifestPath path to the FOTS Zorba manifest file.
+ : @param $resultsFilePath path to the FOTS results file.
+ : @return The W3C conformance submission file.
+ :)
+declare %ann:sequential function reporting:report(
+ $FOTSZorbaManifestPath as xs:string,
+ $resultsFilePath as xs:string
+) as document-node()
+{
+ try
+ {
+ {
+ reporting:W3C-reporting(parse-xml(file:read-text($resultsFilePath)),
+ $FOTSZorbaManifestPath)
}
}
catch *
@@ -169,6 +132,83 @@
}
};
+(:~
+ : Format the W3C conformance report.
+ : @param $results FOTS results file.
+ : @param $FOTSZorbaManifestPath path to the FOTS Zorba manifest file.
+ : @return The W3C conformance submission file.
+ :)
+declare %ann:sequential function reporting:W3C-reporting(
+ $results as document-node()?,
+ $FOTSZorbaManifestPath as xs:string
+) as document-node()
+{
+ try
+ {
+ {
+ if (not(file:is-file(resolve-uri($FOTSZorbaManifestPath))))
+ then
+ {
+ error($fots-err:errNA,
+ "The 'FOTSZorbaManifest.xml' was not found.");
+ }
+ else ();
+
+ variable $FOTSZorbaManifest := parse-xml(file:read-text(resolve-uri($FOTSZorbaManifestPath)));
+
+ variable $CLIBaseURI := resolve-uri(util:parent-folder($FOTSZorbaManifestPath));
+
+ variable $W3CTemplatePath := resolve-uri("W3C_submission_template.xml", $CLIBaseURI);
+
+ if (not(file:is-file($W3CTemplatePath)))
+ then
+ {
+ error($fots-err:errNA,
+ "'W3C_submission_template.xml' file was not found.");
+ }
+ else ();
+
+ variable $W3CTemplate := parse-xml(file:read-text($W3CTemplatePath));
+
+ (: add dependecies:)
+ (insert nodes
+ for $dependency in $FOTSZorbaManifest/fots:test-suite-result/fots:dependency
+ return <dependency type="{$dependency/@type}"
+ value="{$dependency/@value}"
+ satisfied="{$dependency/@satisfied}"/>
+ as last into $W3CTemplate/results:test-suite-result/results:product,
+
+ (: add test set results:)
+ insert nodes
+ for $testSet in $results/fots:test-cases/fots:test-set
+ return
+ <test-set name="{$testSet/@name}">
+ {
+ for $testCase in $testSet/fots:test-case
+ return
+ if(exists($testCase/@comment))
+ then
+ <test-case name="{$testCase/@name}"
+ result="{$testCase/@result}"
+ comment="{$testCase/@comment}" />
+ else
+ <test-case name="{$testCase/@name}"
+ result="{$testCase/@result}" />
+ }
+ </test-set>
+ as last into $W3CTemplate/results:test-suite-result);
+
+ $W3CTemplate
+ }
+ }
+ catch *
+ {
+ error($err:code,
+ $err:description,
+ concat("
Please make sure there is a 'W3C_submission_template.xml'",
+ " file in the same folder as cli.xq"))
+ }
+};
(:~
: Loops through the test-sets and creates statistics.
Follow ups