Showing posts with label testing. Show all posts
Showing posts with label testing. Show all posts

May 9, 2015

To TDD or Not?

Here are some interesting discussions on TDD.

Pete's Write More Tests

Cedric's Pitfalls of TDD

Hacker news discussion - different than linked by Pete's writeup

Adron at Composite Code on Anti-TDD Arguments and Myths

rspec error messages

If you get this:

`require_relative': cannot load such file -- path (LoadError)


Do this:

Double-check that the files referenced by all your "require_relative" exist.
Also check that the spelling is correct and matches both ways.

If you get this:

Deprecation Warnings:

Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead.


Do this:

Replace "@book.should be_an_instance_of Book" with:

expect(@book).to be_an_instance_of Book

This is due to deprecation of the "should" syntax.

Learn rspec

I don't know TDD or BDD or rspec. All I know is you need to test your code.

According to the odin project:
Rspec is a domain specific language written in Ruby to help you test your Ruby code. Oh man, you can't use it if you ever move to Javascript or something else. Not universal I suppose.

But I haven't yet been able to get my head around "why you have to write tests before you code". How does that even work? I don't even know what I'm going to code yet or how the code will be written and ... I have to test it? Well, I'm going to spend time to understand this (view  all my reading on the matter here). Meantime, below are some resources I find useful and confusing.

Helpful resources:
Refurbished iPhones | JemJem

Confusing resources: