Skip to content
Vassil Kovatchev edited this page Aug 16, 2017 · 14 revisions

[specs]: Slacker Tests After Slacker is installed, you can create a new project by running:

slacker_new project_name

A Slacker project has the following structure:

project_name
           ├ database.yml
           ├+ spec
           ├+ sql
           ├+ data
           ├ lib
           │    └+ helpers
           └ debug
                  ├+ passed_examples
                  └+ failed_examples
  • database.yml

A YAML file which contains the information about a connection to a database:

driver: tiny_tds # Optional - tiny_tds or odbc; Defaults to odbc.
server: my_server
port: 1433 # Optional and valid only for tiny_tds driver; Defaults to 1433.
database: my_database
user: my_user
password: my_password

Note: At this point Slacker only supports SQL Server Authentication.
If you are getting YAML-related errors after you modify database.yml, make sure you've put a space between each property name and value.

  • spec - Contains your Slacker tests (also known as specifications).
  • sql - Contains your SQL templates invoked by the specifications.
  • data - Contains CSV data files which represent data fixtures (seed data), expected resultsets and test matrices.
  • lib/helpers - Optionally contains helper modules.
  • debug - Contains the SQL trace scripts generated as a result of a Slacker execution.

ODBC vs TDS

Originally slacker connected to SQL Server using driver ruby-odbc. As of version 1.0.16, support was added for the more robust cross-platform TDS protocol via driver tiny_tds. If you plan on running Slacker on Linux, MacOS and Windows, it is highly recommended that you connect to SQL Server via TDS instead of ODBC.

ODBC Setup
  • Make sure named pipes are enabled for the SQL Server instance.
  • Set driver to odbc.
  • When targeting a named instance set server to the full instance name - for example my-host\mssql2014.
TDS Setup
  • Make sure TCP/IP protocol is enabled for the SQL Server instance.
  • Set driver to tiny_tds.
  • Set server to point at the host of SQL Server (not the full instance name).
  • In case of a named instance do not use the full instance name.
    Use a combination of server (IP address or name of SQL Server host) and port (the port the named instance is listening on).

To find the TCP/IP port your server is listening on, run the following against master:

SELECT DISTINCT 
    local_tcp_port 
FROM sys.dm_exec_connections 
WHERE local_tcp_port IS NOT NULL;

Also see Configure a Server to Listen on a Specific TCP Port.