Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hits badge #108

Merged
merged 2 commits into from
Nov 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ in JavaScript for people who want to write _**more reliable code**_.
[![Dependency Status](https://david-dm.org/dwyl/learn-tdd.svg)](https://david-dm.org/dwyl/learn-tdd)
[![devDependencies Status](https://david-dm.org/dwyl/learn-tdd/dev-status.svg)](https://david-dm.org/dwyl/learn-tdd?type=dev)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dwyl/learn-tdd/issues)
[![HitCount](http://hits.dwyl.io/dwyl/learn-tdd.svg)](http://hits.dwyl.io/dwyl/learn-tdd)


## Why?

Expand All @@ -18,7 +20,8 @@ _Project(s) without tests_ often end up looking like they are stuck together wit

Change _one_ part and the _other_ stops working? "_Fixing_" one bug, creates another?

Wouldn't you *prefer* if everything was ***consistent*** and beautifully integrated?
Wouldn't you *prefer* if everything was
***consistent*** and beautifully integrated? <br />
What if _everyone_ on your team worked _like **clock-work**_ in a disciplined order... like a _**Formula 1 Crew**_ ...

![formula 1 pit stop](http://i.imgur.com/0NDbaam.jpg)
Expand All @@ -33,7 +36,8 @@ and will discover a new freedom to be ***creative*** without fear of

## What?

This tutorial will help you get started with **T**est **D**riven **D**evelopment (**TDD**) *today*!
This tutorial will help you get started with
**T**est **D**riven **D**evelopment (**TDD**) *today*! <br />
In the next ***30 minutes*** you will learn _everything_<sup>1</sup> you need to know to write tests for your web project!

### Pre-Requisites
Expand Down Expand Up @@ -72,7 +76,7 @@ When reading about TDD you will see the expression: "***Red, Green, Refactor***"

What this means is that there's a **3-step process**:

1. ***Write*** a **Failing Test** - Understand the (user) requirements/story well enough to write a test for what you expect. (_the test should **fail** initially - hence it being "Red"_)
1. ***Write*** a **Failing Test** - Understand the (user) requirements/story well enough to write a test for what you expect. (_the test should **fail** initially - hence it being "Red"_) <br />

2. ***Make*** the (*failing*) **Test Pass** - Write (*only*) the code you need
to make the (*failing*) test pass, while ensuring your existing/previous tests
Expand All @@ -86,10 +90,10 @@ we need to ***write*** a ***test first*** (*and watch it fail*) and *then* write

Writing a _**failing test**_, before writing the code may seem *counter-intuitive*, *time consuming* or even "*tedious*" at _**first**_. But we _urge_ you to think of it this way:

> The ***test*** is the ***question*** you are asking
> your code is the ***answer*** to the question.
> The ***test*** is the ***question*** you are asking <br />
> your code is the ***answer*** to the question. <br />
> By having a _clear_ question, you can always check
> that your code is working,
> that your code is working, <br />
> because it _**consistently**_
> gives you the same answer(s) ... _no surprises_, even when you're working with a large, inter-dependent code base!

Expand Down Expand Up @@ -236,7 +240,7 @@ they are really simple, there are **3 parts**:

![anatomy-of-a-unit-test](https://cloud.githubusercontent.com/assets/194400/8395876/946d5364-1d83-11e5-8e65-365a8884a194.png)

In the above screenshot, the assertion is `assert.equal(result, 2)`
In the above screenshot, the assertion is `assert.equal(result, 2)` <br />
We are giving the `equal` method two arguments; the `result` of our computation
and our expected value in this case **2**. _That's it_.

Expand All @@ -255,7 +259,7 @@ http://www.thoughtworks.com/insights/blog/test-assertions-how-do-they-work

## Requirements

As a customer, I want to buy a selected item from the **vending machine** and see what my change
As a customer, I want to buy a selected item from the **vending machine** and see what my change
is as a **result** into the various **coins** so that I can select one of the options and receive my change.

Acceptance criteria:
Expand All @@ -276,8 +280,8 @@ Acceptance criteria:
#### _Example_

If a person buys an item costing £2.15 (_we represent this as **215 pennies**_ `totalPayable`)
and pays £3 (3 x £1 or _**300 pennies**_ `cashPaid`) into the vending machine, the _**change**_ will be **85p**.
To make up this 85p of change we would _return_ **four coins** to the person: 50p, 20p, 10p and 5p.
and pays £3 (3 x £1 or _**300 pennies**_ `cashPaid`) into the vending machine, the _**change**_ will be **85p**. <br />
To make up this 85p of change we would _return_ **four coins** to the person: 50p, 20p, 10p and 5p. <br />
An **array** of these coins would look like: `[50, 20, 10, 5]`

#### Coins
Expand Down Expand Up @@ -377,7 +381,7 @@ Back in your browser window, _refresh_ the browser and watch it *fail*:

> **Q**: Why *deliberately* write a test we *know* is going to *fail*...? <br />
> **A**: To get used to the idea of *only* writing the code required to *pass*
> the *current* (*failing*) *test*.
> the *current* (*failing*) *test*. <br />
> *Read*: "***The Importance of Test Failure***: http://www.sustainabletdd.com/2012/03/importance-of-test-failure.html

#### Create the getChange `function`
Expand Down Expand Up @@ -621,9 +625,9 @@ If you see this:

![learn-tdd-showing-three-passing-tests](https://cloud.githubusercontent.com/assets/194400/8396265/ed12cc70-1d96-11e5-8fb0-f533839ba9ff.png)

_**Congratulations! You can do Test Driven Development**_ (TDD)!!
_**Congratulations! You can do Test Driven Development**_ (TDD)!! <br />

Give yourself a pat on the back! **Tweet your _success_**!
Give yourself a pat on the back! **Tweet your _success_**! <br />
_or **Re-Tweet**_: https://twitter.com/livelifelively/status/768645514120212480
[![learn-tdd](https://cloud.githubusercontent.com/assets/194400/18021179/91827edc-6bdd-11e6-8ae5-082181c0d789.png)](https://twitter.com/livelifelively/status/768645514120212480)

Expand Down Expand Up @@ -909,7 +913,7 @@ https://github.com/docdis/learn-travis

To quickly add CI support to your project:

**1**) **Visit**: https://travis-ci.org/profile and **Login** with your **GitHub account**
**1**) **Visit**: https://travis-ci.org/profile and **Login** with your **GitHub account** <br />
**2**) Enable Travis for your project
(_**Note**_: the project will need to be hosted on GitHub)

Expand All @@ -921,10 +925,10 @@ language: node_js
node_js:
- 0.12
```
**4**) Ensure that you have a **package.json** file with **test** script.
**4**) Ensure that you have a **package.json** file with **test** script. <br />
(_if in doubt, just copy-paste the **package.json** from this project!_)

**5**) **Commit** your changes and **push** them to GitHub
**5**) **Commit** your changes and **push** them to GitHub <br />
**6**) Visit the page on Travis-CI for your project. e.g: https://travis-ci.org/dwyl/learn-tdd
to see the build results.

Expand Down Expand Up @@ -984,9 +988,9 @@ In the last **90 minutes** you _**learned how**_ to:
(so that you can keep track of the test/build status for your project)
+ Use **JSDoc** to document your code using simple comment blocks above your functions.

> _Please **Star**_ this repository and share it with your coder friends/colleagues.
> Help us spread the TDD Love by re-tweeting: https://twitter.com/livelifelively/status/768645514120212480
> If you have _**any questions**_ please (_don't hesitate_) ask:
> _Please **Star**_ this repository and share it with your coder friends/colleagues. <br />
> _Help us_ spread the TDD Love by ***re-tweeting***: https://twitter.com/dwyl/status/621353373019865089
> If you have _**any questions**_ please ask:
> https://github.com/dwyl/learn-tdd/issues

- - -
Expand Down