2011-01-27 31 views
0

我有一组测试(约30),我必须运行多次, 通过更改某些配置。我的想法是创建一个包含所有30个方法的有序测试,并且想要运行它。 我想知道我是否可以做到这一点。我无法从谷歌搜索结果中获得任何帮助。 :(如何从代码运行订购的测试

+1

你对单元测试有什么用处? – Oliver 2011-01-27 13:27:39

+0

Visual Studio。但是我最近进了这个,所以查出了可能的东西,但看起来非常随机:) – Prakash 2011-01-27 14:27:42

回答

0

提供test1的(),TEST2()......是你现有的测试方法,怎么样像这样:

[Test] 
public void run_all_confs() 
{ 
    test_in_conf1(); 
    test_in_conf2(); 
} 

public void test_in_conf1() 
{ 
    setup_conf1(); 
    run_tests(); 
} 

public void test_in_conf2() 
{ 
    setup_conf2(); 
    run_tests(); 
} 

public void run_tests() 
{ 
    test1(); 
    test2(); 
    // ... 
    test30(); 
}

你应该能够端口这在任何测试环境中,我知道大约