Testing advice....please
-
Hi All, I have just written a console app to add booking info to a database based on emails pulled from an inbox. The app seems to work fine but I would like to write some tests to allow me to regularly/quickly test the functionality when somebody decides to send a surprise email format. The app is pretty basic, an Import class to represent each of the possible client emails and an Importer class to handle the actual creating of the booking in the db both of which have an interface defined to set a base of functionality required by each(IImport and IBookingImporter). Pic of project structure below. http://www.imagebam.com/image/a1cf9a322230061[^] I have a basic understanding of testing and have briefly used NUnit before but I'm just wondering if anyone has a good articles or resource(more specific than google) to help set me on the correct road to writing some tests for each of the Imports. A specific concern would be how i am going to represent/mock i guess, the email service and retrieve the mails. Although any help or advice would really be appreciated, thanks in advance
-
Hi All, I have just written a console app to add booking info to a database based on emails pulled from an inbox. The app seems to work fine but I would like to write some tests to allow me to regularly/quickly test the functionality when somebody decides to send a surprise email format. The app is pretty basic, an Import class to represent each of the possible client emails and an Importer class to handle the actual creating of the booking in the db both of which have an interface defined to set a base of functionality required by each(IImport and IBookingImporter). Pic of project structure below. http://www.imagebam.com/image/a1cf9a322230061[^] I have a basic understanding of testing and have briefly used NUnit before but I'm just wondering if anyone has a good articles or resource(more specific than google) to help set me on the correct road to writing some tests for each of the Imports. A specific concern would be how i am going to represent/mock i guess, the email service and retrieve the mails. Although any help or advice would really be appreciated, thanks in advance
have a read of these here on CP code project TDD articles and videos[^]
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
-
Hi All, I have just written a console app to add booking info to a database based on emails pulled from an inbox. The app seems to work fine but I would like to write some tests to allow me to regularly/quickly test the functionality when somebody decides to send a surprise email format. The app is pretty basic, an Import class to represent each of the possible client emails and an Importer class to handle the actual creating of the booking in the db both of which have an interface defined to set a base of functionality required by each(IImport and IBookingImporter). Pic of project structure below. http://www.imagebam.com/image/a1cf9a322230061[^] I have a basic understanding of testing and have briefly used NUnit before but I'm just wondering if anyone has a good articles or resource(more specific than google) to help set me on the correct road to writing some tests for each of the Imports. A specific concern would be how i am going to represent/mock i guess, the email service and retrieve the mails. Although any help or advice would really be appreciated, thanks in advance
Some TDD articles would indeed be good reading, although you're not strictly doing TDD if you add tests afterwards. The most important thing is to isolate the component that you're testing behind boundary interfaces. It seems like you have already isolated the import process service, behind IImport/IBookingImporter. You also need to isolate the input (IMessageProvider, maybe, for the email source) and output (IBookingRecipient for the database connection code). Then you can provide different implementations of those in your unit test library which give fixed, well known messages as input, and log the bookings the database would be asked to make (the output).
-
Hi All, I have just written a console app to add booking info to a database based on emails pulled from an inbox. The app seems to work fine but I would like to write some tests to allow me to regularly/quickly test the functionality when somebody decides to send a surprise email format. The app is pretty basic, an Import class to represent each of the possible client emails and an Importer class to handle the actual creating of the booking in the db both of which have an interface defined to set a base of functionality required by each(IImport and IBookingImporter). Pic of project structure below. http://www.imagebam.com/image/a1cf9a322230061[^] I have a basic understanding of testing and have briefly used NUnit before but I'm just wondering if anyone has a good articles or resource(more specific than google) to help set me on the correct road to writing some tests for each of the Imports. A specific concern would be how i am going to represent/mock i guess, the email service and retrieve the mails. Although any help or advice would really be appreciated, thanks in advance