►
From YouTube: Test Driven Development
Description
Tutorial on how to do test driven development
- Find the bug
- Write the test case based on the bug (it should fail, since there is a bug)
- Fix the bug
- Check that the test case now passes
A
A
Essentially,
there's
operations
happening
to
a
arc,
create
our
archives
and
we
need
to
make
sure
that
we
realized
that
we
weren't,
we
didn't
have
any
sort
of
directory
structure
in
the
archive
that
we
created,
and
so
we
need
to
make
sure
that
that
we
maintain
directory
structure.
So
here's
what
we're
going
to
do
so
we're
going
to
in
this
case
we
have
the
fix
already
and
it's
in
the
archive
operations.
A
So
we're
going
to
do
is
we're
going
to
write
the
test
right,
so
we're
going
to
go
back
so
we're
going
to
revert
and
tell
before
we
had
so
because
we're
going
to
pretend
you
know
like
we're,
writing
the
code
right,
so
good
check
out
we'll
just
all
right,
we'll
check
it.
A
So
we're
gonna
revert
back
to
you
know
before
when
the
bug
existed
right,
okay,
so
pre-patch
right!
So
now
we're
just
gonna
go
and
we're
gonna
test,
we're
going
to
write
test
case
and
we're
going
to
say
test
iso
test
tar
operations
and
test
extract
tar,
ops
and
now
we're
going
to
write
a
test
case
that
helps
us
catch.
This
bug
right,
so
the
bug
is.
A
A
A
A
So
we're
going
to
actually
you
know,
yeah
we're
going
to
go
ahead
and.
A
A
All
right,
so,
let's
just
create
something
like
this
and
and
we
don't
really
need
to
do
this
whole
thing.
We
just
need
to
make
sure
that
a
tree
structure
is
perfect,
preserved
right,
so
let's
see
preserve
while
creating
a
zip,
slash
target
of
directory
structures
and
preserved,
and
then
we
see
it's
flat
here
so.
A
Working
example
here
right,
so
we
have
our
directory
structure,
so
we
have
our
output
file
path.
We
have
our
input
directory
path,
and
so
this
is
the
top
level
der
childer.
So
we
can
create
both
those
at
once
by
using
the
path
of
maker.
We
can
then
create
this
file
and
we
can
just
make
it
empty
right,
and
so
now
we'll
have
a
multi-level
directory
structure
here.
So
we
should
be
able
to
pass
this
to
make
tar
archive
and
then
we'll
observe
that
output
file
path,
we're
going
to
need
to
read
it.
A
A
All
right
and
just
always
reference,
you
know
the
standard
library
documentation
or
whatever
documentation
that
you're
using
here.
A
A
All
right
so
now
here's
where
we're
going
to
do
our
final
checks.
A
A
A
All
right
there
we
go
so
that's
our
directory
structure
and
of
the
at
the
tar
file
right.
So
so
now
we've
got
to
fill
in
our
list
so
top
of
dirt.
A
A
Okay,
let's
see
what
the
bug
is
here,
so
the
bug
only
happens
when
we're
extracted.
So
let's
go
ahead
and
extract
this
as
well
here
so
because
you
can
see
that
it
looks
like
we've
added
all
the
paths,
including
so
with
the
debug
here,
is
essentially
that
we've
gone
through
and
added
every
single
path,
and
so
what
ends
up
happening
is
that
we
overwrite
the
previous
ones
and
we
only
get
stuff
at
the
top
level.
A
So
if
we
extract,
we
should
see
that
everything
is
it's
only
at
the
top
level.
So
let's
go
ahead
and
extract
it
too,
and
then
we'll
we
will
have
our
bug
and
then
we
can
validate
from
there.
So
profile
path,
output,
directory
path,.
A
Weird,
we
don't,
we
seem
to
be
hitting
a
bigger
problem.
Even
so
the
point
is
we
write
the
test
case,
so
you
write
the
test
case
now
we're
going
to
apply
the
patch.
So,
let's
go
back
to
where
we
were
so
basically.
A
A
Right
is
that
when
we
list
the
contents
of
the
directory,
we
end
up
with
top
level
dir
double
door,
slash
child
their
one
double
dirt,
slash
tell
dur
one
slash
file
one
and
we're
using
os
path
join.
Just
because
you
know,
if
we
run
this
test
on
windows,
then
we're
gonna
have
backslashes
and
so
slashes,
so
we're
gonna.
A
Do
it
this
way
that
way,
it'll
pass
on
windows
too
so,
and
then
we
used
relative
to
to
make
sure
that
our
paths
are
getting
chopped
off
and
they
aren't
absolute
paths,
because
output
directory
cuts
probably
an
absolute
path.
Two
slash
tech,
we're
on
linux,
so
all
right!
Okay,
so
we
extract
right
now
it
doesn't
seem
like
extracting.
A
Oh
well.
You
know
why,
because
I
move
this
outside
the
temperature,
so
there's
nothing
in
that
directory.
Obviously,
okay,
let's
run
the
test
again,
yay
all
right
and
let's
go
ahead
and
sort
these
two
while
we're
at
it.
A
A
A
So
anyways
now
we
have
our
test
yeah.
So
it's
just
drop.
It's
dropping
that
top
it's
rubbing
the
top
level
dirt,
which
is
interesting.
So
it's
not
preserving
the
directory
structure
and
it's
dropping
the
top
level
directory
interesting
anyway.
So
here
we
have
our
test
case
now,
all
right.
So
now
let's
go
ahead
and
check
out
the
we're
just
going
to
copy
this.
A
There
we
go
yes,
okay,
so
this
is
the
correct
now
so
this
has
this
has
the
patch.
So
this
is
the
fix
here
on
the
left
and
there's
our
test
case
that
we
wrote
so
now.
Basically,
we
write
the
test
case
shows
the
wrong
behavior.
Now
we
write
the
fix
and
instead
of
going
through
how
we
wrote
the
fix,
we.
A
We
are
applying
the
fix
from
an
existing
commit,
so
ideally,
what
we
would
do
is
we
would
so.
This
is
an
example
where
we
wrote
the
fix
and
we
didn't
have
a
test
case
associated
with
the
bug,
so
the
ideal
workflow
here
is
you
write
the
test
case.
You
make
sure
that
it
fails
and
produces
the
exact
same
behavior
as
your
bug
report,
and
then
you
write
the
fix
and
then
all
of
a
sudden.
The
test
case
will
pass
right
because
that's
that's!
A
A
Search
directory
structure,
let's
run
them
both
all
right
and
I
got
hit
with
the
same
bug.
So
this
is
why
we're
subclassing
from
async
test
case.
A
A
There
we
go
all
right,
so
this
is
how
we
use
test
driven
development
to
solve
this.
You
know
to
validate
our
our
implementation
and
solve
our
bug.
So
now
we've
got
the
test
case
here
and
then
I'll
commit
this
up
all
right,
great.