Fitnesse. Should tests talk to the database?

We are trying to use Fitnesse for our functional test. Should I mock dependencies or should it test the database?

What are the advantages / disadvantages of any approach?

The whole problem of testing with the database is related to setting up data, which is a huge dependency. If we mock it, is this a real functional test?

thanks

+7
testing mocking functional-testing fitnesse
source share
5 answers

We have a complete set of functional tests from end to end that work in fitness in two modes: "InMemory" and "Database", depending on which configuration to run the tests in dictates which repositories are used in the tests. This has several advantages:

1) This forces developers to create more functionality in the database and is stored in code.

2) When in-memory suitability tests are performed very quickly. Failure prevention is very fast ... and thereby accelerates development and maneuverability. When they start in db mode, they take some time.

+4
source share

I see (at least) 2 types of tests that can be done with FitNesse:

  • Tests (or examples) designed to indicate the logic or behavior of a domain. They generally do not use database access, as this is usually not important for the purpose of the test.

  • End or end tests (or near end-to-end tests) used as regression or smoke tests. They obviously include database functionality.

The advantage of including a database is that the test is more representative of a real production system, the disadvantage is the additional cost of setting up and managing the state of the database. Look at DbFit, a set of fixtures designed to tune and test your database.

+3
source share

I would prefer to isolate database integration tests in NUnit. Your test tests should not fail due to integration issues. It was more convenient for me to transfer the state of objects through simple singleton than DB.

+1
source share

I think he should test the database. Because when you perform a functional test using fitness, you cannot use the layout. Use it with a database to know that the database functionality is working fine or not, since your database will have huge data.

0
source share

I worked on creating a different set of tests for DB-related materials, which gives me more confidence when I get into other functionality testing. Things like business rules, stored procedures, and some basic but important tables can be checked to make sure they are where they are supposed to and give the right results. If so, then what you see on the front should be a reliable environment for conducting functional tests.

0
source share

All Articles