I have started working on an existing project with over 1800 functional/integration tests. These have been coded with MSTest.
Many of those connect directly to the SQL Server database. The database is generated by a code generator which amongst many things create the database. Generating the db is slow and cumbersome.
This as the following problems:
I would like the existing tests not to be dependent on such on installation, run faster if possible and not have to deal with maintaining databases through the code generator, juggling connection strings, etc.
I am trying to acheive this as quickly as possible since a rewrite of the tests is not in the budget. I have already introduced mocking to help new test be less dependent on the database, my problem now is for the existing tests.
My first though was to change our base unit test class to connect to a SQLite db which would be created by the code generator which already generates the main db instead of the SQL Server db. The SQLite could then be deleted and recopied to the test folder between each run. This would have been fast, not require having 2 SQL Server database, in fact if just running the tests no SQL Server installation would have been required.
My problems were that the generated code uses many concepts not included in SQLite; T-SQL, SQL Server specific syntax, schemas, stored procs and embedded clr assemblies.
I then tried SQL Server CE 4, which had many of the same limitations as SQLite.
Is there any other alternatives available other than rewriting the code to be compatible with SQLite (or CE), rewriting the existing tests, or a system in which we maintain 2 seperatedb ?
EDITs: Changed unit test to functional tests, clarified some things. Put some things in bold. Я согласен с тем, что эти тесты не являются подходящими модульными тестами. Я согласен, что насмехаться здесь было бы неплохо. Я пытаюсь исправить беспорядок, с которым столкнулся.