When testing modules, do you need to use a database to verify CRUD operations?

When testing modules, is it necessary to use the database when testing CRUD operations? Can sql lite help with this? Do you need to create db somehow in memory?

I am using mbunit.

+5
source share
7 answers

No. Integration of the actual database would be integration testing . No unit testing.

Yes, you can use any built-in DB, such as SQLite or MS SQL Compact, for this, if you can not abstract (ridicule) your DAL / DAO in any other way.

, DAL, DAL. DAL - .

+12

, : :)

, , , , ?

, , ORM.

, . , .

, Unit Tests, , - , .

SQL Server. - " " . .

+11

CRUD-?

, CRUD , mocks stub. , , SQL.

, , "" , , , , , , , SQL-.

, , mocks. , , .

. 2/3 . .

sql lite ?

, , - . , .

db - ?

. DbUnit SQL-, SQL-. , , , , , , , .

+2

, , , - , .

, mocks, . , , , .

, , DbUnit.NET. .NET- , , Java , . DbUnit . . , Best Practices, .

+2

, , , , .

mock-database. , , , , .

0

, . SQL-, , . CRUD , () ​​/ ​​/.

0

DBSnapshot, sqlserver.

, db. SqlLite ( ), , , .

, : , , , , .

The above ensures that you can run each test separately. My DBSnapshot utility will simplify your code if you wrote it .net. I think its easier to use than DbUnit.NET.

0
source

All Articles