Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Dean's avatar
Level 7

Acceptance Test vs Functional Test?

I'm struggling to understand the difference between these two.

For example, going by the definitions I read, I thought to myself an acceptance test, shouldn't need the Laravel4 module (in codeception) as it isn't concerned with the inner-workings of the application. But then I came across a situation where, in what I thought was an acceptance test, I needed to access the database to make sure I was redirected to the correct url. I don't think checking that I'm redirected to the correct URL is something that shouldn't be part of an acceptance test, so I guess this simple way of discerning it is an acceptance test (by not needing the laravel4 module) has gone out the window.

On the other hand, for functional tests my simple way of knowing whether they are in fact a functional test is that I didn't need to use a 'proper' browser for my tests to run, as that's something I associated more with acceptance tests. But then I have an app where a form is generated through JS and to be able to do my functional test I need to use phantomjs + selenium. So again, my attempt of having a simple way to discern the difference between the tests has gone out the window.

0 likes
3 replies
psmail's avatar

I won't have the answer, but to get the ball rolling acceptance test are black box (i.e. the test can't see inside your app to see how it works) - so this is exactly what your user sees. Functional tests are white box (i.e. that test can see into the internal workings of your app) ... so it is kind of what your user sees .... plus a bit of an x-ray into your app.

I don't think you have to have the L4 module available to confirm a URL redirect. But there are multiple way to get / read URLs and if the one you are using requires the L4 module ... well you need to use the L4 module. Or you choose a method that does not use it, like the WebDriver module 'seeInCurrentUrl'.

I needed to access the database to make sure I was redirected to the correct url. I don't think checking that I'm redirected to the correct URL is something that shouldn't be part of an acceptance test

As soon as you need access to the database you've moved into the land of the functional test, but that is inside the 'box' that the user would not see.

And unless I am corrected (please feel free), I reckon checking a redirect would absolutely be part of an acceptance test - it is an important part of overall functionality and even from a black box point of view, the user would see it (because it happens outside of the black box).

I think a more difficult question is the line between integration and functional testing - I've seen examples that only use the unit / integration / acceptance (though some call it functional) test hierarchy and that resonates more with me.

But rest assured, this is confusing to many people. Including me.

Dean's avatar
Level 7

To elaborate on my situation, let's say the user makes a Post, and they are then redirected to this post once they make it.

Let's say the url to a post is /posts/{id}, or more specifically it's actually /posts/{hash} where hash is a hashid.

I want to test that they've been redirected to the correct url, but I need to get the id from the database. So it can't be an acceptance test if I'm interacting with the db.

I guess I can just check the content to make sure it's the correct post in my acceptance test, and then I can test the URLs are working as expected with a different form of test. Would that be the optimal way of going about this?

psmail's avatar

Yeah ... I reckon that's a functional test. And I imagine you know this and are after some more details.

So why don't I shut up for a bit and wait until someone comes along who knows more than I do on this topic (there are plenty) :)

Please or to participate in this conversation.