There are 2 standard ways of approaching a test that depends on something else (object, function call, etc).
- You can use mocks in place of the objects the code you are testing depends on.
- You can load a fixture or do the creation/call in the test setup.
Some people like "classical" unit tests where only the "unit" of code is tested. In these cases you typically use mocks and stubs to replace the dependencies.
Other like more integrative tests where most or all of the call stack is tested. In these cases you use a fixture, or possibly even do calls/creations in a setup function.
Generally you would not make one test depend on another. All tests should:
- clean up after themselves
- be runnable in isolation
- be runnable as part of a suite
- be consistent and repeatable
If you make one test dependent on another they cannot be run in isolation and you are also forcing an order to the tests run. Enforcing order in tests isn't good, in fact many people feel you should randomize the order in which your tests are run.