In computer programming, unit testing is a software
testing method by which individual units of source
code, sets of one or more computer program
modules together with associated control data, usage
procedures, and operating procedures, are tested to
determine whether they are ﬁt for use.
Functional testing is a quality assurance (QA) process and a type
of black box testing that bases its test cases on the speciﬁcations of
the software component under test. Functions are tested by
feeding them input and examining the output, and internal
program structure is rarely considered (not like in white-box
testing). Functional testing usually describes what the system
Functional testing does not imply that you are testing a function
(method) of your module or class. Functional testing tests a slice
of functionality of the whole system
In engineering and its various subdisciplines, acceptance testing is
a test conducted to determine if the requirements of a
speciﬁcation or contract are met.
In software testing the ISTQB deﬁnes acceptance as: formal testing
with respect to user needs, requirements, and business processes
conducted to determine whether or not a system satisﬁes the
acceptance criteria and to enable the user, customers or other
authorized entity to determine whether or not to accept the
Acceptance testing is also known as user acceptance testing (UAT),
end-user testing, operational acceptance testing (OAT) or ﬁeld
How I think about types
Unit tests test your functions and methods.
Functional tests test parts of your application.
Acceptance tests test your interactions.
How to run tests
codecept run // runs all tests
codecept run functional // run functional tests
codecept run functional tests/functional/
AdminCanLoginCept.php // run single test
Can also add -vv or -vvv for detailed output
Using XPath for form fields
isn’t very easy to read.
XPath isn’t very easy to
When to use XPath?
When you can’t add an ID or Class on an element
When you want to ensure styles/formatting
(error messages, ﬂash messages, etc)
When testing navigation elements
When testing any dynamic elements
PhantomJS pretty broken on Travis-CI
Acceptance tests are SLOW (and memory hogs)
Acceptance tests aren’t unit tests, it can be hard
to ﬁnd WHAT is causing the tests to fail
Functional & Acceptance tests aren’t
replacements for unit tests, but can be easier to
write if your app isn’t written to be testable