Forum Discussion
Yeah, sorry man. Doing our best here.
Alternative, though, to "importing" a bunch of script files.
https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/script/runner/callmethod.html?q=runner.callmethod
Yeah, it's listed as "obsolete"... but it still works. And that will save you that import step.
Thank you! Always appreciate your team and the support.
- AlexKaras5 years agoChampion Level 3
Hi,
As it was already pointed out, TestItems are containers for different executable entities provided by TestComplete and do not contain .Execute() method. (Which I really hope will be provided by SmartBear.) Different entity types are formatted differently and thus you must parse them separately.
Some examples:
// Script\testPOC - Main
// Scenarios\LegalData - Make sure that copyright is present and displays correct year
// Scenarios\LegalData - [All Scenarios]
// Scenarios - @Copyright
// KeywordTests - CheckCopyrightBelow is a sample code that can be used for the entity of Script type:
Note: The code works with the current version of TestComplete (v14.xx) but might not work with the future versions as internal structure of TestItems and project files is not documented.
function TestItemExecute(ATestItemElement) { var strElementToBeRun, arElementsToBeRun; var oRetVal = null; strElementToBeRun = ATestItemElement.Caption; arElementsToBeRun = strElementToBeRun.split('\\'); switch (arElementsToBeRun[0]) { case 'Script': arElementsToBeRun = arElementsToBeRun[1].split(' - '); oRetVal = Runner.CallMethod(arElementsToBeRun[0] + "." + arElementsToBeRun[1]); break; case 'Scenarios': // […] break; default: Log.Warning(aqString.Format( 'Unhandled element to be run (%s) for the %s Test Item. Execution of Test Item has been skipped', strElementToBeRun, ATestItemElement.Name), aqString.Format('%s\n%s', ATestItemElement.Name, strElementToBeRun)); break; } return oRetVal; }
Hope it will help and inspire you with ideas.
Related Content
Recent Discussions
- 5 hours agomarkos