Does using touching a database mean a unit test is an integration test even if you are using fixtures?
If so, what are the alternatives to write a unit test when you need to use models as a part of a test in a CRUD app (e.g. Ruby on Rails)?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
A test fixture is the constraining of the parameters around a set of tests. In other words, setting up mocks, input data etc that will be shared by a number of tests are part of a test fixture.
People endlessly debate what’s a unit test and what’s an integration test. For me, the only useful definition I’ve come across is that, if a test can be isolated (ie it has no side effects and can be run in parallel), then it’s a unit test. Everything else is an integration test. Others might disagree with this, eg by viewing testing a method in isolation as a unit test and everything else as integration tests.
Regardless of which definitions you favour, it’s clear that the terms are unrelated to test fixtures. So no, using a fixture does not transform a unit test into an integration test.