An acceptance test is a black-box test of a feature written in a way that non-technical people can understand. By black-box we mean that the test shows what the program does without acknowledging how the program does it. An acceptance test is for a feature, not for a program module. Finally, the non-technical staff need to be able to understand each acceptance test.

  1. create a DBFit test suite
  2. From the Suite page, click “Add” then select “Test page”.
    The suite page is tricky to get to.  It is not the page that you get my pressing the “Suite” button (which takes you to http://…/SuiteName?Suite).  It is URL without the “?Suite” parameter which you get my clicking the “SuiteName” links.
  3. On your new page enter your test. Here is some advice and the syntax reference. An example follows at the bottom of this page:
  4. Start your tests with a !note to the user-story in Jira
  5. Your test should have a !note that explains the test.
  6. Most tests will Arrange, Act, and the Assert.
  7. Arrange: In arrange we configure the system under test. The !|Execute| section creates the starting place for the test.  In the execute section we run any SQL command.
  8. Act: The |Insert| section is our action which adds some rows.
  9. Assert: The |Query| sections test our action.
!note The test is: input (1, 2, 3, 5, 8, 13); output (number of rows = 6), output (total is 32)

!2 Arrange
!note Start with an empty table. Create the table if it does not exist, remove all data from it if it does.

!|Execute|!-
IF EXISTS (
SELECT 1
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Mag_Big_40]')
AND type IN (N'U')
)
BEGIN
TRUNCATE TABLE Mag_big_40;
END
ELSE
BEGIN
CREATE TABLE Mag_Big_40 (value INT);
END;
-!|

!2 Act

|Insert|Mag_big_40|
|value|
|1|
|2|
|3|
|5|
|8|
|13|

!2 Assert

|Query|Select * from Mag_big_40|
|value|
|1|
|2|
|3|
|5|
|8|
|13|

|Query|Select count(*) c from Mag_big_40|
|c|
|6|

|Query|Select sum(value) total_value from Mag_big_40|
|total_value|
|32|

!note Template from http://odeninja.wpengine.com/how-to-write-an-acceptance-test-in-dbfit/