TestListManager is used for managing the EUnit test framework.
org.eclipse.edt.eunit.runtime
/** * managing 2 lists * 1. list of libraries * 2. list of test methods in the library that's running * this list gets reset for each library **/ Library TestListMgr bindingType ServiceBindingType = ServiceBindingType.DEDICATED; /* multiStatus for current test library */ ms MultiStatus; /* current test method index */ testIndex int = 1; /* list of the test method names within a library, * excluding the generatedLib.endTest() */ testMethodNames String[]; /* list of test methods within a library, * including an extra generatedLib.endTest() */ runTestMtds runTestMethod[]; /* current test library name (testdescription.name) */ testLibName String; /* list of test libraries */ LibraryStartTests runTestMethod[]; /* current test library index */ private libIndex int = 1; function nextTest() testId String = getTestIdString(); SysLib.writeStdOut("Running test: " + testId); /* acculmulate the status of each test method result * into the multiStatus for one library */ ms.addStatus(testId); if(testIndex < runTestMtds.getSize()) testIndex += 1; runTestMtds[testIndex](); end end private function getTestIdString() returns (String) testMethodNamesSize int = testMethodNames.getSize(); testId String = testLibName + "::"; if(testIndex <= testMethodNamesSize) testId += testMethodNames[testIndex]; else if(testIndex == (testMethodNamesSize+1)) testId += "endTest"; else testId +="INVALIDINDEXFOUND!!!"; end end return (testId); end function nextTestLibrary() if(libIndex < LibraryStartTests.getSize()) libIndex += 1; LibraryStartTests[libIndex](); end end /* helper functions to handle asynchronize call exceptions */ function handleCallBackException(exp AnyException in, http IHttp in) str String = "Caught service exception: " + exp.messageID + ": " + exp.message; if(exp isa ServiceInvocationException) sexp ServiceInvocationException = exp as ServiceInvocationException; s1 String = "detail1:" + sexp.detail1; s2 String = "detail2:" + sexp.detail2; s3 String = "detail3:" + sexp.detail3; str = str + ConstantsLib.NEWLINE; str = str + s1 + ConstantsLib.NEWLINE; str = str + s2 + ConstantsLib.NEWLINE; str = str + s3 + ConstantsLib.NEWLINE; str = str + "Original request body: " + http.getRequest().body + ConstantsLib.NEWLINE; str = str + "Raw response body: " + http.getResponse().body + ConstantsLib.NEWLINE; end LogResult.error(str); testId String = TestListMgr.testMethodNames[TestListMgr.testIndex]; TestListMgr.nextTest(); end /* prepend the assertion failure error message to Status */ function caughtFailedAssertion(exp AssertionFailedException in) sysLib.writeStdOut("AssertionFail - " + exp.message); end /* caught the exception from the test */ function caughtAnyException(exp AnyException in) expMsg String = "uncaught exception for: " + getTestIdString(); expMsg += ConstantsLib.NEWLINE + " => " + exp.messageID + ": " + exp.message; LogResult.error(expMsg); end function getBindingTypeString(bType ServiceBindingType) returns (String) case(bType) when(ServiceBindingType.DEDICATED) return ("DEDICATED_BINDING"); when(ServiceBindingType.DEVELOP) return ("DEVELOP_BINDING"); when(ServiceBindingType.DEPLOYED) return ("DEPLOYED_BINDING"); otherwise return ("UNKNOWN Binding Type - NOT supported"); end end end
For a description of how to use the framework, see Developing and running test cases with EUnit.
Target | Issue |
---|---|
Java | No issues. |
JavaScript | No issues. |