Presentation is loading. Please wait.

Presentation is loading. Please wait.

DbFit 3.0.1 for FitNesse with Data Warehouse worked examples Chris SAUNDERS - September 2014 [AdventureWorks2014] Source Data (multiple.

Similar presentations


Presentation on theme: "DbFit 3.0.1 for FitNesse with Data Warehouse worked examples Chris SAUNDERS - September 2014 [AdventureWorks2014] Source Data (multiple."— Presentation transcript:

1 testrun.co.nz@testrunnz DbFit 3.0.1 for FitNesse with Data Warehouse worked examples Chris SAUNDERS - September 2014 [AdventureWorks2014] Source Data (multiple sources) Load Extract Stage Transform [AdventureWorksDW2014] Data Warehouse Load ETLETL

2 testrun.co.nz@testrunnz Audience Survey

3 testrun.co.nz@testrunnz 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)

4 testrun.co.nz@testrunnz DbFit Intro

5 testrun.co.nz@testrunnz What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

6 testrun.co.nz@testrunnz What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

7 testrun.co.nz@testrunnz What is DbFit? DbFit is a set of fixtures which enables FIT/FitNesse tests to execute directly against a database.

8 testrun.co.nz@testrunnz Data Warehouse Intro Environment

9 testrun.co.nz@testrunnz Data Warehouse Environment [AdventureWorks2014] Source Data (multiple sources) Load Extract Stage Transform [AdventureWorksDW2014] Data Warehouse Load ETLETL

10 testrun.co.nz@testrunnz What Point to Test [AdventureWorks2014] Source Data (multiple sources) Load Extract Stage Transform [AdventureWorksDW2014] Data Warehouse Load SourceData WarehouseSourceLoadStageLoadData Warehouse

11 testrun.co.nz@testrunnz Source What Point to Test Considered each possible test points on the threads. Stage Load Data Warehouse To test the whole system, one needs each thread. Test Points

12 testrun.co.nz@testrunnz Data Warehouse Intro Facts & Dims

13 testrun.co.nz@testrunnz Facts & Dimensions [AdventureWorksDW2014].[dbo].[DimEmployee] Dimension Table Fact Table [AdventureWorksDW2014].[dbo]. [FactResellerSales] 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

14 testrun.co.nz@testrunnz Worked Examples

15 testrun.co.nz@testrunnz 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.

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

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

18 testrun.co.nz@testrunnz Count Data Warehouse Records table FactInternetSales Data Warehouse [AdventureWorks2014] Known Source Data ETL [AdventureWorksDW2014].[dbo].[FactInternetSales] Data Warehouse Check Data Warehouse table FactInternetSales count records against a Source data. SourceCOUNT

19 testrun.co.nz@testrunnz Count Data Warehouse Records Store Query command Compare stored queries command

20 testrun.co.nz@testrunnz Visualise SQL with Design Query in Editor

21 testrun.co.nz@testrunnz Sum Data Warehouse fields UnitPrice, table FactInternetSales Data Warehouse [AdventureWorks2014] Known Source Data ETL [AdventureWorksDW2014].[dbo].[FactInternetSales] Data Warehouse 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. SourceSUM

22 testrun.co.nz@testrunnz Sum Data Warehouse fields Store Query command Compare stored queries command

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

24 testrun.co.nz@testrunnz 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)

25 testrun.co.nz@testrunnz Lets Change Focus

26 testrun.co.nz@testrunnz Test Database

27 testrun.co.nz@testrunnz Test Database Data Warehouse [DbFitNesseTest] Test Database [AdventureWorksDW2014] 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) data

28 testrun.co.nz@testrunnz 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. … YearFranceGermanyUnitedKingdom 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$0.00$699.10

29 testrun.co.nz@testrunnz Test Database Data Warehouse [DbFitNesseTest] Test Database [AdventureWorksDW2014] Data Warehouse Create a table with expected results. data

30 testrun.co.nz@testrunnz Create Expected Results Table Execute command Commit command Create a table and commit to database.

31 testrun.co.nz@testrunnz 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).

32 testrun.co.nz@testrunnz Insert into Expected Results Table Insert command Insert data into table and commit to database.

33 testrun.co.nz@testrunnz Count Data Warehouse Records Store Query command

34 testrun.co.nz@testrunnz Count Data Warehouse Records Compare Stored Queries command Rounding Data 0.00

35 testrun.co.nz@testrunnz Count Data Warehouse Records Compare Stored Queries command

36 testrun.co.nz@testrunnz Drop Expected Results Table Drop table and commit to database.

37 testrun.co.nz@testrunnz Other Commands

38 testrun.co.nz@testrunnz 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.

39 testrun.co.nz@testrunnz Thank you

40 testrun.co.nz@testrunnz DbFit 3.0.1 for FitNesse with Data Warehouse worked examples Presented by Chris SAUNDERS - September 2014 Adventure Works 2014 Sample Databases http://msftdbprodsamples.codeplex.com/releases/view/125550 Microsoft SQL Server 2014 Express http://msdn.microsoft.com/en-us/evalcenter/dn434042.aspx Poor Man's T-SQL Formatter http://www.architectshack.com/PoorMansTSqlFormatter.ashx DbFit examples http://www.testrun.co.nz/presentations.htmlhttp://www.testrun.co.nz/presentations.html (place under FitNesseRoot\DbFit\AcceptanceTests\DotNetTests)


Download ppt "DbFit 3.0.1 for FitNesse with Data Warehouse worked examples Chris SAUNDERS - September 2014 [AdventureWorks2014] Source Data (multiple."

Similar presentations


Ads by Google