Hey! I recently released a tool, Assertible, for automating tests just like this.
Postman is great to get some requests working -- with Assertible you can run the same requests on a schedule, so they're automated and you get alerts when any of them fail.
For you new API, you'll want to focus on two things:
You should be able to test your endpoints and authentication from within your unit tests, look into some libraries for whatever language you're using to get some ideas.
For Automated tests, your running tests against a production or staging environment. This is crucial because unit tests are bound to miss things (any test is, really).
Hope that helps you a bit!
A few days late to the party, but I put together an article recently about 4 common API errors and how to test them.
The "testing" them part is specifically about Assertible, a tool we built for API testing and monitoring, so that part may not be super useful for you (although I'd love to hear your feedback!) -- but the actual errors mentioned in the article are relevant.
Hope this helps! - Cody Reichert
Hey /r/javascript,
I wrote a quick guide on creating a continuous integration, delivery, and testing pipeline with a Node.js app.
<strong>Set up a continuous testing pipeline with Node.js</strong>
<strong>Code repository</strong>
The tutorial goes over the different components of a complete CI pipeline:
The whole workflow is surprisingly easy to set up, so I'd love to hear some feedback on this approach and how other teams manage their CI setups.
What does your CI pipeline look like? Anything you would add or change about this workflow?
What kind of tools are you using (prog language, frontend, backend, CI)? I might be able to offer more detailed help if you give a bit more information about your goals.
Some services that might help:
Assertible https://assertible.com (free w/ paid tiers, Disclaimer I'm the founder of Assertible)
Assertible is a hosted tool that can run tests every time you deploy or on a schedule: https://assertible.com. You can check for links which return 404s, workflows, JSON extraction and valildation, and a quite a bit more)
Postman https://www.getpostman.com/ (free w/ paid tiers)
Postman is a local tool which I've found is very good for exploration but lacks in some areas of automated testing
A few others would be vREST, Ghost Inspector, Paw, Insomnia, Stoplight, and a few others. All which specialize in slightly different aspects of web app testing.
+1 for Postman -- it's a great tool for learning/exploring APIs.
I released a tool for creating automated API tests called Assertible last year. If you're just get started it can be a good intro for how testing/asserting API requests work, so that may be worth checking out too! (Sorry for the self-plug!)
To add one more to the list, I started Assertible a while back for this use-case exactly. Maintaining in-house scripts gets unweildy and since business needs usually change so fast, updating those scripts is difficult.
If you work with Swagger (not required), you can import your API spec directly into Assertible and then start writing custom tests and assertions for your endpoints, set up failure alerts, monitoring, etc. Basically, it does everything I wish my testing scripts would have done, but better :)
I post this sample script for those have the same question:
function main() { let shema = { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "birthday": { "type": "string", "format": "date" }, "address": { "type": "object", "properties": { "street_address": { "type": "string" }, "city": { "type": "string" }, "state": { "type": "string" }, "country": { "type" : "string" } } } } }
let json = { "first_name": "Mike", "last_name": "Washington", "birthday": "1732-02-22", "address": { "street_address": "3200 Mount Vernon Memorial Highway", "city": "Mount Vernon", "state": "Virginia", "country": "United States" } }
let data = { "schema": shema, "json": json }
var options = { method: "post", contentType: "application/json", muteHttpExceptions: true, payload: JSON.stringify(data) };
let responce = UrlFetchApp.fetch("https://assertible.com/json", options);
console.log(Responce code: ${responce.getResponseCode()}
);
console.log(Content: ${responce.getContentText()}
);
}
Here is a good tutorial describing JSON schema basics.
Verify that the schema is the same
https://assertible.com/blog/testing-and-validating-api-responses-with-json-schema
Postman could definitely work well here, it's a great tool!
I just recently released Assertible, which is definitely similar to Postman, but focuses in a bit more on the testing side of things. With Assertible, the use-cases in the OP could be done using test variables, then run manually any time or on an interval. If you're looking for a service, it would work great, though if you're looking to write (code) the tests, then the other recommendations might work better.
(Sorry for the self-plug, but it's completely free and sounds like it could be useful!)
Nice, postman is a great tool! I just recently released Assertible, which is definitely similar to Postman, but focuses in a bit more on the testing side of things.
(Sorry for the self-plug, but it's completely free and sounds like it could be useful!)
Name: Assertible https://assertible.com
Pitch: Continuous testing for web apps
More Details:
Assertible is used to test web services and was recently featured on Product Hunt (https://www.producthunt.com/tech/assertible),
Assertible is dedicated to providing a plug and play experience for the majority of web service testing use cases. We're heavily focused on automated web app testing from GitHub deployments and have integrations for Slack and Heroku.
Testing web services should not be harder than writing it. https://assertible.com.
Are you looking for anything:
Feedback! If you have web-services you would like to test, do not hesitate to email Christopher at
Discount:
We are a totally free service for personal use and will be releasing a paid tier for teams soon. If you enjoy the service message me and we can certainly offer a discount.
If you're deploying your web app using GitHub (or Heroku), you should definitely reach out. We've made a ton of improvements to our GitHub integration recently:
Name: Assertible https://assertible.com
Pitch: Turn-key web service testing
More Details:
Assertible is a new startup dedicated to testing web services and was recently featured on Product Hunt (https://www.producthunt.com/tech/assertible), Unlike competitors Runscope and Postman, Assertible is dedicated to providing a plug and play experience for the majority of testing use cases.
Testing web services should not be harder than writing it. https://assertible.com.
Are you looking for anything:
Feedback! If you have web-services you would like to test, do not hesitate to email Christopher at
Discount:
We are a totally free service right now but will have perks for early adopters.
Name: Assertible
Pitch: Web service testing, simplified
More Details: Assertible is fixing the web one assertion at a time
Assertible is a new startup dedicated to testing web services and was recently featured on Product Hunt (https://www.producthunt.com/tech/assertible), Unlike competitors Runscope and Postman, Assertible is dedicated to providing a plug and play experience for the majority of testing use cases.
Testing web services should not be harder than writing it. https://assertible.com.
Are you looking for anything:
Feedback! If you have web-services you would like to test, do not hesitate to email Christopher at
Discount:
We are a totally free service right now but will have perks for early adopters.