every-day-automation
Upcoming SlideShare
Loading in...5
×
 

every-day-automation

on

  • 769 views

Presentation done at CodeCamp Winnipeg

Presentation done at CodeCamp Winnipeg

Statistics

Views

Total Views
769
Views on SlideShare
769
Embed Views
0

Actions

Likes
2
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

every-day-automation every-day-automation Presentation Transcript

  • AMIR BARYLKO EASY AUTOMATION FOR EVERY DAY PROJECTS WINNIPEG CODE CAMP FEB 2011Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • WHO AM I? • Quality Expert • Architect • Developer • Mentor • Great cook • The one who’s entertaining you for the next hour!Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RESOURCES • Email: amir@barylko.com • Twitter: @abarylko • Blog: http://www.orthocoders.com • Materials: http://www.orthocoders.com/presentationsAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • WHO NEEDS AUTOMATION?Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • EVERY DAY PROJECT SETUP • Repetitive task (project structure, scripts, etc) • Source control setup • Testing setup • Database setup • Deployment setupAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • MANUAL SETUP • Get the last project, copy, paste & delete • Use documentation and follow instructions (ha! good one!) • Use the IDE to build • Copy the assemblies, etc to where • Database connection centralized or hardcodedAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • WHAT’S WRONG? • Lengthy process (waste) • Very hard to maintain • Hard to reproduce • Complex for larger teams • Usually no documented • Hard to deploy • The architect just moved to • High dependency with the another country IDE • Coupled to the environmentAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • WHAT TO DO? • Avoid It works on my • Scripts for every task! computer! • Continuous integration • Use application skeletons • TDD & BDD • End to end setup from day one! • Clear feature development process • Always in deliverable stateAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • ONE STEP AT A TIME Project skeleton Build Automation Test Automation CI setup Push Changes (commit)Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • PROJECT SKELETONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • FOLDER STRUCTURE • MediaLibrary --- MavenThought.MediaLibrary.sln : Main solution file --- Rakefile: Main rake file to launch build, test, etc. +-- main: Project files (sources) +-- test: Test project files +-- features: Features used by Capybara + Cucumber +-- lib2: Dependencies that cant be installed with bundler +-- tools: Tools used to run tests, xslt, etc.Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BUILD AUTOMATIONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BUILD TOOLS •Batch files • MSBuild (XML) • NAnt (better XML) • FinalBuilder (Visual) • VisualBuild (Visual) • Rake (Ruby) • BooBS (Boo Build System) • Psake(Powershell)Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • ARE YOU NUTS? RUBY? • The best tool for the job • What does it mean to be a developer? • Ruby is a great scripting language • Need something? There is a gem for that....Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RAKE • Domain Specific Language • Great, great, great .... grandchild of make • Is just Ruby • Lots of gems (libraries) availableAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • ALBACORE • Basic functionality for .NET projects • OpenSource • Active Development • Very easy to useAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BASIC RAKEFILE require rubygems require albacore require rake/clean include FileUtils solution_file = FileList["*.sln"].first project_name = "MavenThought.MovieLibrary" CLEAN.include("main/**/bin", "main/**/obj", "test/**/obj", "test/**/bin") CLOBBER.include("**/_*", "lib/*", "**/*.user", "**/*.cache", "**/*.suo")Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BASIC RAKEFILE II desc Default build task :default => ["build:all"] namespace :build do desc "Build the project" msbuild :all, :config do |msb, args| msb.properties :configuration => args[:config] || :Debug msb.targets :Build msb.solution = solution_file end desc "Rebuild the project" task :re => ["clean", "build:all"] endAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • SETUP DEPENDENCIESAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • MANY OPTIONS • Store dependencies in source control (not recommended) • Use Nuget and then store them in SC • Use openwrap • Use gems + bundlerAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BUNDLER • Define Gemfile with dependencies • Run “bundle install” • Create task to setup .NET dependencies under libAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • GEMFILE source :rubygems group :setup do gem albacore gem git gem noodle end group :dev do gem sharptestsex gem gallio, ~> 3.2 gem rhino.mocks, ~> 3.6 gem structuremap.automocking, ~> 2.6.1.1 gem maventhought.testing gem maventhought.commons endAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • COPY LOCAL DEPENDENCIES desc Setup requirements to build and deploy task :setup => ["setup:dep:local"] namespace :setup do namespace :dep do Noodle::Rake::NoodleTask.new :local do |n| n.groups << :runtime n.groups << :dev end end endAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • TEST AUTOMATIONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • UNIT TESTS • Each project has a separate testing project • Clear naming convention (MavenThought.Core.Tests) • Enforce TDD when possible • Automate since day one (even with empty tests)Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RUN TESTS desc "Run all tests" task :test => ["test:all"] namespace :test do desc Run all tests task :all => [:default] do tests = FileList["test/**/bin/debug/**/*.Tests.dll"].join " " system "./tools/gallio/bin/gallio.echo.exe #{tests}" end endAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • CI SETUPAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • BENEFITS OF CI • Integrate code frequently • Trigger events (deployment, etc) • Validate build • Regression tests (unit, integration, acceptance)Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • MANY OPTIONS TeamCity •Team System Build server •Hudson •CruiseControl.NETAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • TEAM CITY • Very easy to use • Free for 20 projects & 3 agents • Web Based • Awesome UI • Supports: Rake, MsBuild, Nant, etc....Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • PUSH CHANGESAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • CLEAR PROCESS • Branch per feature • Commit often • Merge changes from trunk often • Automate commit (to avoid mistakes)Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • GOING ALL THE WAY Static Analysis Tools Deployment Acceptance Tests AutomationAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • TOOLSAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • STATIC ANALYSIS • StyleCop • FxCop • Code Coverage • Dependencies • SimianAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • STYLECOP namespace :tools do desc "Runs stylecop and generates a report on the Output folder" task :stylecop do mkdir "Output" unless File.directory? "Output" stylecop = "tools/stylecopcmd/StyleCopCmd" # Run the StyleCopCmd from tools sh "#{stylecop} -sf #{solution_file} -ifp AssemblyInfo.cs -of..." sh "tools/Xslt/msxsl.exe Output/stylecop.violations.xml ...." xmldoc = Document.new(File.new("Output/stylecop.violations.xml")) violations = XPath.first(xmldoc, "/StyleCopViolations/Violation") abort "Stylecop Failed!" unless violations.nil? end endAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • DEPLOYMENTAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • ASSEMBLY VERSION • Use SVN revision • Combine Major.Minor.Build.Revision • Update AssemblyInfo.cs • Build in release • Deploy to a folder as a zipfileAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • ACCEPTANCE TESTSAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RUNNING CUCUMBER • Start the server • Setup database • Run the scenario • Stop the serverAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • QUESTIONS?Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RESOURCES • Email: amir@barylko.com • Twitter: @abarylko • Presentation: http://www.orthocoders.com/presentations • Source Code: https://github.com/amirci/democc_2011Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RESOURCES II •Ruby Installer: http://www.ruby-lang.org/en/downloads/ •Rake: http://rake.rubyforge.org/ •Albacore: https://github.com/derickbailey/Albacore •Noodle: https://github.com/spraints/noodle •MavenThought Testing: https://github.com/amirci/mt_testing • TeamCity: http://www.jetbrains.com/teamcity/download/ • Capybara: https://github.com/jnicklas/capybaraAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  • RESOURCES III •MSBuild :http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx •NAnt :http://nant.sourceforge.net/ •FinalBuilder: http://www.finalbuilder.com/ •VisualBuild: http://www.kinook.com/VisBuildPro/ •BooBS:http://code.google.com/p/boo-build-system/ •Psake: https://github.com/JamesKovacs/psake •Powershell: http://bit.ly/ehQcTb •TFS: http://msdn.microsoft.com/en-us/vstudio/ff637362Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011