background preloader

Testing

Facebook Twitter

Home - Chai. Code School - Testing with RSpec. #275 How I Test. Here I show how I would add tests to the password reset feature created in the previous episode.

#275 How I Test

I use RSpec, Capybara, Factory Girl, and Guard to make request, model, and mailer specs. Download: source codeProject Files in Zip (92.2 KB)mp4Full Size H.264 Video (26.4 MB)m4vSmaller H.264 Video (16.1 MB)webmFull Size VP8 Video (18.1 MB)ogvFull Size Theora Video (37.8 MB) #412 Fast Rails Commands. Apr 04, 2013 | 8 minutes | Tools Rails commands, such as generators, migrations, and tests, have a tendency to be slow because they need to load the Rails app each time.

#412 Fast Rails Commands

Here I show three tools to make this faster: Zeus, Spring, and Commands. Download: source codeProject Files in Zip (44.5 KB)mp4Full Size H.264 Video (21.7 MB)m4vSmaller H.264 Video (9.71 MB)webmFull Size VP8 Video (10 MB)ogvFull Size Theora Video (22.4 MB) Everyday Rails Testing… by Aaron Sumner. Have you gotten your hands dirty with a Rails application or two, but lack reliable test coverage?

Everyday Rails Testing… by Aaron Sumner

Does your application testing consist of a series of browser clicks, hoping you cover everything? Or do you just cross your fingers and hope for the best that everything will just work? Don't worry, everyone has been there at some point--and while testing and test-driven development are important aspects of Rails development, many tutorials gloss over these components. Ruby flew too: Rails 3.2, MiniTest Spec and Capybara. What do you do when you love your spec testing with Capybara but you want to veer off the beaten path of Rspec and forge ahead into MiniTest waters?

Ruby flew too: Rails 3.2, MiniTest Spec and Capybara

Follow along, and you'll have not one, but two working solutions. The setup Quickly now, let's throw together an app to test this out. I'm on rails 3.2.9. Edit the Gemfile to include a test and development block Note the inclusion of database_cleaner as per the capybara documentation. Use RSpec.vim with tmux and Dispatch. (And Keep Your Screen Real Estate) As you may know, there are quite a few of us now working at thoughtbot.

Use RSpec.vim with tmux and Dispatch

While we share a lot of the same opinions, we all work a little differently. Most of us are running specs from Vim using RSpec.vim. Some RSpec Tips and Best Practices - bitfluxx.com. I’ve been working a lot with RSpec lately, in close conjunction with my coworker Myron Marston, who happens to be a committer to RSpec.

Some RSpec Tips and Best Practices - bitfluxx.com

He’s shown me how a lot of features in RSpec work, how they’re useful and some best practices to use. I thought I’d share some of my favorite ones. let{} Thoughts.inject(world), RSpec best practices - RSpec best practices. A Post Entitled RSpec best practices A few days ago Philippe Creux posted his RSpec Best Practices and Tips.

thoughts.inject(world), RSpec best practices - RSpec best practices

The post is well worth reading even if you prefer another test framework (you are testing, right?!) Because there are several tips that are applicable to TDD more broadly than rspec alone. Beginning Rails testing. January 11, 2011 I admit that I was guilty for a long time of not writing any tests for my Rails applications.

Beginning Rails testing

My application testing consisted of an unhealthy reliance on in-browser testing, with nothing automated. I blame this on coming from a very unstructured way of developing code before I discovered Rails; I also think the early Rails demonstrations (15-minute blog) and tutorials focused on rapid application development more than the baked-in opportunities to test your code programatically. This wasn’t the end of the world when I had one small app in production, and hardly any users—but as the apps grew in count, size, and complexity, and my user base grew along with them, manually testing every edge case, every time, in a browser became tedious. WebDriverJs - selenium - A guide to using the JavaScript bindings for WebDriver. - Browser automation framework. Getting Started (requires Node v0.8+) To get started with WebDriverJS for Node, you will need to download a copy of the ChromeDriver and ensure it can be found on your system PATH.

WebDriverJs - selenium - A guide to using the JavaScript bindings for WebDriver. - Browser automation framework

All other browsers can be tested using the stand-alone Selenium server. Once you've obtained the ChromeDriver and placed it on your PATH, you can run your first test: var webdriver = require('selenium-webdriver'); var driver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.chrome()). build(); driver.get(' { return driver.getTitle().then(function(title) { return title === 'webdriver - Google Search'; });}, 1000); driver.quit(); Reference API Docs Installing from NPM.

Selenium - Web Browser Automation. Better Specs { rspec guidelines with ruby } Everyday Rails. 6: Top 5 Cucumber best practices. This is the sixth episode of our Testing Tuesday series.

6: Top 5 Cucumber best practices

Every week we will share our insights and opinions on the software testing space. Drop by every Tuesday to learn more! Rails API Testing Best Practices With RSpecMatthew Lehner. Writing an API is almost a given with modern web applications. I’d like to lay out some simple guidelines and best practises for Rails API testing. We need to determine what to test and why it should be tested. Once we’ve established what we will be writing tests for, we will set up RSpec to do this quickly and easily. Basically we’ll be sending HTTP requests and testing that the response status codes and content match our expectations. What to test? A properly designed API should return two things: an HTTP response status-code and the response body.

HTTP Status Codes. TDD JavaScript with Require.js and Teabag on Rails - Inline Block's Blog. Introduction Test Driven Development, or TDD, is the process of writing tests before writing your code. Or minimally, testing the code that you write. Since starting to use require.js, I found it annoying that there were not many test runners in rails that would support require.

I did find that Teabag had partial require support by defering the execution of tests until certain assets are loaded. However, once we integrated Teabag, we found that it didn’t always wait correctly. Our modifications basically used require itself, to include the found tests (see: suite.matcher) and pull them in, then once loaded, run Teabag.execute. Setting up Teabag First we need to add the gem to your Gemfile. AngularJS Pain Points - Jaco Pretorius. I’ve been using AngularJS for almost 3 months. I had heard quite a lot about Angular before this time – many people were talking about it being the ‘next big thing’ and how it could become the defacto JavaScript framework for client-side development. At first glance I was very impressed with Angular – the two-way binding removes the need for constantly updating the view and the scope objects makes for a clean separation between the controller and the view. There were other elements which were very appealing as well – a complete documentation site, a focus on testability, and a clean separation of concerns through built-in dependency injection.

As I said, at first glance it definitely looks very impressive. Getting Started With Konacha: JavaScript Testing on Rails. Konacha is a testing tool for JavaScript applications running on Rails. Why Konacha? It’s very fast.It treats JavaScript like a first-class citizen: Your tests are written in JavaScript, call into JavaScript code, and inspect JavaScript objects. You can still trigger events, e.g. with jQuery, if you need to simulate user actions.It comes with support for the Rails asset pipeline. [1]It supports CoffeeScript.You can use the in-browser runner (good for development), or run your test suite from the command line through Selenium (good for build servers).

What it cannot do is talk to the server. In particular: It cannot use the database.It cannot access your Rails (server-side) views. When you need either of these two, write integration tests with Capybara instead. Noelrappin/summer_breeze. Summer Breeze: creates dynamic Rails fixtures for Jasmine tests. On stage at Red Dirt Ruby Conference, Noel Rappin has released Summer Breeze, a gem that makes working with Jasmine in Rails a bit easier. Summer Breeze dynamically creates Rails fixtures for your Jasmine tests. Installation and usage. Sucking less at writing Cucumber — Rendered Text. I wrote my first Cucumber scenario about five months ago. It went something like this: Charliesome/better_errors. Cane - Ruby code quality thresholds. Code Tools · metricfu/metric_fu Wiki. Metricfu/metric_fu. Behavior-driven development. With Proper TDD, You Get That. Search · ttt-ruby. Agile Development of Frontend Javascript using AngularJS, Jasmine, Testacular & Jenkins. I love being around awesome people, who build great products customers desire.

I love learning from and together with these amazing minds. I love creating the right environment for teams to flourish. I love change, and learning from new experiences. Comparing googlemock to Mocha. Higher-level languages are great, but every now and then I like some good old C++. So I was a bit excited when I got the chance to use C++ recently on a piece of demo software. After spending a lot of time in Ruby and Javascript (or more accurately, Coffeescript), it was both comforting and frustrating to be back in the land of pointers, memory allocation, and static types. Not Tending to "The Build" – A Common Anti-Pattern. The Build is an essential cog of any software project, but it is most often maintained by identified “experts.”

Test Driven Development: Resistance Is... Perplexing? Recently I’ve been working with a mixed team of developers – contractors from a few companies with varied backgrounds. A Beginning Developer's Experience With TDD. As a summer intern at Atomic Object, I’ve learned a lot about Test-Driven Development (TDD), a practice that Atomic uses heavily. Cucumber - Making BDD fun. Tip: Run seeds.rb file only against Development.

Intern: A next-generation JavaScript testing stack. Summer Breeze: creates dynamic Rails fixtures for Jasmine tests. Sextant-view-your-rails-routes-without-waiting-on-rake/ When given the option, I’ll always opt for text mode when completing a task. In Rails that usually means Rake. There’s a point in most Rails apps, however, when the time to boot Rails just to rake -T is painful. So when Richard Schneeman got tired of waiting on Rails to run rake routes, he created Sextant, a gem that lists your routes in development mode right in your browser.

Since your web server is presumably already booted, there’s no startup tax to see your routes. Better Rails development with better_errors! If you are anything like me (a Rails developer that enjoys good design), you will be glad to know that there is a project out there to make the default error pages for Rails development much cleaner! The standard features are simple, and pretty much just a polished version of what Rails offers out of the box: Testing your site (Part 1) A Primer on A/B Testing. Selenium - How to test Mobile app using cucumber-ruby with selenium2 webdriver. Testing tuesday #8. LINK Medical Computing, Inc: LINKTools® HL7 Basic_Home. Advanced TDD/BDD Master class - Learn TDD/BDD from the author of BDD in Action. Should I Write a New Unit Test? Linksheet: Cucumber and BDD. 7: Managing test data with factory girl.

8: Behavior-Driven Integration and Unit testing. 6: Top 5 Cucumber best practices. 19: How to test node.js applications with Jasmine. 18: How to test asynchronous JavaScript with Jasmine. 17: How to spy on JavaScript methods with Jasmine. 16: Javascript testing with Jasmine. How to set up Cucumber with your Ruby and Rails projects. 15: How to set up Cucumber. 14: How to set up RSpec. 13: Integration tests vs. Bogus. 12: EuRuKo 2013. 11: Reliable mocks with Bogus. 10: Designing code with RSpec.

9: Stubbing and Mocking with RSpec. Testing Tuesday #1: Tests make software. 2: From Test-Driven Development to Behavior-Driven Development. Testing Tuesday #5: Test your web apps with Selenium. 4: Continuous Integration and Deployment with Cucumber. 3: Behavior-Driven Development with Cucumber. Better Specs { rspec guidelines with ruby } Vojtajina/ng-directive-testing. Rails Conf 2013 BDD and Acceptance Testing with RSpec & Capybara. Angular Modules and RequireJS best practices? Rb: Rspec views with Rails 3. Headless Functional Testing with Selenium and PhantomJS.

Testing JavaScript with PhantomJS.

Test First / Refactor

Full stack integration testing with Rails3: browser-oriented, JavaScript, continuous integration - Muriel's Tech Blog. Wrong/examples.rb at master · alexch/wrong. The wrong way. Wrong. Secrets of the Chrome Developer Tools. Efficient Rails Test-Driven Development, Classes 1 ~ 6. Learn Ruby on Rails Testing. Mocks Aren't Stubs. Introducing BDD. What’s in a Story? Get started with testing from top to bottom. Testing Tuesday 1 ~ 12. How I learned to test my Rails Apps parts 1 ~ 5. Test Your Rails Application Configuration. Scripted GUI Testing with Ruby.