Running tests
Introduction to running Snyk tests
You can use Snyk to test your code in different ways:
Run tests manually: by using the Snyk CLI, the Snyk Web UI, and the Snyk API
Run tests automatically: after Project import or using the
snyk monitor
CLI command or using PR Checks to scan new PRs
Run tests manually
Run tests manually with the CLI
You can use the following commands to run tests with the Snyk CLI:
Scan open-source code with
snyk test
.Scan application code with
snyk code test
.Scan container images with
snyk container test
.Scan Infrastructure as Code (IaC) files with
snyk iac test
.
See Getting started with the CLI for details.
Run tests manually with the Snyk Web UI
A test is run when you import a Snyk Project (see Import a Project) or click the Retest now button on a Project in the Overview tab. During retests, Snyk fetches the assets that need to be scanned for Snyk to find any new issues.
See Exploring the Snyk Web UI for details.
Run tests manually with the API
Tests are counted when calls are made to the https://snyk.io/api/v1/test endpoint.
See the API documentation for details.
Run tests automatically
Run tests automatically with the Snyk Web UI
After you import a Project, Snyk automatically runs periodic scans on that Project, to see if your code is affected by newly disclosed vulnerabilities.
Run tests automatically with snyk monitor
Use the snyk monitor
CLI command to create a snapshot of a project on the Snyk website that will be continuously monitored for new vulnerabilities.
See Monitor your projects at regular intervals for details.
Run tests automatically using PR Checks
Snyk can scan every new Pull Request (PR) submitted on your monitored repositories to help prevent new vulnerabilities from being added to your codebase.
See Run PR Checks for details.
Last updated
Was this helpful?