Add an environment

Connect a project to a database: provider, encrypted connection string, tier and test.

In short

An environment is one database a project can run against: a name, a provider (SQL Server, PostgreSQL, MySQL, MariaDB or SQLite), a connection string or an organization connection, a tier and variables. A project usually has a few, such as Local, QA and Production. The connection string is encrypted and never shown again.

Before you start

Add an environment

  1. Open the environment chip in the title row and choose "Add environment" - or choose "Connections" there and press "New environment".
  2. Enter a Name. If your organization connected test databases, choose one under "Organization connection" and go to the Tier: it brings its provider and connection string.
  3. Otherwise choose the Provider (or press "Type a connection string instead"). An example connection string appears under the field.
  4. Paste the "Connection string". Use a database login with the fewest rights the tests need.
  5. Choose the "Tier" that matches what the database really is.
  6. Tick "Read-only" to force every run here to roll back. Tick "Default" if tests without an environment should run here.
  7. Press "Test connection", then "Save and test".

Protect the connection string

It is a secret Whoever can run in the project can execute SQL as the login in the connection string. Never use a server administrator login, and give Production a login that can only read.

Only the tier is protected Naming an environment Production does nothing; setting its Tier to Production does. Custom has no protection. If a database holds real data, set Preprod, Staging or Production, or tick Read-only.

Do not paste a connection string into a test's SQL or description; those are stored as written.

Good to know

If something goes wrong

Related