📺 Develpreneur YouTube Episode

Video + transcript

DB Testing And Automation: Part 2

2022-03-17 •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]
which is when you talk about triggers
and constraints and keys is that
what you have triggers are basically
going to be
if i update delete or insert a record
then here's some extra things that need
to be done which is usually um
it may be cascading kind of
functionality so if i delete this record
i need to delete its related records
it may be a essentially a time stamp
kind of thing that says okay if i
insert this record i need to somewhere
create and you know either set a value
or
insert a record that says that this
record was created at this time or this
record was updated at this time
or even sometimes it's
this record at this time was updated
with these values
there's also going to be constraints
there's going to be things where you
can't
there's certain records that you're not
going to be able to delete unless you
first delete
a parent record or
records that are pointing to it
and sometimes this fall sometimes this
is by
design for the data integrity sometimes
they're going to be
these constraints and even some of the
triggers are going to be
essentially their security and
permission related kinds of things
so
there may be fields in a record
that are not supposed to be updated
they're only updated
by
maybe some triggers and constraints as
opposed to directly updating
and this becomes again where you're
gonna have to look at the requirements
and see
how
it's laid out
because it may be that there are
restrictions to how data is inserted or
updated it may be that there is there
should be no direct way
which is not uncommon where there will
be cases where there's no direct way
other than within the database to
[Music]
to change certain data and sometimes
even within the database unless you have
a specific level of access
then you know where basically you have
to you know just like turn off triggers
or constraints
you're not going to be able to change
the data
so security can be
application level that you you would see
and deal with as you normally do
but sometimes you're going to run into
such things in done at the database
level as well
so it's it's not only in the save and
load going back to that idea a little
bit
of
making sure that
things that uh you want to change change
there's also there's things that
shouldn't change and making sure that
they don't sometimes it's as simple as
a create versus an update timestamp
you
and there are you'll see bugs where
every time you update it updates the
created timestamp which is incorrect you
actually need to
you want to have a timestamp of when
that record was first created and then
separately you have something that shows
when it was last changed when it was
last updated
and so you on an update you don't want
to see that creation date
change and this stuff again can be very
uh complicated
and you may have to have very specific
tests that you're creating to validate
those kinds of
those restrictions
and when thinking about triggers
constraints and keys
um
i've sort of cut touched these but i
went from a bullet point of view it may
help a little bit
is it one uh up here in the top right
you really need to deal with updates
inserts and deletes those are really the
the three main
actions that will prob that may have
related triggers and constraints
and so you have to consider each of
those three actions
almost with every
record or table
and how that how you want to test that
and verify it
there may be side effect requirements
which are your triggers your constraints
related keys and things of that nature
so it
an update may not be as simple as i just
checked those couple of values i updated
there may be other things i have to
check to make sure that those side
effects that happen when data is changed
are properly being done
you always have to do
null testing essentially empty you know
invalid values
invalid relationships missing data
partial data and
so and that can be you know sometimes it
can be very
uh a lot very detail-oriented very just
tedious because there's just a lot of
data if you've got a field that's got
uh you know records got 20 different
columns on it then you may have to do
effectively you know at least 20
different tests
uh i should be more way more than that
you know for each field testing what if
i send it what if i set something
invalid what if i set something empty
what if i do the value you know the
happy path
and with all of these that we've already
talked about
there needs to be the proper
uh messages or notifications that are
involved with this because sometimes
these things are written and it's just
if it breaks it breaks and then your
application's dead
but typically what should happen is
there should be some sort of a
a response that comes back so that you
can
see that hey this is you know this is
invalid data that that was attempted to
work with
you need to with the
the testing one of the challenges
sometimes there's going to be unique
values
i think a lot of in current world a lot
of times it may be a phone number but it
may also be like an email address that
based on requirements these things need
to be unique within
your data within the sets
and you just it's a challenge to
generate all those unique things
now the nice thing is that there are
uh key generators and unique id
generators and things like that there's
some random tools out there
uh actually even we have an app that we
talked about way back that is our own
little
random data generator built for
databases and to put random stuff in
and
we need to be able to do that sometimes
to get a valid amount of test data but
then when we do so we also need to make
sure that is that we're tracking the ids
that were generated because we're going
to talk about cleaning up later
and we also need to make sure
that we did not have
a
we sort of like where we miss coverage
in our testing by using too much of the
same thing
so
um you know sometimes they're like for
example testing a a user
we use the name like john smith or john
doe a whole lot
but you also want to test
other things is maybe throw some special
characters like that that you would see
like a hyphen
um
a comma things like that within a name
maybe
you also want to do like longer shorter
names uh what happens if it's a first
name last name versus first middle last
and things like that
that you do see these in other testing
but
it's much more prevalent in the database
world because we're dealing with the
data itself and the formats of it
and all of this i've related a couple
times i've
mentioned this couple times is the whole
idea of cascading updates and changes so
there are potentially other records
they're going to change based on the
update that you made
uh it may be that there's uh like an
address record somewhere that needs to
be changed there may be something that
says that this record changed so you may
have to go to some other table in the
database and make sure that the change
that you made was properly recorded
again this goes back to the requirements
and
the challenge on all of this
is that it is not uncommon for the
requirements to be
sparse related to how some of this stuff
works
that it's it's the kind of stuff that is
not uncommon for there to be things that
are missed and it's not until you start
testing it and you say hey
i had this happen what is that supposed
to work is that not supposed to work
how is that supposed to work
and so sometimes you're going to have to
go back and you're basically validating
requirements as part of going through
the database testing
and i've mentioned these but now
specifically
audit logs and tracking
when we're doing updates like i said
often there's going to be some sort of
trigger constraints and things that make
sure that
records exist that they don't exist when
they shouldn't exist and along with that
we're going to have some time stamps and
maybe other logging that says
this data was created at this day maybe
by this person so not just time stamps
but some sort of a user id needs to be
part of that
um and in part of your testing you need
to make sure that the
the user ids that are tracked works for
the valid users being able to do that
this may even include
permissions inside the data itself so
you may have a permission table
somewhere that you need to make sure
that this person
can
update this if they have this you know
the correct permission and if they don't
have that permission that they can't
update or create that record
and again it's going to go back to
requirements and making sure that those
are laid out properly and that you can
test and validate those properly
there's usually going to be differences
between
inserting or creating records and
updating records modifying records
and make sure that
the side effects related to that the
audit logs uh whether it's a a text log
file somewhere or
it may be a database table somewhere it
may be fields within that record or it
may be a whole other table
that does the that provides that audit
log
there's things like shadow tables and
that where it's essentially as a record
is
modified in one table there's a record
entered somewhere else in this shadow
table that says this record was modified
at this time here's how it's modified
so you need to make sure that those are
properly being logged those
those entries are being created properly
it may be a database change it may be a
file it may be both so there may be some
sort of database level logging that you
want to verify
and this is sort of you one i want to
verify that it
is
displaying the things it needs to but
also in a security in a
world of hipaa and all these other
requirements that are out there you want
to make sure that the values are not in
a log file that shouldn't be in a long
time
so for example you don't want to be able
to look at a log file and see valid
credit card numbers that that should not
exist
you don't really and if it does
if there for some reason that's needed
for some sort of logging then that needs
to be
properly secured
all that kind of good stuff so you want
to make sure that and score goes back a
little bit back to that correct
encryption concept
values that need to be that should be
encrypted you need to make sure that
they were
properly encrypted in the database so if
i save a password and it's supposed to
be i'm the only one that ever knows what
that password is i should not be able to
go look in a database table somewhere
and see what that database or what that
password was
you need to verify
this goes back to really your
relationships
within the data is make sure that when
the audit logs
that you're verifying those that it's
also the
the user ids or names are properly being
tracked again it's not uncommon that
you'll have sort of a essentially a
hard-coded value somewhere
where everything is
uh and it may not even be hard-coded it
may be how the application works
that the application
logs in as
you know like the super user for the
database
and all the transactions are then
based on that super user as opposed to
the actual user you know that like if
it's me and i if i make a change
i need to make sure that my
name my id is tied to that change as to
posted just being the super user
and that's again not an uncommon
occurrence where the application
connects as a certain user and then you
see all the audit trails just showed
that user making changes that
application user as opposed to
an actual
logged in user that's that's not just
the application but it's a person that
you can tie that back to
and again it goes to the idea of
what i put into the database
i need to be able to get that back out
properly so if i
if i know that rob is
updating this data
and i need to have audit trails based on
that i should be able to get back out of
the database that rob made this change
at this time
and again
this goes back to your your requirements
as well
making sure you understand them and that
they properly
detail what needs to be done
within that
cleaning up your mess
this is
often one of the biggest challenges
one is having test data that works or
that
matches needs sometimes test data is
just a handful of records when which you
really need to test is
at scale so you may need to have maybe
even millions of records
available for your testing to make sure
that you can test the performance make
sure that
things work
even in the what's going to be the at
least close enough to the production
environment
and it's not uncommon in the database
world that it works awesome when you've
got 10 records in there it does not work
at all when you put a hundred thousand
records or a million records in there
so you need to have
properly sized test data as far as
amount
but then we have the cleanup
aspect of
if i go in and especially whether it's i
guess it really doesn't matter whether i
manually do it or script it
if i run tests and they change data or
create data or delete data
then
there may be there's going to be audit
log entries related to that
there may be
test data that's now sitting around my
database
so part of our cleanup is we need to
have
ideally and sometimes it's not possible
for the most part we want to be able to
roll back those changes so i can go in i
can create i have sort of a
test script but then i have a cleanup
script that goes back and for everything
that i just did in my testing
it's going to clean that stuff back up
either mark it inactive or delete it if
that's possible
ideally i want to be able to remove the
audit trail of that as well
because
if somebody's doing audit trail research
they don't want to have all these test
entries that they're having to dig
through
so sometimes i have that that side
effect of data changes that i need to
take into account as part of my cleanup
there may be
in some cases there may be
auto-generated values keys and things
like that that are generated
that i now want to reset those counters
for example if i am starting from
essentially a clean database
i may have this integer related id that
starts at one
and if i go and do a bunch of testing i
don't want it now to start at you know
4058 because that's how many test
records i created so i may have to
actually go back and reset
some of those
counters and
id generators
that's not as common
it shouldn't be an issue but sometimes
it is
uh particularly
with regard to
smaller data sets that are essentially
lookup values like if you want to have
if you have like account types let's say
it's a financial system then you have
these different account types
and there's only 10 account types well
you may
find it much better to have those
account type numbers at basically one
through ten
and if you're doing a bunch of testing
related to that you don't want it simply
to blow it out so that the numbers are
non-sequential and are
in the thousands or higher
you may not be able to fully clean up so
instead you may need some way to tag
your test data
sometimes this is
easy to do sometimes it's a matter of
maybe there's a note or a description
field or some sort of free text enough
that you can put you know the word test
in it or something like that or test
record do not touch test account do not
use
sometimes it's certain id values
so you can go back and
maybe make sure that stuff is tagged in
a certain way or configured in a certain
way
it may be that how you do it you just
need to communicate that when i test
these are things that are
tags or markers so you can tell that
this was test data and not something
that is
i don't say real data
the idea of
a test image or a staging image
or even data reloads
is
becoming
i was going to say it's got gotten a
little better but
sometimes now with cloud databases and
things like that not as much
because when you're dealing with a cloud
database sometimes there's there's a
cost to those transactions
and it's expensive to run all those
tests and then
run a bunch more transactions to clean
it up
one way to get around some of that
is basically drop a database and rebuild
it
sometimes
that's really the approach you want to
take is that you want to
before your test start do a database
backup
you go in you run all your testing and
then when you're done and your cleanup
is simply that you re restore
the database from that backup point that
you took
sometimes that's the easiest way to get
around it is just let's skip all the
trouble and i'm just gonna back it up
and when i'm gonna i'm done i'm gonna
restore the database
in production that may not be feasible
but particularly with the idea of if you
have a test database
that may be something that you
look at maybe it exists if not maybe you
recommend it that there is some sort of
a test image
in some cases specifically with
continuous integration and development
deployment
there may be a
database
image that is just reloaded on a on a
daily or weekly basis so when i do a
build maybe one of the things i do is i
just go restore
a pristine version of the database
make some database you know if there's
changes that have to be done to that
database i make the changes and then i
boom take a snapshot
and the next time i want to get a i'll
call it clean database and quotes
then i just reload that image
that may or may not be feasible but
a lot of times that's going to be the
the best
and most efficient way to do it because
then you don't have to deal with what
did i change you just go back to that
essentially that save point
you
Transcript Segments
0.48

[Music]

26.24

which is when you talk about triggers

28.56

and constraints and keys is that

32.96

what you have triggers are basically

34.559

going to be

35.68

if i update delete or insert a record

38.239

then here's some extra things that need

40

to be done which is usually um

42.879

it may be cascading kind of

44.64

functionality so if i delete this record

46.559

i need to delete its related records

49.12

it may be a essentially a time stamp

51.12

kind of thing that says okay if i

53.76

insert this record i need to somewhere

55.68

create and you know either set a value

58.32

or

59.12

insert a record that says that this

61.039

record was created at this time or this

63.12

record was updated at this time

65.84

or even sometimes it's

67.84

this record at this time was updated

70.4

with these values

72.96

there's also going to be constraints

74.4

there's going to be things where you

75.52

can't

77.04

there's certain records that you're not

78.159

going to be able to delete unless you

79.6

first delete

81.2

a parent record or

83.84

records that are pointing to it

86.96

and sometimes this fall sometimes this

88.799

is by

90.479

design for the data integrity sometimes

92.88

they're going to be

94

these constraints and even some of the

96.159

triggers are going to be

98.32

essentially their security and

99.68

permission related kinds of things

101.92

so

103.04

there may be fields in a record

106.64

that are not supposed to be updated

109.52

they're only updated

111.439

by

112.399

maybe some triggers and constraints as

114.24

opposed to directly updating

117.2

and this becomes again where you're

118.719

gonna have to look at the requirements

120.079

and see

121.52

how

122.64

it's laid out

124.719

because it may be that there are

125.84

restrictions to how data is inserted or

129.599

updated it may be that there is there

131.76

should be no direct way

133.84

which is not uncommon where there will

135.36

be cases where there's no direct way

138.319

other than within the database to

140.11

[Music]

141.68

to change certain data and sometimes

143.92

even within the database unless you have

145.92

a specific level of access

148.48

then you know where basically you have

150.48

to you know just like turn off triggers

152.4

or constraints

153.68

you're not going to be able to change

154.959

the data

156.48

so security can be

158.879

application level that you you would see

161.36

and deal with as you normally do

163.519

but sometimes you're going to run into

164.72

such things in done at the database

166.8

level as well

168.48

so it's it's not only in the save and

170.72

load going back to that idea a little

172.319

bit

173.04

of

174

making sure that

175.84

things that uh you want to change change

179.36

there's also there's things that

181.04

shouldn't change and making sure that

182.8

they don't sometimes it's as simple as

185.92

a create versus an update timestamp

189.28

you

190.08

and there are you'll see bugs where

191.92

every time you update it updates the

193.44

created timestamp which is incorrect you

195.84

actually need to

197.599

you want to have a timestamp of when

199.12

that record was first created and then

201.44

separately you have something that shows

203.04

when it was last changed when it was

204.72

last updated

206.72

and so you on an update you don't want

209.04

to see that creation date

211.28

change and this stuff again can be very

214.959

uh complicated

216.64

and you may have to have very specific

219.12

tests that you're creating to validate

221.92

those kinds of

224.159

those restrictions

226.56

and when thinking about triggers

227.76

constraints and keys

229.84

um

231.28

i've sort of cut touched these but i

233.2

went from a bullet point of view it may

234.959

help a little bit

236.239

is it one uh up here in the top right

239.68

you really need to deal with updates

241.28

inserts and deletes those are really the

244.64

the three main

246.4

actions that will prob that may have

248.4

related triggers and constraints

251.36

and so you have to consider each of

252.959

those three actions

254.959

almost with every

256.799

record or table

258.72

and how that how you want to test that

260.56

and verify it

262.16

there may be side effect requirements

264.32

which are your triggers your constraints

267.28

related keys and things of that nature

269.199

so it

270.08

an update may not be as simple as i just

272.56

checked those couple of values i updated

274.8

there may be other things i have to

276.72

check to make sure that those side

278.56

effects that happen when data is changed

280.96

are properly being done

284.4

you always have to do

286.16

null testing essentially empty you know

288.16

invalid values

289.759

invalid relationships missing data

292.16

partial data and

293.919

so and that can be you know sometimes it

295.919

can be very

297.28

uh a lot very detail-oriented very just

300.639

tedious because there's just a lot of

302.24

data if you've got a field that's got

305.12

uh you know records got 20 different

307.039

columns on it then you may have to do

309.28

effectively you know at least 20

311.28

different tests

312.56

uh i should be more way more than that

314.4

you know for each field testing what if

316.16

i send it what if i set something

317.84

invalid what if i set something empty

320.24

what if i do the value you know the

321.36

happy path

323.36

and with all of these that we've already

325.039

talked about

326.72

there needs to be the proper

328.72

uh messages or notifications that are

331.919

involved with this because sometimes

334.24

these things are written and it's just

335.6

if it breaks it breaks and then your

337.28

application's dead

339.039

but typically what should happen is

340.4

there should be some sort of a

342.479

a response that comes back so that you

345.12

can

346.24

see that hey this is you know this is

348.16

invalid data that that was attempted to

351.12

work with

353.199

you need to with the

354.8

the testing one of the challenges

357.44

sometimes there's going to be unique

358.88

values

360.639

i think a lot of in current world a lot

363.12

of times it may be a phone number but it

365.6

may also be like an email address that

368

based on requirements these things need

369.84

to be unique within

371.84

your data within the sets

374.56

and you just it's a challenge to

376.319

generate all those unique things

379.12

now the nice thing is that there are

381.52

uh key generators and unique id

383.6

generators and things like that there's

385.039

some random tools out there

387.199

uh actually even we have an app that we

388.96

talked about way back that is our own

390.639

little

392.08

random data generator built for

394.24

databases and to put random stuff in

398.4

and

399.6

we need to be able to do that sometimes

401.84

to get a valid amount of test data but

404.479

then when we do so we also need to make

406.319

sure that is that we're tracking the ids

409.44

that were generated because we're going

411.039

to talk about cleaning up later

413.28

and we also need to make sure

415.68

that we did not have

418

a

420.08

we sort of like where we miss coverage

422.08

in our testing by using too much of the

424.56

same thing

425.68

so

426.72

um you know sometimes they're like for

428.639

example testing a a user

433.12

we use the name like john smith or john

435.12

doe a whole lot

436.56

but you also want to test

438.56

other things is maybe throw some special

440.96

characters like that that you would see

442.479

like a hyphen

444.24

um

445.12

a comma things like that within a name

447.199

maybe

448.24

you also want to do like longer shorter

450.88

names uh what happens if it's a first

453.28

name last name versus first middle last

455.84

and things like that

457.84

that you do see these in other testing

461.039

but

461.759

it's much more prevalent in the database

463.68

world because we're dealing with the

466

data itself and the formats of it

469.68

and all of this i've related a couple

471.199

times i've

472.16

mentioned this couple times is the whole

473.44

idea of cascading updates and changes so

476.56

there are potentially other records

478.879

they're going to change based on the

480.639

update that you made

482.24

uh it may be that there's uh like an

484.639

address record somewhere that needs to

486.08

be changed there may be something that

487.52

says that this record changed so you may

489.84

have to go to some other table in the

491.919

database and make sure that the change

495.039

that you made was properly recorded

498

again this goes back to the requirements

500.639

and

502.4

the challenge on all of this

504.879

is that it is not uncommon for the

506.96

requirements to be

508.879

sparse related to how some of this stuff

511.12

works

512

that it's it's the kind of stuff that is

513.76

not uncommon for there to be things that

515.519

are missed and it's not until you start

517.519

testing it and you say hey

520.64

i had this happen what is that supposed

522.719

to work is that not supposed to work

524.72

how is that supposed to work

527.2

and so sometimes you're going to have to

528.399

go back and you're basically validating

530.56

requirements as part of going through

532.8

the database testing

537.36

and i've mentioned these but now

539.2

specifically

540.56

audit logs and tracking

543.44

when we're doing updates like i said

545.519

often there's going to be some sort of

546.959

trigger constraints and things that make

549.44

sure that

550.72

records exist that they don't exist when

552.88

they shouldn't exist and along with that

554.24

we're going to have some time stamps and

556.16

maybe other logging that says

558.32

this data was created at this day maybe

560.72

by this person so not just time stamps

562.88

but some sort of a user id needs to be

565.279

part of that

566.72

um and in part of your testing you need

568.64

to make sure that the

570.32

the user ids that are tracked works for

573.6

the valid users being able to do that

576.959

this may even include

578.88

permissions inside the data itself so

581.04

you may have a permission table

582.48

somewhere that you need to make sure

584.32

that this person

585.92

can

586.959

update this if they have this you know

588.8

the correct permission and if they don't

590.56

have that permission that they can't

592.08

update or create that record

594.72

and again it's going to go back to

596.399

requirements and making sure that those

598.08

are laid out properly and that you can

601.04

test and validate those properly

604.959

there's usually going to be differences

606.64

between

608.24

inserting or creating records and

610.16

updating records modifying records

613.44

and make sure that

615.12

the side effects related to that the

616.72

audit logs uh whether it's a a text log

620.079

file somewhere or

621.76

it may be a database table somewhere it

624.16

may be fields within that record or it

625.92

may be a whole other table

628.079

that does the that provides that audit

630.48

log

631.68

there's things like shadow tables and

633.44

that where it's essentially as a record

635.519

is

636.72

modified in one table there's a record

639.44

entered somewhere else in this shadow

641.2

table that says this record was modified

643.839

at this time here's how it's modified

647.279

so you need to make sure that those are

649.68

properly being logged those

652.64

those entries are being created properly

656.079

it may be a database change it may be a

658

file it may be both so there may be some

660.079

sort of database level logging that you

661.92

want to verify

663.6

and this is sort of you one i want to

665.36

verify that it

666.8

is

667.6

displaying the things it needs to but

669.76

also in a security in a

672

world of hipaa and all these other

674.64

requirements that are out there you want

676.56

to make sure that the values are not in

678.88

a log file that shouldn't be in a long

680.72

time

681.6

so for example you don't want to be able

683.12

to look at a log file and see valid

685.2

credit card numbers that that should not

687.36

exist

689.04

you don't really and if it does

691.12

if there for some reason that's needed

692.64

for some sort of logging then that needs

694.399

to be

695.279

properly secured

697.2

all that kind of good stuff so you want

699.2

to make sure that and score goes back a

700.959

little bit back to that correct

702.56

encryption concept

704.64

values that need to be that should be

706.24

encrypted you need to make sure that

707.44

they were

708.399

properly encrypted in the database so if

711.2

i save a password and it's supposed to

713.279

be i'm the only one that ever knows what

714.959

that password is i should not be able to

717.6

go look in a database table somewhere

720

and see what that database or what that

722

password was

725.36

you need to verify

727.519

this goes back to really your

729.36

relationships

731.36

within the data is make sure that when

732.959

the audit logs

734.639

that you're verifying those that it's

736.48

also the

737.92

the user ids or names are properly being

741.6

tracked again it's not uncommon that

743.92

you'll have sort of a essentially a

745.519

hard-coded value somewhere

747.519

where everything is

749.68

uh and it may not even be hard-coded it

751.36

may be how the application works

754.399

that the application

756.079

logs in as

757.68

you know like the super user for the

759.68

database

761.68

and all the transactions are then

764.24

based on that super user as opposed to

767.68

the actual user you know that like if

770.48

it's me and i if i make a change

773.6

i need to make sure that my

775.68

name my id is tied to that change as to

778.639

posted just being the super user

781.12

and that's again not an uncommon

783.36

occurrence where the application

785.04

connects as a certain user and then you

787.36

see all the audit trails just showed

788.88

that user making changes that

790.959

application user as opposed to

793.44

an actual

795.36

logged in user that's that's not just

797.279

the application but it's a person that

799.519

you can tie that back to

802.399

and again it goes to the idea of

805.68

what i put into the database

808.24

i need to be able to get that back out

810.24

properly so if i

812.24

if i know that rob is

815.2

updating this data

817.04

and i need to have audit trails based on

819.44

that i should be able to get back out of

821.839

the database that rob made this change

824.32

at this time

825.68

and again

826.72

this goes back to your your requirements

828.639

as well

830.399

making sure you understand them and that

832.639

they properly

835.519

detail what needs to be done

838

within that

841.44

cleaning up your mess

844.88

this is

847.04

often one of the biggest challenges

850.24

one is having test data that works or

853.04

that

853.839

matches needs sometimes test data is

856.72

just a handful of records when which you

858.56

really need to test is

860.959

at scale so you may need to have maybe

862.959

even millions of records

864.959

available for your testing to make sure

867.04

that you can test the performance make

869.44

sure that

870.72

things work

872

even in the what's going to be the at

873.92

least close enough to the production

875.36

environment

876.56

and it's not uncommon in the database

878.399

world that it works awesome when you've

880.079

got 10 records in there it does not work

882.32

at all when you put a hundred thousand

883.519

records or a million records in there

887.12

so you need to have

888.48

properly sized test data as far as

891.199

amount

892.56

but then we have the cleanup

894.32

aspect of

896.72

if i go in and especially whether it's i

899.04

guess it really doesn't matter whether i

900.56

manually do it or script it

902.399

if i run tests and they change data or

905.36

create data or delete data

908.24

then

909.44

there may be there's going to be audit

910.8

log entries related to that

912.8

there may be

914.72

test data that's now sitting around my

916.32

database

917.76

so part of our cleanup is we need to

919.519

have

920.399

ideally and sometimes it's not possible

923.12

for the most part we want to be able to

925.04

roll back those changes so i can go in i

927.839

can create i have sort of a

930.079

test script but then i have a cleanup

931.68

script that goes back and for everything

933.6

that i just did in my testing

935.759

it's going to clean that stuff back up

938

either mark it inactive or delete it if

940.56

that's possible

942.8

ideally i want to be able to remove the

945.199

audit trail of that as well

947.92

because

949.199

if somebody's doing audit trail research

951.839

they don't want to have all these test

953.839

entries that they're having to dig

955.12

through

956

so sometimes i have that that side

958.48

effect of data changes that i need to

961.519

take into account as part of my cleanup

965.279

there may be

966.639

in some cases there may be

967.839

auto-generated values keys and things

970.24

like that that are generated

972.48

that i now want to reset those counters

976.16

for example if i am starting from

978.48

essentially a clean database

980.72

i may have this integer related id that

983.36

starts at one

985.199

and if i go and do a bunch of testing i

987.519

don't want it now to start at you know

990.36

4058 because that's how many test

992.8

records i created so i may have to

995.04

actually go back and reset

997.759

some of those

999.04

counters and

1000.32

id generators

1001.839

that's not as common

1004.56

it shouldn't be an issue but sometimes

1006.48

it is

1007.519

uh particularly

1009.839

with regard to

1012.56

smaller data sets that are essentially

1014.24

lookup values like if you want to have

1017.44

if you have like account types let's say

1019.12

it's a financial system then you have

1021.44

these different account types

1023.199

and there's only 10 account types well

1025.199

you may

1026.24

find it much better to have those

1027.839

account type numbers at basically one

1029.679

through ten

1030.799

and if you're doing a bunch of testing

1032

related to that you don't want it simply

1033.6

to blow it out so that the numbers are

1036.079

non-sequential and are

1038.4

in the thousands or higher

1042.88

you may not be able to fully clean up so

1045.839

instead you may need some way to tag

1048

your test data

1049.52

sometimes this is

1051.84

easy to do sometimes it's a matter of

1054.96

maybe there's a note or a description

1056.64

field or some sort of free text enough

1060.799

that you can put you know the word test

1062.96

in it or something like that or test

1065.2

record do not touch test account do not

1067.6

use

1068.88

sometimes it's certain id values

1071.919

so you can go back and

1073.84

maybe make sure that stuff is tagged in

1075.679

a certain way or configured in a certain

1078

way

1079.84

it may be that how you do it you just

1081.679

need to communicate that when i test

1084.16

these are things that are

1086.16

tags or markers so you can tell that

1088.88

this was test data and not something

1091.039

that is

1092

i don't say real data

1096.88

the idea of

1099.679

a test image or a staging image

1103.039

or even data reloads

1105.919

is

1107.6

becoming

1109.2

i was going to say it's got gotten a

1110.64

little better but

1112.16

sometimes now with cloud databases and

1114.08

things like that not as much

1117.039

because when you're dealing with a cloud

1118.48

database sometimes there's there's a

1121.039

cost to those transactions

1123.76

and it's expensive to run all those

1126.48

tests and then

1128

run a bunch more transactions to clean

1129.919

it up

1131.12

one way to get around some of that

1133.679

is basically drop a database and rebuild

1135.76

it

1136.799

sometimes

1138.32

that's really the approach you want to

1139.76

take is that you want to

1142.16

before your test start do a database

1144.72

backup

1146.32

you go in you run all your testing and

1148.799

then when you're done and your cleanup

1150.48

is simply that you re restore

1153.039

the database from that backup point that

1154.88

you took

1156.32

sometimes that's the easiest way to get

1158

around it is just let's skip all the

1160.08

trouble and i'm just gonna back it up

1161.6

and when i'm gonna i'm done i'm gonna

1163.28

restore the database

1165.36

in production that may not be feasible

1168.16

but particularly with the idea of if you

1170.24

have a test database

1172.4

that may be something that you

1174.32

look at maybe it exists if not maybe you

1176.799

recommend it that there is some sort of

1178.559

a test image

1180.24

in some cases specifically with

1182.96

continuous integration and development

1185.2

deployment

1186.799

there may be a

1188.64

database

1190.16

image that is just reloaded on a on a

1193.039

daily or weekly basis so when i do a

1195.679

build maybe one of the things i do is i

1197.679

just go restore

1199.76

a pristine version of the database

1202.159

make some database you know if there's

1203.6

changes that have to be done to that

1205.12

database i make the changes and then i

1207.919

boom take a snapshot

1210.08

and the next time i want to get a i'll

1212.799

call it clean database and quotes

1215.679

then i just reload that image

1219.039

that may or may not be feasible but

1221.28

a lot of times that's going to be the

1222.799

the best

1224.08

and most efficient way to do it because

1225.76

then you don't have to deal with what

1227.6

did i change you just go back to that

1230.08

essentially that save point

1247.28

you