How to unit test a mail client

I am working on a desktop email client right now and I want to unit test my backend. However, I see no way to do this work. For my code to work, it must connect to a working mail server. If I do not associate my unit tests with an email account and make sure that the account matches the state that my tests expect, I donโ€™t see how I can do this.

Does anyone have any ideas on how to test such an application where it relies on external design factors?

EDIT:

To add some details: I am working on a higher-level C ++ mail client library for my application, which uses the libEtPan library, C library, to actually handle the details of connecting to and interacting with the mail server.

+3
source share
5 answers

I'm going to assume, by testing the back end, you are referencing a bit of code that actually talks to the email server and tests the rest of your software that you have mocked at this layer.

. , , , , , , -.

, , . , , . Java Dumpster, , ++ . - , , , script. , , ( ยน) . , SMTP- , , , . .

, SMTP- facade API, " ", , API , . API , , .

1) , CI, , Cump Dumpster.

+1

mock / ( ).

, , . . , .

. SO - ++.

+7

, . , Rhino.Mocks.

Btw: "" , unit test, ...

+1

, , , , - TCP. .

0

Mocking mail API. , C, .

  • ++-, .
  • / C api, , , C .

There is a large book that discusses unit test problems in complex situations: โ€œWorking Effectively with Legacy Code,โ€ I cannot recommend this book highly enough. Do not disconnect by name, the book considers obsolete code like any code without unit tests.

0
source

Source: https://habr.com/ru/post/1719613/


All Articles