| 246 | } |
| 247 | |
| 248 | Coroutine TestController::traverseTestSuite(TestSuite* testSuite) |
| 249 | { |
| 250 | auto scheduler = _director->getScheduler(); |
| 251 | int testIndex = 0; |
| 252 | float testCaseDuration = 0.0f; |
| 253 | _logIndentation += LOG_INDENTATION; |
| 254 | AXLOGD("{}{}Begin traverse TestSuite:{}", LOG_TAG, _logIndentation.c_str(), testSuite->getTestName().c_str()); |
| 255 | |
| 256 | _logIndentation += LOG_INDENTATION; |
| 257 | testSuite->_currTestIndex = -1; |
| 258 | |
| 259 | auto logIndentation = _logIndentation; |
| 260 | for (auto&& callback : testSuite->_testCallbacks) |
| 261 | { |
| 262 | auto testName = testSuite->_childTestNames[testIndex++]; |
| 263 | |
| 264 | Scene* testScene = nullptr; |
| 265 | TestCase* testCase = nullptr; |
| 266 | TransitionScene* transitionScene = nullptr; |
| 267 | |
| 268 | if (_stopAutoTest) |
| 269 | break; |
| 270 | |
| 271 | while (_isRunInBackground) |
| 272 | { |
| 273 | AXLOGD("_director is paused"); |
| 274 | co_yield DelayTime::create(0.5); |
| 275 | } |
| 276 | if (_stopAutoTest) |
| 277 | break; |
| 278 | AXLOGD("{}{}Run test:{}.", LOG_TAG, logIndentation, testName); |
| 279 | |
| 280 | auto scene = callback(); |
| 281 | if (_stopAutoTest) |
| 282 | break; |
| 283 | |
| 284 | if (scene) |
| 285 | { |
| 286 | transitionScene = dynamic_cast<TransitionScene*>(scene); |
| 287 | if (transitionScene) |
| 288 | { |
| 289 | testCase = (TestCase*)transitionScene->getInScene(); |
| 290 | testCaseDuration = transitionScene->getDuration() + 0.5f; |
| 291 | |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | testCase = (TestCase*)scene; |
| 296 | testCaseDuration = testCase->getDuration(); |
| 297 | } |
| 298 | testSuite->_currTestIndex++; |
| 299 | testCase->setTestSuite(testSuite); |
| 300 | testCase->setTestCaseName(testName); |
| 301 | _director->replaceScene(scene); |
| 302 | |
| 303 | testScene = scene; |
| 304 | |
| 305 | co_yield DelayTime::create(testCaseDuration); |
nothing calls this directly
no test coverage detected