| 183 | } |
| 184 | |
| 185 | Coroutine TestController::traverseTestList(TestList* testList) |
| 186 | { |
| 187 | if (testList != _rootTestList) |
| 188 | { |
| 189 | _logIndentation += LOG_INDENTATION; |
| 190 | } |
| 191 | |
| 192 | co_yield DelayTime::create(0.5); |
| 193 | AXLOGD("{}{}Begin traverse TestList:{}", LOG_TAG, _logIndentation, testList->getTestName()); |
| 194 | |
| 195 | auto scheduler = _director->getScheduler(); |
| 196 | int testIndex = 0; |
| 197 | for (auto&& callback : testList->_testCallbacks) |
| 198 | { |
| 199 | if (_stopAutoTest) |
| 200 | break; |
| 201 | while (_isRunInBackground) |
| 202 | { |
| 203 | AXLOGD("_director is paused"); |
| 204 | co_yield DelayTime::create(0.5); |
| 205 | } |
| 206 | if (callback) |
| 207 | { |
| 208 | auto test = callback(); |
| 209 | test->setTestParent(testList); |
| 210 | test->setTestName(testList->_childTestNames[testIndex++]); |
| 211 | |
| 212 | ActionCoroutine* subAction = nullptr; |
| 213 | if (test->isTestList()) |
| 214 | { |
| 215 | test->runThisTest(); |
| 216 | |
| 217 | subAction = |
| 218 | ActionCoroutine::create(std::bind(&TestController::traverseTestList, this, static_cast<TestList*>(test))); |
| 219 | } |
| 220 | else |
| 221 | { |
| 222 | subAction = |
| 223 | ActionCoroutine::create(std::bind(&TestController::traverseTestSuite, this, static_cast<TestSuite*>(test))); |
| 224 | } |
| 225 | co_yield subAction; // co_yield _autoTestRunner->runAction(subAction); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | if (testList == _rootTestList) |
| 230 | { |
| 231 | _stopAutoTest = true; |
| 232 | if (std::getenv("AXMOL_START_AUTOTEST")) |
| 233 | utils::killCurrentProcess(); |
| 234 | } |
| 235 | else |
| 236 | { |
| 237 | if (!_stopAutoTest) |
| 238 | { |
| 239 | // Backs up one level and release TestList object. |
| 240 | testList->_parentTest->runThisTest(); |
| 241 | testList->release(); |
| 242 | } |
nothing calls this directly
no test coverage detected