26
Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD [email protected] 781.405.4686 Twitter : @wbsimms

Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD [email protected] 781.405.4686 Twitter : @wbsimms

Embed Size (px)

Citation preview

Automated Builds and Testing

Wm. Barrett [email protected] : @wbsimms

Whoami – Past to Present

Systems Administrator Linux – Solaris

Perl Java .NET/C# Agile Project Manager

I love what I do for work.

What you’ll learn How I build software How this helps teams Techniques Tools Show a fairly complete approach

WHY?

Automated Build/Test Benefits

Process Personal

Merging Confidence

Onboarding employees Improved skills

Testing/QA Collective Ownership

Collaboration Communication

Problems?

Multiple Developers

Main

Joe

Sue

Ted

Jan

Dependent Projects

Common

Middle Layer

Business Logic

Code Smell:Shotgun Surgery!!

Database Changes

Jan

Bob

Main

Branching and Merging

M

ain

Lin

eBranch 1

Branch 2

???

Mainline merge process

Build/Test Dev

branch

Build/Test Mainline

Merge Dev

branch to Mainline

Build/Test Mainline

Check code into Mainline

Buildservers

Developer merges to mainline

Buildserver gets changes

Buildserver builds, runs all tests and notifies team

Test results are published to team and viewable by all.

Automated testing

Unit tests=

Quality Software

Typical bug velocity

Se-ries1

0

500

1000

1500

2000

2500

Bug Count

Negative bug velocity

Se-ries1

0

500

1000

1500

2000

2500

Bug Count

Common resistance

I can’t write unit tests because… I have a UI

WaitN, QTP, Selenium Fixing someone else’s poorly written code

Refactoring, training I use a database

The tricky part.

Databases – The tricky part

Common Questions How do I write unit tests when I require a

database How do I merge changes? How do I add default/test data? How do I update…

Buildserver Production site(s)

A decent answer

Use SQL scripts! Table View Procedures Key and Constraints Default Data Test Data

My one slide solution

Automated Build Server TFS

Auto Generate Database DumpDatabase/CreateDatabase

Automated Testing MSTest

Generating the scripts DumpDatabaseToSql.exe

Microsoft.SqlServer.Management.Smo

Generating the scripts (2)

Database Files

All schema files in revision control.

Creating the database

Another trick: Entity Framework

EdmGen2 http://archive.msdn.microsoft.com/EdmGen2

Unit testing with the database Boy Scout Rule

Leave the campground cleaner than you found it.

At least… leave it as you found it.

Finally… sort of…

Wrap it all up in a build script. MSBuild, NAnt….

I’m using MSBuild… But prefer NAnt.