Your SlideShare is downloading. ×
0
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
every-day-automation
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

every-day-automation

457

Published on

Presentation done at CodeCamp Winnipeg

Presentation done at CodeCamp Winnipeg

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
457
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. AMIR BARYLKO EASY AUTOMATION FOR EVERY DAY PROJECTS WINNIPEG CODE CAMP FEB 2011Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  2. 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
  3. 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
  4. WHO NEEDS AUTOMATION?Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. PROJECT SKELETONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  11. 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
  12. BUILD AUTOMATIONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  13. 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
  14. 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
  15. 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
  16. ALBACORE • Basic functionality for .NET projects • OpenSource • Active Development • Very easy to useAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  17. 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
  18. 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
  19. SETUP DEPENDENCIESAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  20. 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
  21. 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
  22. 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
  23. 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
  24. TEST AUTOMATIONAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  25. 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
  26. 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
  27. CI SETUPAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  28. 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
  29. MANY OPTIONS TeamCity •Team System Build server •Hudson •CruiseControl.NETAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  30. 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
  31. PUSH CHANGESAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  32. 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
  33. GOING ALL THE WAY Static Analysis Tools Deployment Acceptance Tests AutomationAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  34. TOOLSAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  35. STATIC ANALYSIS • StyleCop • FxCop • Code Coverage • Dependencies • SimianAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  36. 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
  37. DEPLOYMENTAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  38. 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
  39. ACCEPTANCE TESTSAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  40. RUNNING CUCUMBER • Start the server • Setup database • Run the scenario • Stop the serverAmir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  41. QUESTIONS?Amir Barylko - CodeCamp 2011 MavenThought Inc.Sunday, February 27, 2011
  42. 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
  43. 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
  44. 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

×