About
A step by step for a dbfit test in Azure SQL Server
Articles Related
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)
- DbFit - Installation - DbFit version 3.2.0
- An Azure SQL account
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
- We will use a script in the example provided at SqlServerTests
Setup
- Connection parameters must be changed for the setup : http://localhost:8085/DbFit.AcceptanceTests.JavaTests.SqlServerTests.FlowMode.SetUp . Example
# 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
- Run then one of the test by clicking on the Test button. Example with ExecutingStatements
|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:
Run from the 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-----