Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests that depend on mdf files don't run #10

Open
zippy1981 opened this issue Apr 29, 2013 · 3 comments
Open

Unit tests that depend on mdf files don't run #10

zippy1981 opened this issue Apr 29, 2013 · 3 comments

Comments

@zippy1981
Copy link
Contributor

Many unit tests fail with a message like "'D:\Projects\OrcaMDF (GIT)\DBTests\6d104c11-7aa6-4241-b014-b83d93f636e7_SqlServer2008R2.ldf'" If you commit the test MDFs, I will modify the unit tests so they are loaded using relative paths.

@improvedk
Copy link
Owner

Actually the tests are performed by creating live databases on a SQL Server instance, detaching them and then testing them (more info here: http://improve.dk/avoiding-regressions-in-orcamdf-by-system-testing/). This makes it extremely easy to write tests, though somewhat slower to run them, and somewhat more cumbersome for others to run (welcome - you're the first external contributor! :)).

Right now it's hard coded to connect to a certain SQL instance and store them in the mentioned path. I've considered creating the databases one-off and then including the detached .MDF's with the SQL Server version in the name, making it much more portable and easy for others to run.

It would however be slightly more cumbersome to create new tests as you'd have to either modify one of the previous MDFs or create a new one altogether. At the benefit of speed, I think it's a valid tradeoff though.

@zippy1981
Copy link
Contributor Author

Ok I see that now. Well this problem could be solved easily via SQL Server 2012 LocalDB. What is the plan for transitioning to that in addition to (or as opposed) to SQL 2008R2 file format?

@improvedk
Copy link
Owner

Looking at things long term, I'd like to support all 2005+ formats as they're extremely similar, ignoring stuff like Columnstore indexes, TDE and such. However, for now I'd prefer to concentrate on SQL2008R2 as there are minor differences in the formats themselves - and especially so if you look at the DMVs.

Supporting minor differences in the engine could, for the most part, be done transparently and by strategizing parts here and there. Supporting multiple DMV versions would basically require an abstraction on top of the whole Database class, having different DMV sets for each version. It'd be possible, but will require a lot of effort that I would much rather put into having wider support for the 2008 R2 file format - especially seeing as the main purpose, for now, is in teaching. And for now, whether reading about the 2005 or 2012 format, it's basically the same.

In the shorter run, for the tests, I'm much more inclined to prebuild the MDFs and include them in the repo. They'll take up some space, but it's cheap and will make it way more portable and faster to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants