Jump to: navigation, search


< Lyo

Page will gather various notes about how a LDP test suite may be implemented, with looking not just at the general needs of LDP server implementations but also how it can be leveraged for OSLC needs.

Options being explored

Sample test:

	@Test(groups = { MUST }, dataProvider = MediaTypeDataProvider.NAME, dataProviderClass = MediaTypeDataProvider.class)
	public void testCreateResource(String mediaType) throws URISyntaxException {
		Model model = ModelFactory.createDefaultModel();
		Resource resource = model.createResource("", model.createResource("http://example.com/ns#Bug"));
		resource.addProperty(model.createProperty("http://example.com/ns#severity"), "High");
		resource.addProperty(DC.title, "A very serious bug.");
		resource.addProperty(DC.description, "Server won't start.");

		Response postResponse = RestAssured
		        .given().contentType(mediaType).body(model, new RdfObjectMapper())
		        .when().post(new URI(containerUri));

		String location = postResponse.getHeader(LOCATION);

		// Test it's a valid URI. Throws a URISyntaxException if not.
		new URI(location);

Sample test:

    frisby.create('MUST: POST new resource in text/turtle')
        .addHeader('Content-Type', 'text/turtle')
        .post(containerURI, null, {body: bugTurtle})
        .after(function(err, res, body) {
            createdResourceURI = res.headers['location'];

Pros and cons



  • Tests can be organized into groups (for instance, MUST/SHOULD/MAY or by capability like "Container Tests" or "Paging")
    • Groups can be included or excluded for test runs
    • Groups can be used in reporting
  • Tests can easily be parameterized (for instance, by media type)
  • Flexible and extensible reporting of results
  • Jena provides a common API for dealing with various RDF media types (Turtle, JSON-LD, RDF/XML)
  • IDE integration


  • Tests are pass/fail. No native support for "warnings," for instance if a SHOULD or MAY test fails, although it is possible to skip tests either using annotations or at runtime with SkipException.

Frisby.js + jasmine-node


  • Lighter weight. More concise code
  • Might be more interesting to community


  • Less flexible reporting
  • Difficult to chain HTTP calls in a single test, for instance GET + PUT (Frisby.js limitation)
  • Tests are pass/fail. No support for "warnings."

Still to explore:

  • Debugging test
  • RDF libraries: alternatives to rdfstore-js or N3.js?
  • Generating HTML reports with ant and jasmine-node --junitreport