开发者

How to test app that does ftp download and db insert?

开发者 https://www.devze.com 2023-03-11 23:48 出处:网络
I have a .NET app that I\'d like to do some automated testing on. I don\'t have much experience of automated testing (done a little bit with Nunit 开发者_JAVA技巧in the past, but I\'m not sure it\'s v

I have a .NET app that I'd like to do some automated testing on. I don't have much experience of automated testing (done a little bit with Nunit 开发者_JAVA技巧in the past, but I'm not sure it's very useful in this case) so wondered if anyone can give me some pointers?

The app downloads data files (.txt format) from an ftp site, checks that they conform to a set pattern and then does a bulk insert of the data into a SQL Server database, using a stored procedure. Please let me know if that's not enough detail, or if this is the wrong place to ask this entirely...

Thanks!


This question has quite a few ways it can be answered. I will try to get you started.

First off, I hope you wrote your application in a modular fashion. The FTP access should be in its own module. The database access should be in another module. The analysis and data manipulation should be in yet another module. The whole thing should be under the control of a main module.

Once you've gotten your application broken into modules, each one should be tested individually. Create a test that just downloads the file. Create another test that just puts data into the database. Create a test of the data manipulation that does NOT depend on the FTP or database.

These tests can use a testing tool such as nUnit. As conditions are uncovered, you should add more tests. Keep your tests, you'll need them in the future.

Then and only then should you think about testing the entire application as a single unit.

0

精彩评论

暂无评论...
验证码 换一张
取 消