18
18
namespace Apache . Ignite . Core . Tests
19
19
{
20
20
using System ;
21
+ using System . Collections . Generic ;
21
22
using System . Diagnostics ;
22
23
using System . Linq ;
23
24
using System . Reflection ;
25
+ using Apache . Ignite . Core . Tests . Binary . Serializable ;
26
+ using Apache . Ignite . Core . Tests . Cache ;
27
+ using Apache . Ignite . Core . Tests . Cache . Query . Linq ;
28
+ using Apache . Ignite . Core . Tests . Client . Cache ;
29
+ using Apache . Ignite . Core . Tests . Compute ;
24
30
using Apache . Ignite . Core . Tests . Memory ;
25
31
using NUnit . ConsoleRunner ;
26
32
33
+ /// <summary>
34
+ /// Console test runner.
35
+ /// </summary>
27
36
public static class TestRunner
28
37
{
29
38
[ STAThread ]
@@ -32,6 +41,13 @@ static void Main(string[] args)
32
41
Debug . Listeners . Add ( new TextWriterTraceListener ( Console . Out ) ) ;
33
42
Debug . AutoFlush = true ;
34
43
44
+ if ( args . Length == 1 && args [ 0 ] == "-basicTests" )
45
+ {
46
+ RunBasicTests ( ) ;
47
+
48
+ return ;
49
+ }
50
+
35
51
if ( args . Length == 2 )
36
52
{
37
53
//Debugger.Launch();
@@ -45,56 +61,75 @@ static void Main(string[] args)
45
61
return ;
46
62
}
47
63
48
- TestOne ( typeof ( ConsoleRedirectTest ) , "TestMultipleDomains" ) ;
49
-
50
- //TestAll(typeof (AffinityFunctionTest));
51
- //TestAllInAssembly();
64
+ Environment . ExitCode = TestAllInAssembly ( ) ;
52
65
}
53
66
54
- private static int TestOne ( Type testClass , string method )
67
+ /// <summary>
68
+ /// Runs some basic tests.
69
+ /// </summary>
70
+ private static void RunBasicTests ( )
55
71
{
56
- string [ ] args =
72
+ Console . WriteLine ( ">>> Starting basic tests..." ) ;
73
+
74
+ var basicTests = new [ ]
57
75
{
58
- "/noshadow" ,
59
- "/run:" + testClass . FullName + "." + method ,
60
- Assembly . GetAssembly ( testClass ) . Location
76
+ typeof ( ComputeApiTest ) ,
77
+ typeof ( CacheLinqTest ) ,
78
+ typeof ( SqlDmlTest ) ,
79
+ typeof ( LinqTest ) ,
80
+ typeof ( PersistenceTest )
61
81
} ;
62
82
63
- int returnCode = Runner . Main ( args ) ;
83
+ Environment . ExitCode = TestAll ( basicTests , true ) ;
64
84
65
- if ( returnCode != 0 )
66
- Console . Beep ( ) ;
67
-
68
- return returnCode ;
85
+ Console . WriteLine ( ">>> Test run finished." ) ;
69
86
}
70
87
71
- private static void TestAll ( Type testClass )
88
+ /// <summary>
89
+ /// Runs specified test method.
90
+ /// </summary>
91
+ private static int TestOne ( Type testClass , string method , bool sameDomain = false )
72
92
{
73
93
string [ ] args =
74
94
{
75
- "/noshadow" ,
76
- "/run:" + testClass . FullName , Assembly . GetAssembly ( testClass ) . Location
95
+ "-noshadow" ,
96
+ "-domain:" + ( sameDomain ? "None" : "Single" ) ,
97
+ "-run:" + testClass . FullName + "." + method ,
98
+ Assembly . GetAssembly ( testClass ) . Location
77
99
} ;
78
100
79
- int returnCode = Runner . Main ( args ) ;
101
+ return Runner . Main ( args ) ;
102
+ }
80
103
81
- if ( returnCode != 0 )
82
- Console . Beep ( ) ;
104
+ /// <summary>
105
+ /// Runs all tests in specified class.
106
+ /// </summary>
107
+ private static int TestAll ( IEnumerable < Type > testClass , bool sameDomain = false )
108
+ {
109
+ var args = new List < string >
110
+ {
111
+ "-noshadow" ,
112
+ "-domain:" + ( sameDomain ? "None" : "Single" ) ,
113
+ "-run:" + string . Join ( "," , testClass . Select ( x => x . FullName ) ) ,
114
+ Assembly . GetAssembly ( typeof ( TestRunner ) ) . Location
115
+ } ;
116
+
117
+ return Runner . Main ( args . ToArray ( ) ) ;
83
118
}
84
119
85
- private static void TestAllInAssembly ( )
120
+ /// <summary>
121
+ /// Runs all tests in assembly.
122
+ /// </summary>
123
+ private static int TestAllInAssembly ( bool sameDomain = false )
86
124
{
87
125
string [ ] args =
88
126
{
89
- "/noshadow" ,
127
+ "-noshadow" ,
128
+ "-domain:" + ( sameDomain ? "None" : "Single" ) ,
90
129
Assembly . GetAssembly ( typeof ( InteropMemoryTest ) ) . Location
91
130
} ;
92
131
93
- int returnCode = Runner . Main ( args ) ;
94
-
95
- if ( returnCode != 0 )
96
- Console . Beep ( ) ;
132
+ return Runner . Main ( args ) ;
97
133
}
98
-
99
134
}
100
135
}
0 commit comments