02/11/2019 Featured Cody Reichert

Automated API testing with an OpenAPI or Swagger specification just got a lot easier with Assertible's new sync feature. Read below to learn about how it works and how to get started today.

Generating automated tests for your API from an OpenAPI specification has historically been a difficult task. Keeping tests in sync with changes to a spec was even more tedious. These are the big problems we're working on at Assertible and today we're excited to announce our newest feature: sync.

Syncing OpenAPI specification with Assertible tests

Sync allows you to update your Assertible tests when your spec changes. That's right! You no longer have to manually update your tests after adding new parameters or changing the response of your API. Here's a few things we'll go over in this post:

  1. What is sync, and how does it work?
  2. What data gets synced?
  3. Can I use this today?
  4. What's planned for the future?

What is sync, and how does it work?

When you get started with Assertible, you can import an OpenAPI or Swagger specification to generate API tests. Now, after you make changes to your spec, sync will propogate those changes to all of your Assertible tests. Here's a few scenarios where this is useful:

  • A response body is updated with a new or removed field.
  • A query parameter is added or removed from an operation.
  • A new endpoint or method is added to your API.

In all of these cases, sync will save you from doing manual work to update your tests. Using algorithms to detect unique operations, Assertible is able to determine which tests need to be updated. This means that sync will work even if you have multiple tests for the same operation. Check out the docs for more on how sync works.

Did you know? Assertible also supports syncing with a Postman collection .

What data gets synced?

Assertible tries to import as much information as possible from your specification, like the endpoints, methods, variables, and more. This same data is checked for changes during sync. When changes are detected, they are applied to the applicable tests.

Several fields are checked during import and sync (see the full list in the docs):

  • Test name (using the summary field)
  • Endpoint
  • HTTP Method
  • Path variables
  • Query parameters (optional and required parameters)
  • Request headers (optional and required headers)
  • Sample request body data
  • Response body schema (JSONSchema assertions)

This is particularly useful when changes to the response body for an operation are changed. Assertible creates and updates JSONSchema assertions for your API responses, making it trivial to test the latest version of your API.

Learn more about syncing your OpenAPI, Swagger, or Postman specification.

Can I use this today?

Yes! Sync is available for everyone and you can use it today. This has been one of our most highly requested features, so please try it out and let us know what you think on Twitter or by sending us a message.

How to use sync

If you have previously imported your spec from a URL, you can simply sync it from the Imports page .

Sync is the default behavior when importing new tests from an OpenAPI or Swagger spec to an existing service. After you've created your web service, your spec can be synced from the Import new tests page:

Syncing OpenAPI specification with Assertible tests

On this page, you can import your specification from a URL or by uploading a file. Assertible will show a preview of all the new and existing tests found in the spec. New operations will show a star icon: . Existing tests will show a sync icon: .

Syncing OpenAPI specification with Assertible tests

That's all you need to do! Confirm the import and Assertible will create and update your API tests. You can also choose to sync only specific operations, and optionally run all of your tests after the update.

What's planned for the future?

Sync takes care of a ton of use-cases, and makes everyones job easier. But there's still many things we want to do, and we want to hear what features you need - message us! We're constantly coming across new use-cases, so your input is valuable. Here's the next few things we have in the pipeline:

  • Automatic syncing for hosted specifications (e.g., from a URL or in a GitHub repository).
  • Automatic versioning of specifications on GitHub that change in commits or pull requests.

Supporting these workflows will be a huge improvement to testers and developers in charge of keeping the tests up to date and ideally provide a fully automated solution that requires minimal intervention. Sign up for a free accout and try out sync today!

:: Cody Reichert

Categories

The easiest way to test and
monitor your web services

Define and test your web service with Assertible Track and test API deployments across environments Schedule API monitoring and failure alerts

Reduce bugs in web applications by using Assertible to create an automated QA pipeline that helps you catch failures & ship code faster.

Sign up for free