The Linked Data Platform specification, informally LDP, describes the use of HTTP for accessing, updating, creating and deleting resources from servers that expose their resources as Linked Data. This document describes the conditions that LDP servers must satisfy in order to be conformant with the specification and presents a common format for describing LDP test cases and server results. These test cases both illustrate the features of the specification and can be used for testing conformance.
This document describes a test suite that can be used to evaluate the
conformance of LDP servers to the LDP specification
[[LINKED-DATA-PLATFORM]]. The document also presents the design
principles that guided the development of the test suite, a testing
process, and a common format for describing test cases and server
results.
The purpose of the test cases is to illustrate the
specification features and to help in testing conformance. The
provided set of test cases is "incomplete" in the sense that passing
all the tests does not prove that a given system conforms to the LDP
specification; failing a test does, however, prove that the system
does not conform to the specification.
The presented format is intended to facilitate the use of
tests by LDP server developers, e.g., in a test harness, as well as
the extension of the test suite with new tests. Developers can check
the LDP Primer [[LDP-PRIMER]] for concrete examples of inputs and
expected outputs that can be used for testing.
There will be two types of systems implementing the LDP specification:
In order to cover both types of systems, we do not provide specific input data in the test suite. It is up to the evaluator to define specific input data for a certain system. Evaluators must include these input data along with the results when reporting the results of a certain system.
The LDP specification includes restrictions on LDP servers at the protocol level and at the data level. Currently, the restrictions at the data level are minimal and servers are not forced to have a certain behaviour when processing LDPR representations. Therefore, the test suite evaluates LDP servers at a protocol level; the only exception is in the case of LDPCs, since they are required to include an rdf.type statement in their representation.
It is out of the scope of the test suite to test LDP servers in terms of the restrictions imposed by their underlying data models.
This test suite only covers those absolute requirements present in the LDP specification (as stated by the use of the MUST key word). This set of absolute requirements identifies the core subset of the LDP specification, LDP Core from now on, and any LDP server that satisfies these absolute requirements will be an LDP Core conformant server.
It is out of the scope of this test suite to test other levels of conformance in terms of optional capabilities (e.g., paging).
Furthermore, the LDP specification [[LINKED-DATA-PLATFORM]] contains the following absolute requirements for LDP Core that are not directly testable and, therefore, are not covered by the current test suite:
Instead of defining expected results for tests, which will be dependent on specific implementations, we have defined the assertions to be made over test results. In order to successfully pass a test, all of the assertions must be satisfied.
Separating test outputs and assertions has other benefits: it makes simpler to report tool results and assertions can be made by a third party.
Any test case and its produced results and assertions should be related to those documents that are relevant for it (e.g., specifications, uses cases, etc.).
The LDP Test Cases are defined in this same page, which is annotated using RDFa so that it can be consumed both by persons and machines. The testing process is composed of two steps, depicted in the figure below.
The following vocabularies are reused for describing the testing
artifacts: DOAP (
doap
), Dublin Core (
dc
) [[DC11]], FOAF (
foaf
) [[FOAF]], HTTP Vocabulary in RDF (
ht
) [[HTTP-IN-RDF]], and W3C Test Metadata (
td
) [[TEST-METADATA]].
All the new required entities that are not covered by those
vocabularies have been defined under a new namespace (
tn
). Besides, the LDP test cases have been defined under their own
namespace (
ldptc
).
Next we present the definition of these namespaces and of all the namespaces used in the examples.
cnt: <http://www.w3.org/2011/content#> dc: <http://purl.org/dc/terms/> doap: <http://usefulinc.com/ns/doap#> earl: <http://www.w3.org/ns/earl#> foaf: <http://xmlns.com/foaf/0.1/> ht: <http://www.w3.org/2011/http#> httph: <http://www.w3.org/2011/http-headers#> ldptc: <http://www.w3.org/TR/ldp/TestCases#> td: <http://www.w3.org/2006/03/test-description#> tn: <http://ldp.example.org/NewTestDefinitions#>
A
test case
is defined as an instance of the
td:TestCase
class and it can be further described using the following properties:
rdfs:label
. The human-readable label of the
test.dc:title
. The name of the test.dc:description
. The description of the test.dc:contributor
. The person (foaf:Person
)
contributing the test.td:reviewStatus
. The status of the test;
possible status are: td:unreviewed
, td:approved
or td:rejected
.rdfs:seeAlso
. A link to the specification it
refers to.td:specificationReference
. An excerpt (tn:Excerpt
)
of the specification that is relevant to the test.td:input
. An input (tn:TestInput
)
used in the test.td:precondition
. A precondition that must be
satisfied before running the test.tn:output
. An output
(tn:TestOutput
) to be produced by the test.tn:testProcess
. The list of steps
(tn:Step
) to be performed during the test.tn:testAssertion
. An assertion (tn:TestAssertion
)
to be performed over the test output.
An
excerpt
is defined as an instance of the
tn:Excerpt
class and it can be further described using the following properties:
rdfs:seeAlso
: The document where the excerpt is
included.tn:includesText
. The excerpt from the document.
A
test input
is defined as an instance of the
td:TestInput
class and it can be further described using the following properties:
dc:title
: The name of the test input.dc:description
. The description of the test
input.
A
test output
is defined as an instance of the
td:TestOutput
class and it can be further described using the following properties:
dc:title
: The name of the test output.dc:description
. The description of the test
output.tn:fromStep
. The step in
the process in which the output is produced.
In the LDP test cases, test outputs are expected to be HTTP responses
(
ht:Response
).
A
step
in the test process is defined as an instance of the
td:Step
class and it can be further described using the following properties:
dc:description
. The description of the step.tn:usesInput
. A test
input used in the step.
In the LDP test cases, steps are expected to be HTTP requests (
ht:Request
).
A
test
assertion
is defined as an instance of the
td:TestAssertion
class and it can be further described using the following properties:
dc:title
: The name of the test assertion.dc:description
. The description of the test
assertion.tn:outputAsserted
. An output
under assertion.The following example contains the description of one of the LDP test cases.
:TCR1 a td:TestCase; rdfs:label "TC-R1"; dc:title "GET on an LDPR"; dc:description "Tests making a GET request on an existing LDPR"; dc:contributor :RaulGarciaCastro; td:reviewStatus td:unreviewed; rdfs:seeAlso <http://www.w3.org/TR/ldp/>; td:specificationReference [ a tn:Excerpt; rdfs:seeAlso <http://www.w3.org/TR/ldp/>; tn:includesText "4.2.8 LDPR server responses MUST use entity tags (either weak or strong ones) as response ETag header values.". ], [ a tn:Excerpt; rdfs:seeAlso <http://www.w3.org/TR/ldp/>; tn:includesText "4.2.10 LDPR servers MUST advertise their LDP support by exposing a HTTP Link header with a target URI of http://www.w3.org/ns/ldp/Resource, and a link relation type of type (that is, rel="type") in all responses to requests made to the resource's HTTP Request-URI. [...]". ], [ a tn:Excerpt; rdfs:seeAlso <http://www.w3.org/TR/ldp/>; tn:includesText "4.3.1 LDPR servers MUST support the HTTP GET Method for LDPRs.". ]; td:input :TCR1-I1-LDPR-URI; td:precondition "The LDP server contains an LDPR at <LDPR URI>"; tn:output :TCR1-O1-Response-1-GET; tn:testProcess (:TCR1-RQ1-GET-LDPR-URI); tn:testAssertion :TCR1-A1-Response-1-GET. :RaulGarciaCastro a foaf:Person; rdfs:label "Raúl García-Castro"; owl:sameAs <http://www.garcia-castro.com/#me>. :TCR1-I1-LDPR-URI a tn:TestInput; dc:title "<LDPR URI>"; dc:description "The URI of an LDPR". :TCR1-O1-Response-1-GET a tn:TestOutput; a ht:Response; tn:fromStep :TCR1-RQ1-GET-LDPR-URI; dc:title "<Response 1 GET>"; dc:description "The response of the GET request in step 1". :TCR1-RQ1-GET-LDPR-URI a tn:Step; a ht:Request; dc:description "GET <LDPR URI>"; tn:usesInput :TCR1-I1-LDPR-URI. :TCR1-A1-Response-1-GET a tn:TestAssertion; tn:outputAsserted :TCR1-O1-Response-1-GET; dc:title "GET correct"; dc:description """[Status-Line].Status-Code = 2xx [response-header].ETag exists [response-header].Link includes ldp:Resource; rel="type"""".
A
test
execution
is defined as an instance of the
tn:TestExecution
class and it can be further described using the following properties:
tn:testExecuted
. The test
case (td:TestCase
) used in the execution.tn:subjectTested
. The subject (doap:Project
)
tested.dc:date
. The date when the test was executed.tn:inputUsed
. The input value (tn:TestInputValue
)
used in the execution.tn:outputProduced
. The output value (tn:TestOutputValue
)
produced in the execution.
A
test
input value
is defined as an instance of the
tn:TestInputValue
class and it can be further described using the following properties:
tn:relatedInput
. The input
in the test definition (tn:TestInput
) for which the
value is defined.tn:inputValue
. The specific input defined for
the execution.
A
test
output value
is defined as an instance of the
tn:TestOutputValue
class and it can be further described using the following properties:
tn:relatedOutput
. The output
in the test definition (tn:TestOutput
) for which the
value is defined.tn:outputValue
. The specific output defined for
the execution.
In the LDP test cases, test output values are expected to be HTTP
responses (
ht:Response
).
The following example contains the description of one test execution.
:TCR1-Execution a tn:TestExecution; tn:testExecuted ldptc:TCR1; tn:subjectTested :SomeServer; dc:date "2013-03-30T09:30:10"; tn:inputUsed [ a tn:TestInputValue ; tn:relatedInput :TCR1-I1-LDPR-URI ; tn:inputValue <http://www.example.org/MyResource> . ]; tn:outputProduced [ a tn:TestOutputValue ; tn:relatedOutput :TCR1-O1-Response-1-GET ; tn:outputValue :TCR1-Exec-Response-1-GET . ]. :SomeServer a doap:Project; doap:name "Sample server". :TCR1-Exec-Response-1-GET a ht:Response; ht:httpVersion "1.1"; dc:date "2013-03-30T09:30:10"; ht:sc <http://www.w3.org/2011/http-statusCodes#OK>; ht:statusCodeValue "200"; ht:reasonPhrase "OK"; ht:headers ( [ a ht:ResponseHeader; ht:hdrName httph:etag; ht:fieldName "ETag"; ht:fieldValue "hd73hck43". ] [ a ht:EntityHeader; ht:hdrName httph:content-type; ht:fieldName "Content-Type"; ht:fieldValue "text/turtle; charset=utf-8". ] ); ht:body [ a cnt:ContentAsText ; cnt:chars """ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix dc: <http://purl.org/dc/terms/>. @prefix ldp: <http://www.w3.org/ns/ldp#>. <http://example.org/MyResource> a ldp:Resource; dc:title "My LDP resource". """; cnt:characterEncoding "UTF-8". ].
An
assertion
is defined as an instance of the
earl:Assertion
class and it can be further described using the following properties:
earl:subject
.The subject (doap:Project
)
asserted.earl:test
. The test
case (td:TestCase
) to which the assertion refers to.tn:fromTestExecution
. The test execution (td:TestExecution
)
used in the assertion.dc:date
. The date when the assertion was
performed.earl:assertedBy
. The validator (doap:Project
)
that makes the assertion.
earl:mode
.
The execution mode of the validator. In this case it will always be
earl:automatic
.earl:result
. The outcome value (earl:OutcomeValue
)
of the assertion.The following example contains the description of one test assertion.
:TCR1-Assertion-SomeServer a earl:Assertion; earl:subject sr:SomeServer; earl:test ldptc:TCR1; tn:fromTestExecution sr:TCR1-Execution; dc:date "2013-03-30T09:30:10"; earl:assertedBy :Validator; earl:mode: earl:automatic; earl:result [ a earl:OutcomeValue ; earl:outcome earl:passed . ]. :Validator a doap:Project; doap:name "Some validator".
These tests involve only LDPRs.
Tests making a GET request on an existing LDPR.
Contributor: Raúl García-Castro
Status: Unreviewed
Tests making a HEAD request on an LDPR.
Contributor: Raúl García-Castro
Status: Unreviewed
Hypertext Transfer Protocol - HTTP/1.1:
Tests making an OPTIONS request on an LDPR.
Contributor: Raúl García-Castro
Status: Unreviewed
These tests involve LDP-BCs and LDPRs.
Tests making a GET request on an empty LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a GET request on a non-empty LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a POST request of an LDP-NR on an LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a POST request of an LDP-RS on an LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a HEAD request on an LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
Hypertext Transfer Protocol - HTTP/1.1:
Tests making a OPTIONS request on an LDP Basic Container.
Contributor: Fernando Serena
Status: Unreviewed
These tests involve LDP-DCs and LDPRs.
Tests making a GET request on an empty LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a GET request on a non-empty LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a POST request of an LDP-NR on an LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a POST request of an LDP-RS on an LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a HEAD request on an LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
Hypertext Transfer Protocol - HTTP/1.1:
Tests making a OPTIONS request on an LDP Direct Container.
Contributor: Fernando Serena
Status: Unreviewed
These tests involve LDP-ICs and LDPRs.
Tests making a GET request on an empty LDP Indirect Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a GET request on a non-empty LDP Indirect Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a POST request of an LDP-RS on an LDP Indirect Container.
Contributor: Fernando Serena
Status: Unreviewed
Tests making a HEAD request on an LDP Indirect Container.
Contributor: Fernando Serena
Status: Unreviewed
Hypertext Transfer Protocol - HTTP/1.1:
Tests making a OPTIONS request on an LDP Indirect Container.
Contributor: Fernando Serena
Status: Unreviewed