Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test Automation at FiNC

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Daniel
June 09, 2016

Test Automation at FiNC

Presentation about software quality, testing and static code analysis.

Daniel

June 09, 2016

Transcript

52 slides
  1. WHY FEAR IS BAD? ▸ Fear will make you do

    overcomplicated things ▸ Fear will litter your code with `try()` ▸ Fear will kill your creativity ▸ Fear will make you slow ▸ Fear is really bad for a StartUp
  2. UNIT TESTS ▸ Models ▸ Validations ▸ Service classes ▸

    Tests algorithms ▸ Write tests, don’t use the console! ▸ Exhaustive
  3. FUNCTIONAL TESTS ▸ Controllers. ▸ Don't test too much! How

    many paths does your method have? Don't test by proxy. ▸ Use Factory Girl when necessary. Build instead of create. Use mocks. Create support methods! ▸ Main characteristic: Focus
  4. INTEGRATION TESTS ▸ Use Capybara with Rspec ▸ Make life

    of QA department easier. ▸ Strategy: ▸ Make a list with all the features of the application that need to be checked after each deploy. ▸ Automate as much as possible. ▸ Write declarative code using helpers
  5. SMOKE TEST ▸ Loads all the routes and checks that

    they respond correctly ▸ Ideally, all the routes should be covered by an integration test ▸ In the real world, smoke tests can save your day.
  6. RUBOCOP ▸ Please, don't spend time in code reviews arguing

    about commas or indentations! ▸ Cyclomatic Complexity, Perceived Complexity, AbcSize make a lot of sense.... Most of the time. ▸ You are allowed to disable a cop for a method. But don’t do it! ▸ You don't want to use a custom configuration. Our application is not that special. Exception: Line length to 110 lines as a hard limit but try to stick to 80.
  7. SIMPLECOV ▸ Shows code coverage of the application ▸ Shows

    the number of times each line of code has been executed during tests. ▸ Helps to identify which path have not been covered by tests.
  8. BRAKEMAN ▸ Rails security scanner ▸ Analyse code to find

    security flaws ▸ Sometimes will generate false positives. This false positives can be added to a ignore file… or the code can be rewritten in a way that does not offend brakeman.
  9. RUBYCRITIC ▸ Uses different static code analysis tools in order

    to offer an objective(~ish) measure of code quality. ▸ Reek: detects code smells ▸ Flay: detects code duplication ▸ Flog: outputs an scalar value representing the complexity of the code. ▸ Useful to find candidates to refactor and to find out if a PR is improving or worsening the quality of the code.
  10. ▸ Composition ▸ Balance ▸ Leading Lines ▸ Framing ▸

    Foreground and Background ▸ Patterns
  11. ▸ Harmony ▸ Form ▸ Scales and progression ▸ Flow

    ▸ Foreground and Background ▸ Patterns
  12. ▸ Structures ▸ Abstractions ▸ Separation of Concerns ▸ Background

    (Infrastructure Logic) vs Foreground (Business Logic) ▸ Patterns

Other Decks in Programming