Commit 043c25fd 043c25fd6402906d90876386c638a22b7a327fb2 by Nicolas Perriault

added more cli tests

1 parent c3ff7b08
...@@ -1290,9 +1290,10 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) { ...@@ -1290,9 +1290,10 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) {
1290 statusText = this.options.passText; 1290 statusText = this.options.passText;
1291 style = 'GREEN_BAR'; 1291 style = 'GREEN_BAR';
1292 } 1292 }
1293 result = f('%s %d tests executed in %ss, %d passed, %d failed, %d dubious, %d skipped.', 1293 result = f('%s %d test%s executed in %ss, %d passed, %d failed, %d dubious, %d skipped.',
1294 statusText, 1294 statusText,
1295 total, 1295 total,
1296 total > 1 ? "s" : "",
1296 utils.ms2seconds(this.suiteResults.calculateDuration()), 1297 utils.ms2seconds(this.suiteResults.calculateDuration()),
1297 this.suiteResults.countPassed(), 1298 this.suiteResults.countPassed(),
1298 failed, 1299 failed,
......
...@@ -105,6 +105,8 @@ class CasperExecTest(unittest.TestCase): ...@@ -105,6 +105,8 @@ class CasperExecTest(unittest.TestCase):
105 '3 tests executed', 105 '3 tests executed',
106 '3 passed', 106 '3 passed',
107 '0 failed', 107 '0 failed',
108 '0 dubious',
109 '0 skipped',
108 ]) 110 ])
109 111
110 @timeout(20) 112 @timeout(20)
...@@ -115,9 +117,11 @@ class CasperExecTest(unittest.TestCase): ...@@ -115,9 +117,11 @@ class CasperExecTest(unittest.TestCase):
115 script_path, 117 script_path,
116 '# true', 118 '# true',
117 'PASS Subject is strictly true', 119 'PASS Subject is strictly true',
118 'PASS 1 tests executed', 120 'PASS 1 test executed',
119 '1 passed', 121 '1 passed',
120 '0 failed', 122 '0 failed',
123 '0 dubious',
124 '0 skipped',
121 ]) 125 ])
122 126
123 @timeout(20) 127 @timeout(20)
...@@ -132,18 +136,48 @@ class CasperExecTest(unittest.TestCase): ...@@ -132,18 +136,48 @@ class CasperExecTest(unittest.TestCase):
132 '# file: %s:3' % script_path, 136 '# file: %s:3' % script_path,
133 '# code: test.assert(false);', 137 '# code: test.assert(false);',
134 '# subject: false', 138 '# subject: false',
135 'FAIL 1 tests executed', 139 'FAIL 1 test executed',
136 '0 passed', 140 '0 passed',
137 '1 failed', 141 '1 failed',
142 '0 dubious',
143 '0 skipped',
138 ], failing=True) 144 ], failing=True)
139 145
146 @timeout(20)
147 def test_dubious_test(self):
148 script_path = os.path.join(TEST_ROOT, 'tester', 'dubious.js')
149 self.assertCommandOutputContains('test ' + script_path, [
150 script_path,
151 'dubious test: 2 tests planned, 1 tests executed',
152 'FAIL 1 test executed',
153 '1 passed',
154 '1 failed',
155 '1 dubious',
156 '0 skipped',
157 ], failing=True)
158
159 @timeout(20)
160 def test_skipped_test(self):
161 script_path = os.path.join(TEST_ROOT, 'tester', 'skipped.js')
162 self.assertCommandOutputContains('test ' + script_path, [
163 script_path,
164 'SKIP 1 test skipped',
165 'PASS 1 test executed',
166 '1 passed',
167 '0 failed',
168 '0 dubious',
169 '1 skipped',
170 ])
171
140 @timeout(60) 172 @timeout(60)
141 def test_full_suite(self): 173 def test_full_suite(self):
142 folder_path = os.path.join(TEST_ROOT, 'tester') 174 folder_path = os.path.join(TEST_ROOT, 'tester')
143 failing_script = os.path.join(folder_path, 'failing.js') 175 failing_script = os.path.join(folder_path, 'failing.js')
144 passsing_script = os.path.join(folder_path, 'passing.js') 176 passing_script = os.path.join(folder_path, 'passing.js')
145 mytest_script = os.path.join(folder_path, 'mytest.js') 177 mytest_script = os.path.join(folder_path, 'mytest.js')
146 self.assertCommandOutputContains('test ' + folder_path, [ 178 self.assertCommandOutputContains(' '.join([
179 'test', failing_script, passing_script, mytest_script
180 ]), [
147 'Test file: %s' % failing_script, 181 'Test file: %s' % failing_script,
148 '# true', 182 '# true',
149 'FAIL Subject is strictly true', 183 'FAIL Subject is strictly true',
...@@ -155,12 +189,14 @@ class CasperExecTest(unittest.TestCase): ...@@ -155,12 +189,14 @@ class CasperExecTest(unittest.TestCase):
155 'PASS ok1', 189 'PASS ok1',
156 'PASS ok2', 190 'PASS ok2',
157 'PASS ok3', 191 'PASS ok3',
158 'Test file: %s' % passsing_script, 192 'Test file: %s' % passing_script,
159 '# true', 193 '# true',
160 'PASS Subject is strictly true', 194 'PASS Subject is strictly true',
161 'FAIL 5 tests executed', 195 'FAIL 5 tests executed',
162 '4 passed', 196 '4 passed',
163 '1 failed', 197 '1 failed',
198 '0 dubious',
199 '0 skipped',
164 'Details for the 1 failed test:', 200 'Details for the 1 failed test:',
165 'assert: Subject is strictly true', 201 'assert: Subject is strictly true',
166 ], failing=True) 202 ], failing=True)
...@@ -175,6 +211,8 @@ class CasperExecTest(unittest.TestCase): ...@@ -175,6 +211,8 @@ class CasperExecTest(unittest.TestCase):
175 'FAIL 2 tests executed', 211 'FAIL 2 tests executed',
176 '1 passed', 212 '1 passed',
177 '1 failed', 213 '1 failed',
214 '0 dubious',
215 '0 skipped',
178 ], failing=True) 216 ], failing=True)
179 217
180 @timeout(60) 218 @timeout(60)
......
1 /*jshint strict:false*/
2 casper.test.begin('dubious test', 2, function(test) {
3 test.assert(true);
4 test.done();
5 });
1 /*jshint strict:false*/
2 casper.test.begin('skipped test', 2, function(test) {
3 test.skip(1);
4 test.assert(true);
5 test.done();
6 });