This wiki is a read-only archive. It was frozen on 3 October 2026 and is no longer edited.

Coverage Analysis

Partition the specification -

Define coverage goals for each section. What test-development resources are available? How critical is it that each section is thoroughly tested? Consequences for incompatible implementations due to low test coverage?

For each partition, provide a mapping between testable assertions and test coverage.

Measure or estimate the extent to which each area of the specification has been tested. Coverage measurements can be expressed in both breadth and depth terms. Breadth measurements are relatively simple to derive. What percentage of assertions are covered by at least one test? Depth measurements are more subjective.

Estimate how thoroughly each assertion is tested. Different coverage goals for different areas of the specification may be appropriate. First cover each feature at a minimal level (breadth-first).

Then focus on providing deeper coverage

Provide a coverage report with the test suite. At a minimum, a simple mapping of tests to areas of the specification. Preferably include counts and averages of the number of tests associated with different areas. Coverage reports help users of the test suite understand its strengths and weaknesses.

Creating Test Assertions

A test assertion should

For example:

Say the normative statement in a specification reads "Service A MAY contain an instance of widget X. Widget X MUST respond to a method call Y by returning an instance of Z."

Test assertions might then read:

TA #1: "Service A contains an instance of widget X." and

TA #2: "Widget X responds to a method call Y by returning an instance of Z."

Although it would be acceptable for assertion #2 to be a literal quotation of the second statement from the specification, including the "MUST" keyword, it would be less acceptable to literally quote the statement in test assertion #1 because "Service A MAY contain an instance of widget X." is not written as a testable assertion. The keyword "MAY" detracts from the assertiveness and testability and is better removed from the expression statement of the assertion.

[Note that the optionality (the "MAY" keyword) of the first normative requirement may need to be preserved in some form as meta-data to instruct the test and test evaluation.]

Note that writing an assertion results in a bold statement of a requirement which can be either true or false. By default (unless stated otherwise) it is expected that an evaluation to "true" corresponds to conformance but that is not to be considered in the test assertion: that is a conformance and test case issue. How a true or false evaluation in a test based on the assertion is interpreted may depend on whether the requirement is optional. Conformance considerations such as levels or profiles may also have relevance. Yet such factors need not affect how the test assertion itself is to be worded.

Do not change the semantics of the specification; do not add interpretation or subtly change the meaning. It is important that the assertion should not attempt to improve the specification statements by adding anything substantive to them - anything other than structure and formatting.

A link between test assertion abstract descriptions of the test environment and the concrete descriptions in test cases can be bridged later with meta-data ('test meta-data') to facilitate the definition of a test harness. Therefore such details are considered out of scope of the test assertion.

There are different objectives for test assertions: firstly to improve quality of specifications and secondly to help test case development. Some users are only interested in the first while others are interested more in the second.

The test assertion should be testable. Describe features, values and attributes to be measured and indications of success or failure. Focus on the details of a single testable statement in the specification, either

A test assertion may have as its main component the prose of a specification's normative statement either copied exactly (literal), reworded (derived) or referenced. Whether the normative statement can be copied exactly can depend on all of the required details being together in the form of a testable expression.

In some cases there may be a need to bring together details for the assertion from several places in the specification, perhaps even from tables or diagrams or artifacts such as schemas, in which case the assertion is said to be 'derived'. A 'derived' assertion can be expressed as a statement of fact which, typically, is expected to be true when the specification normative requirement is satisfied.

The test assertion target is usually obvious as the subject the testable statement. Focus on testable properties or behaviors of a test assertion target. Such qualifications may be one of two types:

Common terms, items and details may occur in several assertions and can be described in detail in one place at the head of the group of assertions. Such recurring details can then be referred to in individual assertions by coded values or keywords. Such keywords or tags may help test suite writers to search for and bring together all assertions related, say, to a particular target or class of target. Further sophistication could be added by organizing and defining test assertion targets as classes, superclasses and subclasses.

For example:

Consider three assertions all relating to a single target, Service A. Several of the assertions relate to components of Service A as their more specific target. Two of the assertions, say, also mention method call Z. There may be a condition in one assertion that if service A contains a widget X then it must respond in a certain way to method call Z. The validity of method call Z may be defined by another of the assertions.

TA #1: When Service A has a widget X which has a method Z then method Z is named getPropertyY.

TA #2: When Service A has a widget X then service A has a property Y.

TA #3: If service A contains a widget X then it responds to method call Z by returning property Y of service A.

There is clearly repetition of: Service A, widget X, property Y and method call Z. Define these items at the head of the assertions and give the items coded names, (also termed 'keywords' or 'tags') and use these names in the assertions perhaps highlighting them, separately formatting them or even linking them to their definitions by , say, hyper-links.

Service_A: This keyword represents service A. Service_A is a service which has properties Y and U and which uses widgets X and T to return properties Y and U.

Widget_X: This keyword represents widget X.

Property_Y: This keyword represents property Y of Service_A.

Method_Z: This keyword represents method Z of Widget_X.

TA #1: When Service_A has a Widget_X which has a Method_Z then Method_Z is named getPropertyY.

TA #2: When Service_A has a Widget_X then Widget_X has a property Y.

TA #3: If Service_A contains a Widget_X then it responds to a call on Method_Z by returning Property_Y of Widget_X.

A search on coded name 'Service_A', say, will then return each of these assertions for which it is the target. Bookmarks on the keywords would allow the mentions of the keywords in the assertions and in the keyword definitions to be made hyper-links to these bookmarks, say.

A More Advanced Structure

A more highly structured assertion may sometimes be required to:

It may be aimed at test assertions being either formally processed according to a particular notation or methodology or even a set of test assertions which are so defined (as predicates or sets of predicates using, say, ADL) as to be processable into tests automatically with software tools.

Such a test assertion may have the following as its main components

Include version information in the test assertion identifier and in references to the specification.

Consider the opportunities there may be for automation. Any formalism for Specification Analysis will have downstream effects on tools that may be designed to automate the process of analysis - as well as the metrics applied to an analysis. Specify this formalism in a pragmatic unambiguous way, such that analysis tools may be unambiguous and useful.

There are languages such as ADL, OCL, XML Schema, Schematron and XQuery which may help to formally describe parts of a specification and its assertions. When these are used then, along with the test assertion predicate, specify which dialect is being used (e.g. @dialect="XQuery", @dialect="OCL", etc.) using meta-data.

For example:

An assertion that Invoice_Subset_A includes [../../../tag/IssueDate IssueDate] may be more precisely represented with an XPath to the [../../../tag/IssueDate IssueDate].

Test assertion ‘http://example.org/v0-3/#Invoice-SubsetA-v1-0-TA#1’ may then state, using a formal representation, the following structured assertion:

<Assertion>

<ID>http://example.org/v0-3/#Invoice-SubsetA-v1-0-TA#1</ID>

<Reference>http://example.org/v0-3/#Invoice-SubsetA-v1-0</Reference>

<Target dialect="Namespace"> http://example.org/v0-3/#Invoice-v1-0</Target>

<Predicate>

<Property>Contains</Property>

<Value dialect="XPath1">/Invoice/[../../../tag/IssueDate IssueDate]</Value>

</Predicate>

<Assertion>

Note in this example how the predicate expression is further divided into a property and a value (property-value-pair). This type of test assertion structure has the features of a 'triple', namely subject (target) + property + value. The subject and property are fixed by controlled vocabulary and the value lies within a range of possible values. In this case the range of values is defined using a scheme, namely XPath but otherwise a datatype such as integer, string or date might be used to constrain the range of values allowed.

If the strings "Contains", "Namespace" and "XPath1" in this example were defined in codelists or an ontology or other controlled vocabulary then this test assertion representation would give the opportunity for automated processing. It might even allowing testing and validation parsing in a manner similar to the use of an XML schema. Of course it may be possible in this example to use an existing technology such as RelaxNG, W3C XML Schema or Schematron or a combination of these for the entire representation of such an assertion or sets of such assertions. Alternatively, artifacts such as Schematron validation schemas could be generated from the test assertions.

There may need to be special considerations when creating test assertions covering parts of a specification involving, tables diagrams, schemas and the like. Note that, effectively, a schema, such as one defined using W3C XML Schema, may equate to a set of test assertions but can actually be used directly for testing. A schema included in a specification may provide the opportunity to go straight to a test, bypassing test assertions but, equally, test assertions may be generated from schemas. Diagrams involving a time element such as sequence diagrams may lend themselves to generation of target behavior assertions (cause-effect or before-and-after assertions). Those involving classes may allow generation of assertions about properties of targets. As with schemas it may be possible to generate tests themselves from diagrams such as UML diagrams, bypassing the assertion step. Diagrams and schemas may be included in a set of test assertions where appropriate.

Outcome Interpretation

A test assertion may define the way to interpret a 'true' value for its predicate in terms of fulfillment of the normative requirement. By default the outcome of 'true' denotes fulfillment of the requirement. If an outcome interpretation element is absent from the TA, the default meaning is:

true --> fulfillment = yes

false --> fulfillment = no

An optional part, separate to a test assertion:

Grouping Construct

Test assertions can be grouped by listing their identifiers or by reference to their tags and tag values. A grouping construct facilitates such listing and provides for the declaration of any variables, etc which have scope over the listed set of test assertions. The same test assertion may be listed in more than one group (a point to beware of if allowing the construct to be used for defining any test assertion parts common to the group).