- You have until August 8, 2008 to move away fromPHP4.
- We already use PHPUnit and PHPT at Digg, but this DBUnit thingy has me interested.
- What should you test?
- Backend: business logic, data access layers, reusable component/libraries, etc.
- Frontend: form processing, templates, rich interfaces (AJAX/JSON), feed, web services, etc.
- Use browser based testing (Selenium / Watir) for interfaces in your acceptance tests.
- Use unit tests (PHPUnit or PHPT) for parseable results / libraries.
- Developer tests are tests that developers make to ensure the code works as designed. Acceptance tess are tests that someone makes to ensure it works as the client expects it to.
- Requirements for proper testing include a reusable test environment, automatic execution of test code, easy to learn/use, etc.
- Unit tests: PHPUnit, SimpleTest
- System tests: Selenium (PHPUnit + Selenium RC), Watir
- Non-Functional tests: ab, httperf, JMeter, Grinder, OpenSTA, etc.
- Security: Chorizo.
- PHPUnit_Extensions_Database_TestCase is a port of the DBUnit extension for JUnit to PHPUnit.
- Used for DB driven projects
- Puts your DB into a known state between test runs.
- Avoids problems with one test corrupting the database for other tests.
- Has the ability to export and import your database to and from XML datasets.
- You can use tableEquals() to compare a table created / modified by a test to either an array of expected records, an XML file or another control table. Hot.
- It outputs diff’s between the two tables for inspection. Hot.
- Avoid testing against MySQL (use SQLite) to avoid using up server resources, inter-process communication, etc. Make sure your SQL is compatible with SQLite. Tests are much faster when ran against SQLite.
- Tests that only test one thing are more informative that tests where failure can come from many sources.
- Check out the book xUnit Test Patterns.
Testing PHP/MySQL Applications with PHPUnit/DbUnit
Posted on Tuesday, April 15th, 2008 at 6:49 pm in database, db, mysql, mysqlconf
Projects
-
SimpleGeo
Ready-to-use location infrastructure for developers.
-
tweetimag.es
Consistent, predictable Twitter avatars backed by an enterpise CDN.
Open Source Projects
Net_Curl php
Net_Gearman php
Payment_Process php
Services_Digg php
Services_Facebook php
Services_Twitter php
Services_oEmbed php
Services_urlTea php
db_virtual php
framework php
jax php
python-oauth2 python
python-simplexml python
services_flickr php
Categories
/dev/random 75
2006 1
2007 1
2008election 2
505 e denny way 2
america 2
american idol 5
apache 1
apple 7
architecture 2
asia 1
back 1
barack obama 1
basketball 1
benchmarks 1
bike 2
biking 4
book reviews 3
burrito 2
bush 1
california 3
cambodia 1
cars 1
carsonified 1
change 1
charity 1
cities 1
clap your hands say yeah 1
cloud computing 3
clustering 7
code 8
coding 4
college 2
conferences 2
correlateus 1
craigslist 1
crocodile 1
database 3
db 10
death 1
debian 1
delicious 1
dieting 2
digg 10
django 1
drugs 1
ec2 1
england 2
enterprise 1
entrepreneurship 1
environment 6
europe 1
exercise 4
facebook 1
food 1
fowa 2
framework 4
fraternity 15
free speech 1
fremont 1
friends 2
funny 4
gambling 1
gdd20007 4
geek related 112
gobama 1
google 4
hacking 1
health 4
health/fitness 8
hiring 2
homecoming 1
html/css 9
i almost care 3
ian mcferon 1
in the news 85
innodb 2
internet 4
iphone 5
iraq 2
javascript 2
jokes 2
jquery 2
kasabian 1
kirkland 1
lamp 1
laos 1
libertarianism 7
lists 1
london 1
man law 1
management 2
maya 2
michigan 2
midwest 1
mississippi 1
missy higgins 1
money 1
move to seattle 12
moving 1
music 4
musings 30
mvc 1
my cat 9
mysql 16
mysqlconf 1
mysqli 1
nagios 1
neumos 1
nosql 1
obituary 1
ok go 1
open source 3
operation fat ass 1
optimization 1
parc on summit 5
partitioning 1
pear 19
personal 100
photography 1
php 38
politics 84
portland 1
pownce 1
presenations 1
programming 15
python 3
rants 10
recruiting 1
religion 1
replication 2
reviews 11
ruby 1
running 4
san diego 1
scaling 2
seattle 7
site updates 10
slippery slope 1
snowboarding 1
social media 2
social networks 2
social web 1
sports 1
ssl 1
startups 1
stupid schools 1
surgery 1
swimming 3
sxsw 1
system admin 10
talks 2
technology 1
thailand 5
the decemberists 1
theft 1
this interweb thingy 15
travel 19
trek 5200 1
triathlon 3
tv shows 12
twitter 3
Uncategorized 1
vacation 2
vietnam 1
war 2
webdave 1
wheels 1
wikipedia 1
wordpress 1
work 18
year in review 10
youtube 1
zoom 2
zorka 1