//
// Copyright (c) 2020 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

= Microprofile GraphQL TCK

image:/tck/high-level.png[link="/master/tck/high-level.png"]

== Dynamic tests

Tests can be added by creating a new test group (folder) in `src/main/resources/tests`.
(You can also do this in the implementation, the use `src/test/resources/tests`)

The folder name will be the name of the test. You can then add the following:

*Mandatory files*

* input.graphql - the graphql query or mutation 
* output.json - the expected json result

*Optional files*

* test.properties - pass properties to the test, supported properties:
** ignore - true or false (default false), will ignore the test if set to true
** priority - the weight (default 999) of the test, this will influence the order in which tests are run
** strict - true or false (default false), will do a strict compare when doing a http://jsonassert.skyscreamer.org/javadoc/org/skyscreamer/jsonassert/JSONAssert.html[JSONAssert]
** failMessage - the error message (default to 'testName failed') to show when the test fail
** expectedHttpStatusCode - if you expect a HTTP response code other than 200
* variables.json - if you need to pass any variables with the request
* httpHeaders.properties - if you need to set any HTTP Headers with the request
* prepare.graphql - a graphql mutation to run before the test to prepare the test data
* cleanup.grapql - a graphql mutation to run after the test to restore the test data

== Running the tests.

The test run will load all tests in `src/test/resources` and will execute then as ordered by the 
priority property.