【发布时间】:2014-11-12 08:31:06
【问题描述】:
如何配置SQL Server单元测试的执行顺序?
所以例如我有这个结构
UnitTests -- Main Project
- FooSchema -- Test Class
- SprocFoo1 -- Individual Unit Tests / Test Methods
- SprocFoo2
- BarSchema
- SprocBar1
- SprocBar2
测试运行有时是这样的:
-- Test Initialiaze for TestClass FooSchema
-- Pre-Test -- for SprocFoo1
-- Test -- for SprocFoo1
-- Post-Test -- for SprocFoo1
-- Pre-Test -- for SprocFoo2
-- Test -- for SprocFoo2
-- Post-Test -- for SprocFoo2
-- Test Cleanup for TestClass FooSchema
-- Test Initialiaze for TestClass BarSchema
-- Pre-Test -- for SprocBar1
-- Test -- for SprocBar1
-- Post-Test -- for SprocBar1
-- Pre-Test -- for SprocBar2
-- Test -- for SprocBar2
-- Post-Test -- for SprocBar2
-- Test Cleanup for TestClass BarSchema
有时像这样:
-- Test Initialiaze for TestClass BarSchema
-- Pre-Test -- for SprocBar1
-- Test -- for SprocBar1
-- Post-Test -- for SprocBar1
-- Pre-Test -- for SprocBar2
-- Test -- for SprocBar2
-- Post-Test -- for SprocBar2
-- Test Cleanup for TestClass BarSchema
-- Test Initialiaze for TestClass FooSchema
-- Pre-Test -- for SprocFoo1
-- Test -- for SprocFoo1
-- Post-Test -- for SprocFoo1
-- Pre-Test -- for SprocFoo2
-- Test -- for SprocFoo2
-- Post-Test -- for SprocFoo2
-- Test Cleanup for TestClass FooSchema
如何设置 FooSchema 始终首先运行?
【问题讨论】:
标签: unit-testing sql-server-2008-r2 test-class