netalive.org

I brought up the question whether tests should call the translation API when checking for the presence of a string...

tech.puredanger.com

Unit tests are to refactoring like a drop cloth is to painting. Both feel like more work at first but ultimately save you time by allowing you to move faster...

stackoverflow.com

...no way to do it in Capybara, unfortunately. But if you're running your tests with the Selenium driver (and probably other drivers that support JavaScript), you can hack it

slideshare.net

Interesting talk about a team that integrated automated security testing into their BDD workflow. There is also a video of the talk...

makandracards.com

Updated the card with our current best practice (shared app code and specs via symlinks).

makandracards.com

Our rcov:all task for aggregated RSpec/Cucumber coverage was overhauled extensively. Among other things it now works for Rails 2...

github.com

...app such as PHP, Perl, Java / JEE, etc. I like using cucumber for functional testing so I put together this project structure to use as a starting point for testing...

jqueryElement.is(':checked')

freelancefolder.com

...this article we’ve listed 7 fresh and simple tools for cross-browser compatibility testing, tools that actually make this stuff pretty easy. Not only that, but every single one...

celerity.rubyforge.org

Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with JavaScript support. It provides a simple API for...

gusiev.com

What do we expect from the custom finder? We expect that it should find assets A, B, C and should...

makandra dev

Test suites usually grow over time as more and more development time is spent on a projects. Overall run-time and performance of Cucumber suites in turn increases, too.

When testing with Cucumber / Caypbara, iframes are ignored, so you can't interact with them. To interact with your iframe, you have to explicitly tell your driver to use it...

Geordi now supports our solution for running Selenium tests without having Firefox or Chrome windows popping up all over your workspace. This will stop Selenium windows from appearing on your...

...Understand the gem Make your changes Bump the version number Update the changelog Run tests and commit Make a pull request, or release the gem Let's look at these...

...version switch, an "if Rails version < 4 do this, else do that". Gemika (see Tests below) can help you with that, but still keep these parts as short as possible...

makandra dev

...you want to spy on a function that is imported by the code under test. This card explores various methods to achieve this. Example We are going to use the...

// client.js import { hello } from 'lib' function helloTwice() { hello() hello() } export helloTwice In our test we would like to show that helloTwice() calls hello() twice. We find out that it...

Validations should be covered by a model's spec. This card shows how to test an individual validation. This is preferrable to save an entire record and see whether it...

Recipe for testing any validation In general any validation test for an attribute :attribute_being_tested looks like this: Make a model instance (named record below) Run validations...

...ETags can again match. Before I make this change I like to add a test that ensures I did it correctly. For this add the following code to spec/requests/default_etag_spec.rb. You...

...ActionView::Base).to receive(:image_path).and_return('image') # CSRF protection is disabled in tests by default. Activate it for this spec as # randomly masked CSRF tokens are a major...

When filling out forms in Selenium tests, Chrome shows the (usual) bubble, asking to store those credentials. While the bubble does not interfere with tests, it is annoying when debugging...

...tests. Here are two ways to disable it: Option 1: prefs You can set profile preferences to disable the password manager like so: prefs = { 'credentials_enable_service' => false, 'profile.password_manager...

item 2 This card compares various approaches to fabricating DOM elements for testing. Constructing individual elements While you can use standard DOM functions to individually create and append...

A very visual method is to embedded a string of HTML into your test. My specs often have a function htmlFixtures() that parses the HTML and returns a reference...

...or when working on a project without LoDash. Booleans This one is straightforward to test with typeof: x = true typeof x === 'boolean' // => true Strings Strings can exist as literal ("foo...

...we cannot rely on typeof: typeof "foo" // => "string" typeof new String("foo") // => "object" Your test should check both forms: x = 'foo' typeof x === 'string' || x instanceof String // => true Numbers

Try to break your refactoring down in different parts. Try to make tests green for each part of your refactoring as soon as possible and only move to...

...the next big part if your tests are fixed. It's not a good idea to work for weeks or months and wait for all puzzle pieces to come together...