**API** **T**ests **U**sing **n3** **R**ules
npm install api-tunerAPI Tests Using n3 Rules
Follow platform-specific instructions to install locally oor in a docker image.
To run api-tuner in GitHub workflow, you add this action to your jobs:
``yaml`
- uses: fabasoad/setup-prolog-action@v1
- curl 7.83+
npm i api-tuner
`sh
> api-tuner --help
Usage: api-tuner [options]
Options:
--lib
--silent Less output
--debug Enable debug output
--raw Output raw results from eye
--base-iri
--version Show version information
--help Show this help message
`
Create a test case file test.n3:
`turtletest.n3
PREFIX earl:
PREFIX tuner:
prefix resource:
PREFIX rdfs:
PREFIX string:
<#getExampleDotCom>
a earl:TestCase ;
rdfs:label "Simple GET test" ;
tuner:formula {
# Execute the request and capture its response
(
# Check the response status code and content type
?res tuner:http_code 200 ;
tuner:header ( "content-type" "text/html" ) ;
.
# Check the body contains the work "Example"
?res tuner:body ?body .
?body string:contains "Example Domain" .
} ;
.
`
Execute the test case:
`sh``
api-tuner test.n3
TBD