DbFit - Azure SQL Server Example

Card Puncher Data Processing

About

A step by step for a dbfit test in Azure SQL Server

Prerequisites

  • Java version 8 or 7
java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

Configuration

JDBC driver

  • Download the driver
  • Copy the corresponding jdbc file into the DBFIT_HOME\lib directory.
    • sqljdbc42.jar for java version 8
    • sqljdbc41.jar for java version 7

Restart / Start DbFit

startFitnesse.bat
REM or startFitnesse.sh

Test script

Setup

# Note if you want to create a test in another directory, you need to add the below statement
# You will not find it in the original page
# because it's already written in this parent page: http://localhost:8085/DbFit.AcceptanceTests.JavaTests?edit
!path lib/*.jar

# Define the driver
!|dbfit.SqlServerTest|

# The connection has the form
#     * !|Connect|myDatabaseName.database.windows.net|user|pwd|database|
# 
# Example:
!|Connect|myDatabaseName.database.windows.net|nico|Welkom1!|adventureworkstest|

where:

Run from the Web

  • Be sure that the page is a test page in the properties. Tools > Properties

Fitness Page Properties

|Execute|Create table Test_DBFit(name varchar(50), luckyNumber int)|

|Execute|Insert into Test_DBFit values ('Obi Wan',80)|

|Execute|Insert into Test_DBFit values ('Darth Maul',10)|

|Query|Select * from Test_DBFit|
|Name|Lucky Number|
|Darth Maul|10|
|Obi Wan|80|


|Execute|Drop table Test_DBFit|
  • Result:

Dbfit Sqlserver Test

Run from the command line

command line

java -cp "lib\dbfit-docs-3.2.0.jar;lib\fitnesse-20150424-standalone.jar" fitnesseMain.FitNesseMain -c "DbFit.AcceptanceTests.JavaTests.SqlServerTests.FlowMode.ExecutingStatements?test&format=text"
Bootstrapping FitNesse, the fully integrated standalone wiki and acceptance testing framework.
root page: fitnesse.wiki.fs.FileSystemPage at .\FitNesseRoot#latest
logger: none
authenticator: fitnesse.authentication.PromiscuousAuthenticator
page factory: fitnesse.html.template.PageFactory
page theme: bootstrap
Starting FitNesse on port: 8085
Executing command: DbFit.AcceptanceTests.JavaTests.SqlServerTests.FlowMode.ExecutingStatements?test&format=text
-----Command Output-----

Starting Test System: fit:fit.FitServer.
. 11:16:48 R:4    W:0    I:0    E:0    ExecutingStatements      (DbFit.AcceptanceTests.JavaTests.SqlServerTests.FlowMode.ExecutingStatements
)       1.239 seconds
--------
1 Tests,        0 Failures      2.566 seconds.
-----Command Complete-----

Documentation / Reference





Discover More
Card Puncher Data Processing
Test - dbfit framework

DbFit is a framework written as a fit plugin of fitnesse that is dedicated to database testing. SQLServer 2005 — SQLSERVER (Earlier versions of...



Share this page:
Follow us:
Task Runner