Presentation is loading. Please wait.

Presentation is loading. Please wait.

DbFit for FitNesse with Data Warehouse worked examples

Similar presentations


Presentation on theme: "DbFit for FitNesse with Data Warehouse worked examples"— Presentation transcript:

1 DbFit 3.0.1 for FitNesse with Data Warehouse worked examples
Presented by Chris SAUNDERS - September 2014 @chrisrsaunders

2 99% Presentation Presenter’s Background [2%] Audience Survey [4%]
DbFit Intro [5%] Data Warehouse Intro [8%] Worked Examples [75%] Discussion [5%]

3 Presenter’s Background

4 as a professional occupation.
Chris SAUNDERS a little more background… Test & Agile Practitioner One who practices testing & agile software development, as a professional occupation.

5 Chris SAUNDERS Originally a Systems Engineer.
Spent a decade on my OE in the United Kingdom. Returned to Christchurch as a Test Manager; contracted for 5 years & now permanent. 2008 Healthcare Education Payroll Local Government Christchurch Aviation New Zealand Christchurch Auckland Wellington Palmerston North Utilities Degree Education Bachelor of Technology (Honours), Information Engineering Graduated 1997 Massey University Tauranga School & Polytechnic Education Healthcare Financial Services Power Generation Fashion IT United Kingdom Harrogate Stockport Stirling Edinburgh 1999

6 Audience Survey

7 Audience Survey Who… has used FitNesse? has used DbFit?
has worked with Data Warehouses? has an understanding SQL? (Structured Query Language) What is the result of the following SQL? (Bottom table is the Fridge table) SELECT DISTINCT Drink FROM the.Fridge WHERE Temperature = 'Cold' AND Drink IN ( 'Coke' ,'Ginger Beer' ) AND ( Quality > 0 OR Quality IS NOT NULL dbo is the "default" schema for SQL Server; (database owner)

8 DbFit Intro

9 What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

10 What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

11 What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

12 Data Warehouse Intro Environment

13 Data Warehouse Environment
[AdventureWorks2014] ETL [AdventureWorksDW2014] Extract Transform Load Source Data (multiple sources) Load Stage Data Warehouse Person BusinessEntityID FirstName LastName MiddleName PersonType Person BusinessEntityID FirstName LastName MiddleName PersonType WorkingPerson EmployeeKey BusinessEntityID FirstName LastName MiddleName SalesPersonFlag DimPerson EmployeeKey FirstName LastName MiddleName SalesPersonFlag

14 What Point to Test Source Data Warehouse Source Load Data Warehouse
[AdventureWorks2014] [AdventureWorksDW2014] Extract Transform Load Source Data (multiple sources) Load Stage Data Warehouse Source Data Warehouse Source Load Data Warehouse Load Stage

15 What Point to Test Considered each possible test points on the threads. Source Load Stage Test Points Data Warehouse To test the whole system, one needs each thread.

16 Data Warehouse Intro Facts & Dims

17 Facts & Dimensions Fact Table Dimension Table
[AdventureWorksDW2014].[dbo]. [FactResellerSales] [AdventureWorksDW2014].[dbo].[DimEmployee] Consists of the measurements, metrics or facts of a business process Calculations can be done on the measures (e.g. sum, count, min, max) Provides filtering, grouping and labelling

18 Worked Examples

19 Connection to the Database
Connect command Specifying the full connection string using the full ADO.NET or JDBC connection string. or Specifying server, username, password, and database name. Connect Using File command A file contains the connection information, therefore can be environment related.

20 Count Data Warehouse Records table DimCustomer
[AdventureWorks2014] [AdventureWorksDW2014].[dbo].[DimCustomer] ETL Known Source Data Data Warehouse Data Warehouse COUNT 18444 Check Data Warehouse table DimCustomer count record against a fixed value in FitNesse wiki page.

21 Count Data Warehouse Records
Query command with fixed result Brittle test due to the fact this test requires updating every time test data changes as the DimCustomer table record will change. Which SQL for COUNT and why?

22 Count Data Warehouse Records table FactInternetSales
[AdventureWorksDW2014].[dbo].[FactInternetSales] [AdventureWorks2014] ETL Known Source Data Data Warehouse COUNT Source Data Warehouse COUNT Check Data Warehouse table FactInternetSales count records against a Source data.

23 Count Data Warehouse Records
Store Query command Compare stored queries command

24 Visualise SQL with Design Query in Editor

25 Sum Data Warehouse fields UnitPrice, table FactInternetSales
[AdventureWorks2014] [AdventureWorksDW2014].[dbo].[FactInternetSales] ETL Known Source Data Data Warehouse SUM Source Data Warehouse SUM Check Data Warehouse field’s UnitPrice total sum in table FactInternetSales, against a Source data. Measures can be summed up, for all records or for a sub-set of records.

26 Sum Data Warehouse fields
Store Query command Compare stored queries command

27 Check each Data Warehouse field, ListPrice in table DimProduct
[AdventureWorks2014] [AdventureWorksDW2014].[dbo].[DimProduct] ETL Known Source Data Data Warehouse EXCEPT (both ways) Source Data Warehouse Check each Data Warehouse ListPrice field, in table DimProduct, against Source data. SQL’s EXCEPT function, returns any distinct values from the left query that are not also found on the right query.

28 Check each Data Warehouse field
Limit number of errors in FitNesse. TOP 3 Return results in the same order. ORDER BY 1, 2 (or else missing records will be displayed)

29 Lets Change Focus

30 Test Database

31 Test Database Data Warehouse Test Database is used for:
[DbFitNesseTest] [AdventureWorksDW2014] data Test Database Data Warehouse Data Warehouse Test Database is used for: Store Test data (either as a source or created from other sources) Store procedures (to be executed from FitNesse) Storing results (to compare in the future)

32 Test Database Report User Story Example European Internal Sales Report
As an European Sales Manager, I want a Report on total “Europe Internal Sales" for each year, So that future business decisions can be made. Acceptance Criteria : 1. To include all available years 2. Only 3 countries; France, UK & Germany 3. … Year France Germany UnitedKingdom 2014 $0.00 2013 $1,578,511.80 $1,761,876.36 $2,124,007.29 2012 $648,065.54 $608,657.98 $712,700.96 2011 $410,845.33 $520,500.16 $550,591.22 2010 $3,399.99 $699.10

33 Test Database Data Warehouse Create a table with expected results.
[DbFitNesseTest] [AdventureWorksDW2014] data Test Database Data Warehouse Data Warehouse Create a table with expected results.

34 Create Expected Results Table
Execute command Commit command Create a table and commit to database.

35 Truncate Expected Results Table
Inspect Table command Truncate table and commit to database. Inspect Table to confirm it’s truncated (does not Pass or Fail).

36 Insert into Expected Results Table
Insert command Insert data into table and commit to database.

37 Count Data Warehouse Records
Store Query command

38 Count Data Warehouse Records
Compare Stored Queries command Data 0.00 Rounding

39 Count Data Warehouse Records
Compare Stored Queries command

40 Drop Expected Results Table
Drop table and commit to database.

41 Other Commands

42 Other Commands Update command Execute Procedure command
Update command similar to insert command. Execute Procedure will executes a stored procedure or function for each row of data table and will bind input/output parameters to columns of the data table.

43 Thank you

44 DbFit 3.0.1 for FitNesse with Data Warehouse worked examples
Adventure Works 2014 Sample Databases Microsoft SQL Server 2014 Express Poor Man's T-SQL Formatter DbFit examples (place under FitNesseRoot\DbFit\AcceptanceTests\DotNetTests) DbFit for FitNesse with Data Warehouse worked examples Presented by Chris SAUNDERS - September 2014 @chrisrsaunders


Download ppt "DbFit for FitNesse with Data Warehouse worked examples"

Similar presentations


Ads by Google