📺 Develpreneur YouTube Episode

Video + transcript

DB Testing And Automation: Part 1

2022-03-15 Youtube

Detailed Notes

Database testing is fraught with challenges.  We have to find new ways to create a database replica, match the data in size and meaning as well as validate changes.  These obstacles add up to this sort of testing requires automation and careful consideration.  In this session, we look at the pitfalls and ways to properly test and validate your database.

Database Testing And Automation We cover this topic through looking at the issues, looking at the basic tools, and then what automation is needed.  The discussion stays surface level and does not go deep into any specific tools.  That way you can find this presentation useful no matter which database or environment you find your self facing.

 

The Mentor-Mastermind Group This series comes from our mentoring/mastermind classes.  These classes are virtual meetings that focus on how to improve our technical skills and build our businesses.  The goals of each member vary.  However, this diversity makes for great discussions and a ton of educational value every time we meet.  We hope you enjoy viewing this series as much as we enjoy creating it.  As always, this may not be all new to you, but we hope it helps you be a better developer.  Drop us a line to find out when the next one is so you can join our group.

Transcript Text
[Music]
so
this time i want to sit down and talk
we've we had some requests and we've
actually
sort of talked about this on the fringes
over the years
i think it made sense makes sense to
have a presentation specifically on
talking about the the challenges and the
uniqueness of dealing with testing a
database and maybe some potential
automation around that
the best thing we've talked about prior
to this for doing a lot of these this
kind of work and you can see a lot of
those discussions was when we talked
about django
within django python projects you have a
really nice
way to maintain
your database through code
we've talked a little bit about some of
the scripts and some ways to essentially
rebuild a database on the fly
similar tools if you use if you're in
the php world if you use laravel it has
some of that
there are
there's definitely a couple different
java libraries that you can do some
things like that you see sharp related
stuff
so if you
want to
do a little more maintenance of a
database within code for specific
language you can always google it and
look for the related tools that's not
something specific we're going to cover
this time we're going to look more at
uh general purpose
considerations and things like that for
for database testing
specifically we're going to talk about
first some of the data
based testing challenges the things that
are a little bit unique to dealing with
the database
and then get into some of those details
one of the main things in a database
that you want to test is making sure
that the structure and data integrity
are maintained
uh key is being able to save and load
your data correctly and consistently and
reliably
some of the more i will call advanced
topics i guess in the world database of
triggers constraints and keys
and then sort of wrap it up talking
about how do you put all this stuff
together so that you can
have some sort of a regression test or
some way to repeat your tests
with the database
so first let's look at some of the
challenges that are really unique to
database testing
the first one is that it's not just a
functionality thing so typically when
you're testing code you have a
you have some inputs and you have an
output
and that's all you have to worry about
databases are almost by
design by nature in a lot of cases it's
a side effect that you're actually
looking for because you're going to
have some inputs they're going to those
inputs are going to either change or
store or remove data you know somehow
monkey with the data in a database and
then you'll get some sort of output
well
this thing the output may be 100 correct
but then you need to still verify that
the changes that were supposed to be
done in the database were done
so that's another
you're almost testing side effects which
makes it you know a little
a little less direct in how you do
things
often in a database probably one of the
biggest challenges is that our testing
leaves a trail whether that's through
audit logs or whether that's through
data that we create and then update
we
have to somehow deal with that data we
don't want to have our test data sitting
in a production database for example
and so part of that is cleaning up we
have to have some sort of a
a mechanism to go in to test and to
essentially remove our work so our test
doesn't leave a
mark the on the data
a clean test environment can be very
difficult
you need
in some cases you need data that is not
that does not have like
patient information or personal
identifying information or
any sort of like financial ideas and
stuff like that
and they have to be
in some cases it's the challenges it has
to be a certain format but it can't be
valid for example a credit card number
now you there are
uh test credit card numbers that are out
there that you can use for such things
but
still there's sort of a limit to you
know how often you can use some of those
and without repeating your data
and then again you know we get into you
don't you don't want to mess up the
production
data you don't want to
um
have stuff out there that people may
think is is production day they may
think it's real even though it's test
and
then you have to be able to in some
cases it's how do i build this from
scratch
which is also sort of the reproducing
steps it's like hey
if i want to
put this database on a new machine
is that even possible in some cases it's
not in some case the database is this
living thing
that nobody can actually build it from
scratch anymore it's just a bunch of
changes that have gone on
and other than you know dump the
database and
import it somewhere else
and sometimes even that's really
challenging
you don't have a way to have a test
environment versus
a production environment
data integrity so how do we how does our
data uh interrelate with data within the
database
so let's talk about data integrity
what is it now you'll hear about it when
you're dealing with the database
but what does that mean well first it
means that the data is a type that makes
sense for example
if you're dealing with financial
transactions those numbers need to be
you know probably two decimal float type
or you know two or
uh two decimal precision
like a decimal a float something along
those lines if you're if it's an integer
you're going to lose information
if it's a string
then it may be very complicated to do
the kind of work you need to if you're
building a
general ledger for an accounting system
and all your
numbers are actually stored as strings
or maybe even something more complicated
than that
then you're going to have all kinds of
issues and
making equating
values searching for values things of
that nature
we also need to have
with data integrity so it's the type but
it's also
that
when we have relationship data
between tables that those
are consistent
and this often is going to be in foreign
key relationships so for example
let's say you have a person
record in the database you have a table
for people
and then people can have multiple
addresses
well the way that you link that is the
person record will have somewhere a list
of address ids
that it can go get specific address
information based on those address ids
you know it could be
one for your home address you know 83 is
your
work address id and then some other
number knows you know something else is
your
vacation home id
and so when you're searching for data
for that person
you're going to go over to the address
table and you're going to go grab for
those ids you're going to grab the
address
well part of data integrity is that that
id is pointing to a valid and the
correct address
so you can't just go in if you go in and
just change the address id for that user
from one to two
that may be a completely wrong and
different address it could even be
invalid
so one you have to make sure it actually
exists you don't want it to just go off
you know be a
a non-existent id so if i have a id of
one for my address i'd better have a
record in the address table that has
one as the id
and then two it needs to be
uh correct it needs to be the right one
and you'll see this in
uh in the results of testing of data
sometimes when there's
like a hard-coded value or something
like that then you'll see that the ids
are not what they should be it's not
generating new ids it's not pointing to
the right id
uh it may not even be storing the right
values so maybe it's storing the id to
the phone table in the address column or
vice versa things like that
along with this we need to maintain
the integrity of relationships which is
uh we'll talk a little bit but it's the
idea of cascading and things like that
so if i
delete an address record
then i need to make sure that i delete
the pointer to that address record in
you know the person table in my prior
example if i delete that person
i probably
need to delete those three address
records that were tied to that person
otherwise i have orphan records i have
these things that nothing refers to and
it becomes
just junk trash data that's sitting out
in the database
so we need to make sure that our
data puzzle pieces to build uh
whatever you know whether it's a picture
of a person or it's a
some sort of a contract
or
business transaction or whatever it is
we need to make sure that all of the
pieces of data that we need to use to
create that construct
fit together properly that they have the
right ids that they have the right types
and
that
you can recreate it so if you this is
the saving and loading idea if i save my
data
for
a person and all of the related stuff
then i need to have all of those
relationships and the data integrity put
together so that i can also come back
and
query the database and get all of that
data back
it's one thing to save it
it's another thing to be able to
reliably pull it back out to load it
from the database
so it's a it's a key part of our our
testing
hey rob before you jump ahead i got a
quick question on that sure
so if you go back to the slide
so with the data integrity would you
also include uh data encryption with
this for like hipaa and pci compliance
um yeah actually that's an excellent
question it's not something i
specifically
have called out in this presentation so
that's a that's an excellent question
good point
is
you need to be able to it's it it is
similar to the what you save you need to
be able to load back
but there are
a couple of different ways that things
can be encrypted when you store it in
the database uh sometimes it's encrypted
at the database level sometimes you
encrypt it going in and you decrypt it
coming back out and you need to make
sure you need to ensure that if you
encrypt you know something and put it
into the database
then you need to be able to either
decrypt it when you pull it back out or
reliably encrypt the same string
and be able to check it against that
value and for that example i'm thinking
about passwords because typically what
happens is we will encrypt a password
and it's a essentially it's a one-way
encryption
or some sort of hash where
we can't
find out what that password is there's
no way we can go back and figure out
what that password was originally but
what we can do is we can take a string
and encrypt it and say does that
encrypted
result match the one that's been stored
if it does then that means it's you know
it was the same password
if not then it's not the same password
so encryption is
some things you have to deal with in
general but definitely it's going to
show up more often in a database and
some of the testing there to make sure
that you
have the uh and this again goes back to
some of the data integrity pieces to
make sure that you are consistent in the
encryption library
and method that you use
uh pretty much it
usually needs to be across the database
so you're not having to figure out well
this gets encrypted this way that gets
encrypted that way
if you do
that's just more testing headache
because you just have to make sure that
in each specific case
that the encryption and the decryption
are
properly paired
any other question is that
sort of where you were thinking mike
yeah i just want to make sure we touched
on that because i think that is
something that really needs to be
considered with data integrity when
testing
yes i have agreed
so great we're going to catch a miss
there
so continuing sort of in this
saving and loading data theme
so the first thing
was we talked at the start about the
idea of this
side effect that we have so we have a
function we send some data there's some
sort of output but along the way it's
maybe saving or loading data
so
the saving side
is
you have to actually go to the database
when you make this call if it saves data
look at
it what was saved
when was it safe you need to worry about
was it
created if it needed to be created
was it updated if it needed to be
updated was it deleted if it needed to
be deleted
and then within that particularly when
you think about
i guess there's two things is if you
edit
you want to make sure that you can edit
every single one of the fields and save
the change and see that in the database
if you are creating then you need to be
able to test and ideally you're going to
go through and test
each of the fields within that record as
well to make sure that you're handling
null cases properly or invalid value
cases properly and of course obviously
the happy path where you have proper
values
on the
whatever you save you should be able to
load that back in somewhere and verify
that all of those values
are properly loaded
and this
now in some cases you're going to see
things like audit trail data there's
going to be some additional data that
you never really
it needs to it needs to appear in the
database and that's actually the only
place it's going to appear is when
you're looking in the database there's
no
programming interface or anything like
that that uses that
but that's even essentially side effects
to
doing an update or a creation or even a
deletion maybe of data is to make sure
that the other things that need to be in
place whether it's an updated time stamp
whether it's some sort of a
deleted records audit file somewhere or
audit log somewhere
uh making sure that that's that those
things are in place that those things
are properly triggered which we're gonna
talk a little bit more here we talk
about triggers
also want to make sure with the saving
and loading that a partial
um works so that if we do
a record where we're just putting like
maybe some blank values in that
it handles that properly based on the
requirements and if we load that back in
that that's also
handled according to the requirements
and by according the requirements
sometimes
empty values are not
valid or should not be allowed in some
cases they can and that's going to vary
by the requirements
you also need to
a really key
potential for a problem
which may or may not
exist in the the production server i
guess
is doing initial loads and
essentially an empty database which may
not be completely empty but it's sort of
like hey
i've got this new customer
maintenance database and it starts with
zero customers
so you need to make sure that you can
work with that that you can add that
first customer
that
when you add that data when you save
that first record then it also saves all
of the other pieces that it needs to
in order to be able to pull that record
back
because in some cases you'll see
going back to the earlier example
where you can save a customer record but
maybe you don't at that point save
addresses and so when you later try to
pull that customer you have an issue
because it can't pull an address and
maybe there's a you know it's a
requirement that you have to have an
address
so again
um some things to look at that are just
sort of like those common kind of issues
you run into with dealing with databases
and testing the data
sorry rob i have one more question
sure
if you go back
so for the save and load data would you
also consider adding a bullet point here
for testing permissions to make sure
that different account types can
do the correct permissions like they can
update or not update particular tables
yes you definitely want to take security
into account
um
this is a
that's usually more of an application
level thing
although sometimes that this is where
database test testing can be a challenge
is because sometimes there's a lot of
logic in the database and sometimes
there's
basically none
and
depending on how that goes
you may
you may need to dig into
data being updated
only when it can and that really goes to
really it's a nice little dovetail into
the next slide
you
Transcript Segments
0.62

[Music]

26.56

so

27.439

this time i want to sit down and talk

29.119

we've we had some requests and we've

30.96

actually

32.239

sort of talked about this on the fringes

34.559

over the years

36.32

i think it made sense makes sense to

37.92

have a presentation specifically on

41.36

talking about the the challenges and the

43.2

uniqueness of dealing with testing a

44.96

database and maybe some potential

47.28

automation around that

49.84

the best thing we've talked about prior

52.48

to this for doing a lot of these this

54.8

kind of work and you can see a lot of

56.64

those discussions was when we talked

58.879

about django

60.879

within django python projects you have a

63.039

really nice

64.72

way to maintain

66.56

your database through code

69.119

we've talked a little bit about some of

70.56

the scripts and some ways to essentially

72.72

rebuild a database on the fly

75.2

similar tools if you use if you're in

77.68

the php world if you use laravel it has

80.479

some of that

81.759

there are

83.04

there's definitely a couple different

84.08

java libraries that you can do some

85.68

things like that you see sharp related

87.52

stuff

88.56

so if you

90.159

want to

91.2

do a little more maintenance of a

93.2

database within code for specific

95.52

language you can always google it and

97.68

look for the related tools that's not

100.4

something specific we're going to cover

101.92

this time we're going to look more at

105.04

uh general purpose

106.96

considerations and things like that for

108.88

for database testing

111.119

specifically we're going to talk about

112.72

first some of the data

114.479

based testing challenges the things that

116.719

are a little bit unique to dealing with

119.28

the database

120.719

and then get into some of those details

123.28

one of the main things in a database

125.36

that you want to test is making sure

126.88

that the structure and data integrity

128.959

are maintained

131.039

uh key is being able to save and load

133.04

your data correctly and consistently and

135.2

reliably

136.64

some of the more i will call advanced

138.72

topics i guess in the world database of

140.959

triggers constraints and keys

143.36

and then sort of wrap it up talking

145.52

about how do you put all this stuff

147.04

together so that you can

149.28

have some sort of a regression test or

152.64

some way to repeat your tests

155.28

with the database

158.72

so first let's look at some of the

160.64

challenges that are really unique to

162.64

database testing

167.44

the first one is that it's not just a

170.239

functionality thing so typically when

172.48

you're testing code you have a

174.48

you have some inputs and you have an

176.08

output

177.04

and that's all you have to worry about

178.879

databases are almost by

181.2

design by nature in a lot of cases it's

184.319

a side effect that you're actually

186.4

looking for because you're going to

188.56

have some inputs they're going to those

190.879

inputs are going to either change or

193.04

store or remove data you know somehow

195.599

monkey with the data in a database and

198.4

then you'll get some sort of output

200.4

well

201.2

this thing the output may be 100 correct

204.239

but then you need to still verify that

206.4

the changes that were supposed to be

208

done in the database were done

211.2

so that's another

212.4

you're almost testing side effects which

214

makes it you know a little

216.4

a little less direct in how you do

218.239

things

219.599

often in a database probably one of the

221.599

biggest challenges is that our testing

224.08

leaves a trail whether that's through

226.239

audit logs or whether that's through

228.319

data that we create and then update

231.599

we

232.56

have to somehow deal with that data we

234.56

don't want to have our test data sitting

236.319

in a production database for example

239.2

and so part of that is cleaning up we

241.519

have to have some sort of a

244

a mechanism to go in to test and to

248.4

essentially remove our work so our test

250.64

doesn't leave a

252.4

mark the on the data

255.76

a clean test environment can be very

258.239

difficult

259.84

you need

261.04

in some cases you need data that is not

264

that does not have like

266.08

patient information or personal

268.56

identifying information or

271.199

any sort of like financial ideas and

273.36

stuff like that

274.88

and they have to be

277.6

in some cases it's the challenges it has

279.84

to be a certain format but it can't be

281.759

valid for example a credit card number

284.56

now you there are

286.16

uh test credit card numbers that are out

287.84

there that you can use for such things

289.52

but

291.04

still there's sort of a limit to you

292.639

know how often you can use some of those

295.12

and without repeating your data

297.84

and then again you know we get into you

299.919

don't you don't want to mess up the

302

production

303.12

data you don't want to

306.639

um

307.919

have stuff out there that people may

309.52

think is is production day they may

311.36

think it's real even though it's test

314

and

314.8

then you have to be able to in some

316.479

cases it's how do i build this from

318.96

scratch

320.08

which is also sort of the reproducing

321.68

steps it's like hey

323.44

if i want to

325.84

put this database on a new machine

328.8

is that even possible in some cases it's

330.96

not in some case the database is this

333.12

living thing

334.479

that nobody can actually build it from

337.199

scratch anymore it's just a bunch of

339.36

changes that have gone on

341.039

and other than you know dump the

343.12

database and

344.479

import it somewhere else

346.479

and sometimes even that's really

349.199

challenging

350.479

you don't have a way to have a test

351.919

environment versus

353.44

a production environment

358.639

data integrity so how do we how does our

360.88

data uh interrelate with data within the

365.12

database

367.199

so let's talk about data integrity

370

what is it now you'll hear about it when

371.68

you're dealing with the database

373.759

but what does that mean well first it

375.6

means that the data is a type that makes

378.96

sense for example

381.28

if you're dealing with financial

383.039

transactions those numbers need to be

385.84

you know probably two decimal float type

388.72

or you know two or

390.319

uh two decimal precision

392.639

like a decimal a float something along

394.639

those lines if you're if it's an integer

397.36

you're going to lose information

399.199

if it's a string

400.88

then it may be very complicated to do

404

the kind of work you need to if you're

405.68

building a

407.039

general ledger for an accounting system

409.199

and all your

410.479

numbers are actually stored as strings

412.96

or maybe even something more complicated

415.039

than that

416.24

then you're going to have all kinds of

417.84

issues and

419.039

making equating

420.84

values searching for values things of

423.52

that nature

425.52

we also need to have

427.44

with data integrity so it's the type but

429.599

it's also

431.36

that

432.319

when we have relationship data

435.039

between tables that those

437.039

are consistent

438.72

and this often is going to be in foreign

440.639

key relationships so for example

443.44

let's say you have a person

445.759

record in the database you have a table

447.44

for people

448.56

and then people can have multiple

450.479

addresses

452.16

well the way that you link that is the

454.4

person record will have somewhere a list

457.28

of address ids

459.36

that it can go get specific address

462.319

information based on those address ids

465.039

you know it could be

466.479

one for your home address you know 83 is

469.199

your

470.319

work address id and then some other

472.639

number knows you know something else is

474.56

your

475.36

vacation home id

477.599

and so when you're searching for data

479.52

for that person

480.8

you're going to go over to the address

482.24

table and you're going to go grab for

483.599

those ids you're going to grab the

485.039

address

486.24

well part of data integrity is that that

489.199

id is pointing to a valid and the

492.08

correct address

494

so you can't just go in if you go in and

496.4

just change the address id for that user

498.56

from one to two

500.08

that may be a completely wrong and

502.319

different address it could even be

504.479

invalid

505.52

so one you have to make sure it actually

507.36

exists you don't want it to just go off

509.28

you know be a

510.479

a non-existent id so if i have a id of

513.36

one for my address i'd better have a

515.68

record in the address table that has

518.08

one as the id

520.64

and then two it needs to be

522.64

uh correct it needs to be the right one

526.399

and you'll see this in

528.88

uh in the results of testing of data

531.44

sometimes when there's

532.959

like a hard-coded value or something

534.64

like that then you'll see that the ids

536.8

are not what they should be it's not

539.12

generating new ids it's not pointing to

540.88

the right id

542.16

uh it may not even be storing the right

543.839

values so maybe it's storing the id to

546.72

the phone table in the address column or

549.839

vice versa things like that

553.44

along with this we need to maintain

555.92

the integrity of relationships which is

558.88

uh we'll talk a little bit but it's the

560.959

idea of cascading and things like that

563.12

so if i

564.72

delete an address record

567.12

then i need to make sure that i delete

569.2

the pointer to that address record in

571.76

you know the person table in my prior

573.519

example if i delete that person

576.399

i probably

577.839

need to delete those three address

579.76

records that were tied to that person

581.68

otherwise i have orphan records i have

584

these things that nothing refers to and

586.72

it becomes

587.92

just junk trash data that's sitting out

590.16

in the database

592.16

so we need to make sure that our

594.64

data puzzle pieces to build uh

598

whatever you know whether it's a picture

599.76

of a person or it's a

602.24

some sort of a contract

604.88

or

606.72

business transaction or whatever it is

609.6

we need to make sure that all of the

611.04

pieces of data that we need to use to

614.079

create that construct

616

fit together properly that they have the

617.6

right ids that they have the right types

620.16

and

621.279

that

622.24

you can recreate it so if you this is

625.2

the saving and loading idea if i save my

627.279

data

628.399

for

629.68

a person and all of the related stuff

632.24

then i need to have all of those

633.6

relationships and the data integrity put

635.6

together so that i can also come back

637.519

and

638.48

query the database and get all of that

640.079

data back

641.44

it's one thing to save it

643.68

it's another thing to be able to

645.04

reliably pull it back out to load it

647.6

from the database

648.959

so it's a it's a key part of our our

651.36

testing

654.32

hey rob before you jump ahead i got a

656.16

quick question on that sure

658.399

so if you go back to the slide

661.6

so with the data integrity would you

663.68

also include uh data encryption with

666.56

this for like hipaa and pci compliance

670

um yeah actually that's an excellent

672.24

question it's not something i

673.44

specifically

675.2

have called out in this presentation so

677.12

that's a that's an excellent question

678.88

good point

680.32

is

682.56

you need to be able to it's it it is

685.279

similar to the what you save you need to

687.12

be able to load back

688.8

but there are

690.48

a couple of different ways that things

691.92

can be encrypted when you store it in

693.68

the database uh sometimes it's encrypted

696

at the database level sometimes you

698.32

encrypt it going in and you decrypt it

700.079

coming back out and you need to make

702.88

sure you need to ensure that if you

704.959

encrypt you know something and put it

707.279

into the database

709.36

then you need to be able to either

711.92

decrypt it when you pull it back out or

714.88

reliably encrypt the same string

717.6

and be able to check it against that

718.959

value and for that example i'm thinking

721.04

about passwords because typically what

722.88

happens is we will encrypt a password

725.76

and it's a essentially it's a one-way

727.6

encryption

729.2

or some sort of hash where

731.6

we can't

732.959

find out what that password is there's

735.2

no way we can go back and figure out

736.48

what that password was originally but

738.639

what we can do is we can take a string

741.44

and encrypt it and say does that

743.68

encrypted

744.959

result match the one that's been stored

747.6

if it does then that means it's you know

749.36

it was the same password

751.36

if not then it's not the same password

754.8

so encryption is

757.04

some things you have to deal with in

758.56

general but definitely it's going to

760.72

show up more often in a database and

762.56

some of the testing there to make sure

764.639

that you

765.68

have the uh and this again goes back to

768.399

some of the data integrity pieces to

769.92

make sure that you are consistent in the

772.8

encryption library

774.8

and method that you use

776.72

uh pretty much it

778

usually needs to be across the database

779.519

so you're not having to figure out well

781.76

this gets encrypted this way that gets

783.44

encrypted that way

785.519

if you do

786.639

that's just more testing headache

788.399

because you just have to make sure that

790.959

in each specific case

792.959

that the encryption and the decryption

795.44

are

796.48

properly paired

799.04

any other question is that

800.959

sort of where you were thinking mike

802.88

yeah i just want to make sure we touched

804.56

on that because i think that is

806.88

something that really needs to be

808.079

considered with data integrity when

809.839

testing

810.88

yes i have agreed

812.72

so great we're going to catch a miss

814.32

there

816.399

so continuing sort of in this

818.32

saving and loading data theme

821.36

so the first thing

822.959

was we talked at the start about the

824.56

idea of this

825.839

side effect that we have so we have a

828.56

function we send some data there's some

830.639

sort of output but along the way it's

832.639

maybe saving or loading data

835.04

so

836.24

the saving side

838.32

is

839.12

you have to actually go to the database

840.72

when you make this call if it saves data

843.519

look at

844.959

it what was saved

847.44

when was it safe you need to worry about

849.92

was it

852.24

created if it needed to be created

854.639

was it updated if it needed to be

856.079

updated was it deleted if it needed to

858

be deleted

859.6

and then within that particularly when

861.68

you think about

862.959

i guess there's two things is if you

864.56

edit

865.44

you want to make sure that you can edit

867.12

every single one of the fields and save

869.199

the change and see that in the database

872.399

if you are creating then you need to be

874.8

able to test and ideally you're going to

876.88

go through and test

878.079

each of the fields within that record as

880.48

well to make sure that you're handling

883.68

null cases properly or invalid value

886.399

cases properly and of course obviously

888.56

the happy path where you have proper

890.56

values

893.12

on the

894.24

whatever you save you should be able to

896.639

load that back in somewhere and verify

899.44

that all of those values

901.36

are properly loaded

903.519

and this

904.56

now in some cases you're going to see

905.839

things like audit trail data there's

907.519

going to be some additional data that

908.8

you never really

911.36

it needs to it needs to appear in the

913.199

database and that's actually the only

914.72

place it's going to appear is when

916.48

you're looking in the database there's

917.839

no

919.44

programming interface or anything like

921.04

that that uses that

923.12

but that's even essentially side effects

925.68

to

926.639

doing an update or a creation or even a

929.199

deletion maybe of data is to make sure

931.519

that the other things that need to be in

933.68

place whether it's an updated time stamp

936.639

whether it's some sort of a

938.639

deleted records audit file somewhere or

941.6

audit log somewhere

943.68

uh making sure that that's that those

946

things are in place that those things

947.759

are properly triggered which we're gonna

949.6

talk a little bit more here we talk

951.12

about triggers

954.079

also want to make sure with the saving

956.56

and loading that a partial

958.88

um works so that if we do

961.519

a record where we're just putting like

963.12

maybe some blank values in that

965.44

it handles that properly based on the

967.279

requirements and if we load that back in

969.839

that that's also

971.36

handled according to the requirements

973.68

and by according the requirements

975.44

sometimes

977.04

empty values are not

979.199

valid or should not be allowed in some

982.32

cases they can and that's going to vary

984.48

by the requirements

987.199

you also need to

988.88

a really key

990.959

potential for a problem

993.44

which may or may not

995.36

exist in the the production server i

998.079

guess

998.959

is doing initial loads and

1002.8

essentially an empty database which may

1004.959

not be completely empty but it's sort of

1007.04

like hey

1008.32

i've got this new customer

1010.48

maintenance database and it starts with

1012.72

zero customers

1014.8

so you need to make sure that you can

1016.32

work with that that you can add that

1018.56

first customer

1019.92

that

1020.8

when you add that data when you save

1023.199

that first record then it also saves all

1025.76

of the other pieces that it needs to

1028

in order to be able to pull that record

1029.6

back

1030.559

because in some cases you'll see

1032.72

going back to the earlier example

1034.799

where you can save a customer record but

1037.76

maybe you don't at that point save

1039.76

addresses and so when you later try to

1041.839

pull that customer you have an issue

1043.6

because it can't pull an address and

1045.679

maybe there's a you know it's a

1046.799

requirement that you have to have an

1048.96

address

1051.039

so again

1052.4

um some things to look at that are just

1054.96

sort of like those common kind of issues

1056.559

you run into with dealing with databases

1058.799

and testing the data

1061.919

sorry rob i have one more question

1064

sure

1064.88

if you go back

1066.64

so for the save and load data would you

1068.4

also consider adding a bullet point here

1070.72

for testing permissions to make sure

1072.72

that different account types can

1074.88

do the correct permissions like they can

1077.28

update or not update particular tables

1080.559

yes you definitely want to take security

1082.4

into account

1084

um

1085.039

this is a

1087.36

that's usually more of an application

1089.84

level thing

1091.36

although sometimes that this is where

1093.679

database test testing can be a challenge

1095.76

is because sometimes there's a lot of

1097.919

logic in the database and sometimes

1100

there's

1100.88

basically none

1102.48

and

1103.44

depending on how that goes

1106.24

you may

1107.28

you may need to dig into

1109.36

data being updated

1111.44

only when it can and that really goes to

1114.4

really it's a nice little dovetail into

1116.08

the next slide

1132.16

you