0

I'm new to TDD and it's my first time to test drive a real-world project. First, I wanted to test drive an FTP client so I did. Since the FTP client naturally deals with network I/O, in my opinion, there's no use to unit test it because unit tests should not include any I/O operations but only in-memory operations [1].

The confusion lands in integration testing and functional testing though. Where should I place my FTP client test suite? The integration testing can accommodate I/O operations [1] but FTP client is only one module, so should I place it under functional testing?

[1] https://stackoverflow.com/a/4904533/4535957

Community
  • 1
  • 1
Xegara
  • 103
  • 1
  • 7
  • 18
  • Sorry, can you clarify your question? I don't understand your problem. Is your issue related to where to put your SUT (the FTP client of course) or where to put the test suite of the FTP client? – Paolo Laurenti Nov 04 '16 at 15:13
  • The question is where to put the test suite of the FTP client. :) – Xegara Nov 04 '16 at 17:20

2 Answers2

0

Maybe I don't understand your problem correctly but in your case I would create two test suites, one for the integration testing and one for the functional.

In this case I could write specific integration tests for the FTP commands I want to expose with the API of the client I am building. E.g. A test for sending files, one for the deletion, renaming, etc...
I would write functional tests in order to verify some more complex use cases that could include other tech parts, e.g. A bulk upload of files listed inside an excel spreadsheet (in this case, maybe, I could have also an integration test for the "Excel reading" part)

With the integration tests you gain confidence about the modules of your code that have to manage something that you do not control/own: I/O is the main example, of course.

Paolo Laurenti
  • 2,714
  • 2
  • 16
  • 18
  • What kind of test cases will you write in integration testing suite and functional testing suite for an FTP client? – Xegara Nov 05 '16 at 07:02
  • Integration tests can be written a 'Developer' level, to test how classes/sub components are working. Functional Testing could focus more at the 'user' level, higher level testing. – MikeJ Nov 05 '16 at 14:21
  • So in my case, where is it right to place the test suite containing tests such as testing uploading a file stream, testing deleting a file, testing if file exists? – Xegara Nov 06 '16 at 10:01
  • In this case I could write specific integration tests for the FTP commands I want to expose with the API of the client I am building. E.g. A test for sending files, one for the deletion, renaming, etc... I would write functional tests in order to verify some more complex use cases that could include other tech parts, e.g. A bulk upload of files listed inside an excel spreadsheet (in this case, maybe, I could have also an integration test for the "Excel reading" part) – Paolo Laurenti Nov 06 '16 at 17:19
  • From your explanation, is it right to assume that integration testing is similar to unit testing in testing the fundamental unit of works of the module but different in the environment where I/O operations are allowed in integration tests? – Xegara Nov 06 '16 at 17:46
  • 1
    Yes, with the integration tests you gain confidence about the modules of your code that have to manage something that you do not control/own: I/O is the main example, of course. The integration tests check one single element like you do with unit tests as you said. – Paolo Laurenti Nov 06 '16 at 18:29
  • Very clear. Please change your answer with this so that I can accept your answer. :) – Xegara Nov 07 '16 at 04:28
0

Integration testing is broad brush and can cover a wide range of 'testing'. Personally, based on above, I would Integration Test the module as a whole, as this is a discrete piece of work. If you then want to test how the module is used, then a system (or functional) test.

The key with all this is working out what levels you want to test at and what is most appropriate for the application.

It maybe that a decent suite of Integration tests on the FTP module is enough to prove the module works as expected.

MikeJ
  • 2,367
  • 3
  • 18
  • 23
  • Can you expound by giving examples on the differences of integration and functional testing in reference to the FTP client as SUT? – Xegara Nov 05 '16 at 07:05