You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I thought you would appreciate the little tool I started implementing: api-tuner
It lets you call APIs and run assertions with eye. While many API testing tools exist, I found them all too JSON-centric with lacking or awkward scripting functionality that would allow working with APIs which deal with RDF. With Notation3, RDF becomes the main focus.
Here's an example.
PREFIX : <http://example.com/>PREFIX earl: <http://www.w3.org/ns/earl#>PREFIX tuner: <https://api-tuner.described.at/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX log: <http://www.w3.org/2000/10/swap/log#>PREFIX string: <http://www.w3.org/2000/10/swap/string#>
:getExampleDotCom
a earl:TestCase ;
rdfs:label "Simple GET test" ;
.
# Configure a request
:req
a tuner:Request ;
tuner:url <http://localhost:1080/example.com> ;
tuner:method "GET" ;
.
{
# Execute the request and capture its response
:req tuner:response ?res .
# 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 string:contains "Example Domain" .
} => {
# Use te EARL vocabulary to assert the test passed
:getExampleDotCom earl:outcome earl:passed .
} .
By asserting more instances of tuner:Request and matching them in additional rules you can easily chain requests to test complex workflows.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. I thought you would appreciate the little tool I started implementing: api-tuner
It lets you call APIs and run assertions with eye. While many API testing tools exist, I found them all too JSON-centric with lacking or awkward scripting functionality that would allow working with APIs which deal with RDF. With Notation3, RDF becomes the main focus.
Here's an example.
By asserting more instances of
tuner:Request
and matching them in additional rules you can easily chain requests to test complex workflows.See more examples in the repo: https://github.com/zazuko/api-tuner/tree/master/tests
Beta Was this translation helpful? Give feedback.
All reactions