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

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

Dec 23, 2015

Download

Documents

Clarence Paul
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Automated Builds and Testing

Wm. Barrett [email protected] : @wbsimms

Page 2: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Whoami – Past to Present

Systems Administrator Linux – Solaris

Perl Java .NET/C# Agile Project Manager

I love what I do for work.

Page 3: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

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

Page 4: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

WHY?

Page 5: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Automated Build/Test Benefits

Process Personal

Merging Confidence

Onboarding employees Improved skills

Testing/QA Collective Ownership

Collaboration Communication

Page 6: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Problems?

Page 7: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Multiple Developers

Main

Joe

Sue

Ted

Jan

Page 8: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Dependent Projects

Common

Middle Layer

Business Logic

Code Smell:Shotgun Surgery!!

Page 9: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Database Changes

Jan

Bob

Main

Page 10: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Branching and Merging

M

ain

Lin

eBranch 1

Branch 2

???

Page 11: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Mainline merge process

Build/Test Dev

branch

Build/Test Mainline

Merge Dev

branch to Mainline

Build/Test Mainline

Check code into Mainline

Page 12: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

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.

Page 13: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Automated testing

Unit tests=

Quality Software

Page 14: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Typical bug velocity

Se-ries1

0

500

1000

1500

2000

2500

Bug Count

Page 15: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Negative bug velocity

Se-ries1

0

500

1000

1500

2000

2500

Bug Count

Page 16: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

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.

Page 17: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

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)

Page 18: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

A decent answer

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

Page 19: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

My one slide solution

Automated Build Server TFS

Auto Generate Database DumpDatabase/CreateDatabase

Automated Testing MSTest

Page 20: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Generating the scripts DumpDatabaseToSql.exe

Microsoft.SqlServer.Management.Smo

Page 21: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Generating the scripts (2)

Page 22: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Database Files

All schema files in revision control.

Page 23: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Creating the database

Page 24: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Another trick: Entity Framework

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

Page 25: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Unit testing with the database Boy Scout Rule

Leave the campground cleaner than you found it.

At least… leave it as you found it.

Page 26: Automated Builds and Testing Wm. Barrett Simms FrontRunnerMD wbsimms@gmail.com 781.405.4686 Twitter : @wbsimms.

Finally… sort of…

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

I’m using MSBuild… But prefer NAnt.