I am deeply confused the difference. I've read so many definitions and they always explain functional test as testing the requirement is satisfied. Well, that's just rephrasing the name
functional test. That doesn't clarify the difference.
I am interested in some real code to demonstrate the difference.
Suppose we have a function in a library performs hashing:
def custom_hasher(scheme, val): # use many hashing libraries... def hasher(inlist, scheme): """ Take a list and outputs the hashed values of a list. """ output = list() for val in inlist: output.append(custom_hasher(scheme, val)) return output
Now for a functional test, I am guessing we want to test
['a', 'b'] is returned as something like
['jask34sdasdas', 'asasjdk234sjdk'] given some scheme.
But that's just about what an integration test can do! I know exactly what type input I want (I want good execution so I pass in a list), or I want it to raise
Object has no append method exception if I pass in a dictionary.
I can do that in both. Where's the distinction?
Another example is some web app:
@logged_in # only logged in user can do this @route("/invite", method=['POST']) def send_invite(request): recp_email = request.data['recp_email'] # now do a bunch of logics before and after sending an email
So in my integration test, I will definitely do this over a network (have the server running). Send some request to this url. Same for functional test.
How to draw a line? For this case, I can write a functional test that tests to find an email is sent by looking at the send log in some table. But that's a different function than what I am testing (the view
So I don't see how to differentiate the two. They both assert something.