# OGC API - Tiles Conformance Test Suite

## Scope

This executable test suite (ETS) verifies that an OGC API - Tiles - Part 1 v1.0 instance complies with the Standard.

Conformance testing is a kind of "black box" testing that examines externally visible characteristics or behaviors of the implementation and is independent of any implementation details.

Several conformance classes are defined in the principal specifications. The ones listed below are covered by this test suite:

- Annex A.1: Core - Mandatory tests

- Annex A.1: Core - Conditional tests

- Annex A.3: Tilesets List

- Annex A.4: Dataset Tilesets

- Annex A.5: GeoData Tilesets

- Annex A.8: OpenAPI Specification 3.0

## Test requirements

The documents listed below stipulate requirements that the Executable Test Suite tests for compliance to. Only one of the standards listed below needs to be supported.

1. OGC API - Tiles - Part 1: Core, version 1.0.0, specified in OGC 20-057

## Test suite structure

The test suite definition file (testng.xml) is located in the root package, `org.opengis.cite.ogcapitiles10`.

The Javadoc documentation provides more detailed information about the test methods that constitute the suite.

## How to run the tests

The options for running the test suite are summarized below.

As entry point the API landing page of an OGC API - Tiles instance is expected.

### 1. Integrated development environment (IDE)

Use a Java IDE such as Eclipse, NetBeans, or IntelliJ. Clone the repository and build the project.

Set the main class to run: `org.opengis.cite.ogcapitiles10.TestNGController`

Arguments: The first argument must refer to an XML properties file containing the required test run arguments. If not specified, the default location at `$ {user.home}/test-run-props.xml` will be used.

You can modify the sample file in `src/main/config/test-run-props.xml`

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
    <properties version="1.0">
      <comment>Test run arguments</comment>
        <entry key="iut">https://example.org/landingpage</entry>
        <entry key="tilematrixsetdefinitionuri">http://www.opengis.net/def/tilematrixset/OGC/1.0/WebMercatorQuad</entry>
        <entry key="urltemplatefortiles">https://example.org/landingpage/tiles/WebMercatorQuad/{tileMatrix}/{tileRow}/{tileCol}?f=mvt</entry>
    	<entry key="tilematrix">1</entry>
    	<entry key="mintilerow">0</entry>
    	<entry key="maxtilerow">1</entry>
    	<entry key="mintilecol">0</entry>
    	<entry key="maxtilecol">1</entry>
    </properties>

The TestNG results file (`testng-results.xml`) will be written to a subdirectory in `${user.home}/testng/` having a UUID value as its name.

### 2. Command shell (console)

One of the build artifacts is an "all-in-one" JAR file that includes the test suite and all of its dependencies; this makes it very easy to execute the test suite in a command shell:

`java -jar ets-ogcapi-tiles10-${version}-aio.jar [-o|--outputDir $TMPDIR] [test-run-props.xml]`

### 3. Docker (while at Alpha stage)

The test suite can be built and run by executing the following commands from a linux/MacOS terminal:

     git clone https://github.com/opengeospatial/ets-ogcapi-tiles10.git
     cd ets-ogcapi-tiles10
     mvn clean install -Dsource=8  docker:run -Pdocker

The `mvn` command will start a docker container running the ETS. Once the ETS is running, you can access it at http://localhost:8081/teamengine

Note | This process has been tested with Java 11, Docker 24.0.5, and Maven 3.8.7.

### 4. OGC test harness

Use TEAM Engine, the official OGC test harness. The latest test suite release are usually available at the beta testing facility. You can also build and deploy the test harness yourself and use a local installation.

## Using the REST API

Using the REST API of the TEAM Engine requires some run arguments. These are summarized in the following table. The Obligation descriptor can have the following values: M (mandatory), O (optional), or C (conditional).

Table 1. Test run arguments
Name | Value domain | Obligation | Description
--- | --- | --- | ---
iut | URI | O | A URI that refers to the landing page of the implementation under test. Ampersand ('&') characters must be percent-encoded as '%26'.
tilematrixsetdefinitionuri | URI | M | A URI of a registered tile matrix set definition
urltemplatefortiles | URL template | M | URL template that contains the endpoint for tiles, with specific variable names tileMatrix, tileRow and tileCol
tilematrix | Integer | M | A valid tileMatrix numerical identifier (e.g. 1)
mintilerow | Integer | M | The minimum tile row number (minTileRow) for the tile matrix (e.g. 0)
maxtilerow | Integer | M | The maximum tile row number (maxTileRow) for the tile matrix (e.g. 1)
mintilecol | Integer | M | The minimum tile column number (minTileCol) for the tile matrix (e.g. 0)
maxtilecol | Integer | M | The maximum tile column number (maxTileCol) for the tile matrix (e.g. 1)