From 27c521a5975fb3e867c8bdc46b9cc676e14f992c Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Thu, 16 May 2024 16:28:46 +0530 Subject: [PATCH] Refactor testerina core ballerina module --- .../src/main/ballerina/Module.md | 2 +- .../main/ballerina/annotation_processor.bal | 93 ++++++----- .../src/main/ballerina/assert.bal | 147 +++++++++--------- .../src/main/ballerina/concurrentExecuter.bal | 4 +- .../src/main/ballerina/execute.bal | 47 +++--- .../src/main/ballerina/filter.bal | 21 +-- .../src/main/ballerina/register.bal | 1 + .../src/main/ballerina/report.bal | 4 +- .../src/main/ballerina/serialExecuter.bal | 26 ++-- ...iderTest-testDataProviderSingleFailure.txt | 8 +- ...oviderTestCase-testInvalidDataProvider.txt | 16 +- ...viderTestCase-testInvalidDataProvider2.txt | 16 +- ...rTestCase-testInvalidTupleDataProvider.txt | 16 +- ...iderTest-testDataProviderSingleFailure.txt | 8 +- ...oviderTestCase-testInvalidDataProvider.txt | 16 +- ...viderTestCase-testInvalidDataProvider2.txt | 16 +- ...rTestCase-testInvalidTupleDataProvider.txt | 16 +- 17 files changed, 222 insertions(+), 235 deletions(-) diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/Module.md b/misc/testerina/modules/testerina-core/src/main/ballerina/Module.md index ad0d6536a3bc..15320a4987de 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/Module.md +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/Module.md @@ -202,7 +202,7 @@ function testAssertFalse() { @test:Config {} function testAssertFail() { - if (true) { + if true { return; } test:assertFail(msg = "AssertFailed"); diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/annotation_processor.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/annotation_processor.bal index 10e3db47b386..6459d9b9ae27 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/annotation_processor.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/annotation_processor.bal @@ -14,6 +14,18 @@ // specific language governing permissions and limitations // under the License. +enum SerialExecutionReason { + NONE_ISOLATED_TEST_FUNCTION = "non-isolated test function", + NONE_ISOLATED_DATA_PROVIDER_FUNCTION = "non-isolated data-provider function", + UNSAFE_TEST_PARAMETERS = "unsafe test parameters", + NON_ISOLATED_BEFORE_FUNCTION = "non-isolated before function", + NON_ISOLATED_AFTER_FUNCTION = "non-isolated after function", + NON_ISOLATED_BEFORE_GROUPS_FUNCTION = "non-isolated before-groups function", + NON_ISOLATED_AFTER_GROUPS_FUNCTION = "non-isolated after-groups function", + NON_ISOLATED_BEFORE_EACH_FUNCTION = "non-isolated before-each function", + NON_ISOLATED_AFTER_EACH_FUNCTION = "non-isolated after-each function" +} + type AnnotationProcessor function (string name, function f) returns boolean; AnnotationProcessor[] annotationProcessors = [ @@ -26,21 +38,16 @@ AnnotationProcessor[] annotationProcessors = [ processConfigAnnotation ]; +# Register a test function to run. This function is intended for internal use only. +# +# + name - test name +# + f - test function public function registerTest(string name, function f) { - boolean annotationProcessed = false; foreach AnnotationProcessor annotationProcessor in annotationProcessors { - if (annotationProcessor(name.trim(), f)) { - annotationProcessed = true; + if annotationProcessor(name.trim(), f) { break; } } - - //TODO: Enable dynamic registration upon approval - // Process the register functions under the test factory method. - // Currently the dynamic registration does not support groups filtration. - // if !annotationProcessed && filterGroups.length() == 0 { - // testRegistry.addFunction(name = name, executableFunction = f); - // } } function processConfigAnnotation(string name, function f) returns boolean { @@ -72,31 +79,39 @@ function processConfigAnnotation(string name, function f) returns boolean { // Register the reason for serial execution. if !isTestFunctionIsolated { - reasonForSerialExecution.push("non-isolated test function"); + reasonForSerialExecution.push(NONE_ISOLATED_TEST_FUNCTION); } if !isDataProviderIsolated { - reasonForSerialExecution.push("non-isolated data-provider function"); + reasonForSerialExecution.push(NONE_ISOLATED_DATA_PROVIDER_FUNCTION); } if !isTestFunctionParamSafe { - reasonForSerialExecution.push("unsafe test parameters"); + reasonForSerialExecution.push(UNSAFE_TEST_PARAMETERS); } // If the test function is not parallelizable, then print the reason for serial execution. - if !isSatisfiedParallelizableConditions && !(config?.serialExecution == () ? false : true) - && executionManager.isParallelExecutionEnabled() { + if !isSatisfiedParallelizableConditions && config.serialExecution == () + && executionManager.isParallelExecutionEnabled() { println(string `WARNING: Test function '${name}' cannot be parallelized, reason: ${string:'join(", ", - ...reasonForSerialExecution)}`); + ...reasonForSerialExecution)}`); } - boolean enabled = config.enable && (filterGroups.length() == 0 ? true : hasGroup(config.groups, filterGroups)) - && (filterDisableGroups.length() == 0 ? true : !hasGroup(config.groups, filterDisableGroups)) - && hasTest(name); + // if enable field is true, and groups to filter exist, and groups to disable exist and test exists, then enable + boolean enabled = config.enable + && (filterGroups.length() == 0 || hasGroup(config.groups, filterGroups)) + && (filterDisableGroups.length() == 0 || !hasGroup(config.groups, filterDisableGroups)) + && hasTest(name); config.groups.forEach('group => groupStatusRegistry.incrementTotalTest('group, enabled)); dataDrivenTestParams[name] = params; + + // if the serial execution field is set, or if parallel execution is disabled, or if not parallelizable, then + // set the serial execution to true. + boolean serialExecution = config?.serialExecution != () + || !executionManager.isParallelExecutionEnabled() + || !isSatisfiedParallelizableConditions; + testRegistry.addFunction(name = name, executableFunction = f, before = config.before, after = config.after, groups = config.groups.cloneReadOnly(), diagnostics = diagnostics, - dependsOn = config.dependsOn.cloneReadOnly(), serialExecution = ((config?.serialExecution != ()) - || !isSatisfiedParallelizableConditions || !executionManager.isParallelExecutionEnabled()), + dependsOn = config.dependsOn.cloneReadOnly(), serialExecution = serialExecution, config = config.cloneReadOnly()); executionManager.createTestFunctionMetaData(functionName = name, dependsOnCount = config.dependsOn.length(), enabled = enabled); @@ -110,14 +125,14 @@ function isBeforeAfterFuncSetIsolated(TestConfig config, string[] reasonForSeria if before !is () { if before !is isolated function () returns any|error { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated before function"); + reasonForSerialExecution.push(NON_ISOLATED_BEFORE_FUNCTION); } } (function () returns any|error)? after = config.after; if after !is () { if after !is isolated function () returns any|error { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated after function"); + reasonForSerialExecution.push(NON_ISOLATED_AFTER_FUNCTION); } } foreach string 'group in config.groups { @@ -126,7 +141,7 @@ function isBeforeAfterFuncSetIsolated(TestConfig config, string[] reasonForSeria foreach TestFunction beforeGroupFunction in beforeGroupFunctions { if beforeGroupFunction.executableFunction !is isolated function { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated before-groups function"); + reasonForSerialExecution.push(NON_ISOLATED_BEFORE_GROUPS_FUNCTION); } } } @@ -135,7 +150,7 @@ function isBeforeAfterFuncSetIsolated(TestConfig config, string[] reasonForSeria foreach TestFunction afterGroupFunction in afterGroupFunctions { if afterGroupFunction.executableFunction !is isolated function { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated after-groups function"); + reasonForSerialExecution.push(NON_ISOLATED_AFTER_GROUPS_FUNCTION); } } } @@ -144,14 +159,14 @@ function isBeforeAfterFuncSetIsolated(TestConfig config, string[] reasonForSeria foreach TestFunction beforeEachFunction in beforeEachFunctions { if beforeEachFunction.executableFunction !is isolated function { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated before-each function"); + reasonForSerialExecution.push(NON_ISOLATED_BEFORE_EACH_FUNCTION); } } TestFunction[] afterEachFunctions = afterEachRegistry.getFunctions(); foreach TestFunction afterEachFunction in afterEachFunctions { if afterEachFunction.executableFunction !is isolated function { isBeforeAfterFunctionSetIsolated = false; - reasonForSerialExecution.push("non-isolated after-each function"); + reasonForSerialExecution.push(NON_ISOLATED_AFTER_EACH_FUNCTION); } } return isBeforeAfterFunctionSetIsolated; @@ -223,26 +238,22 @@ function hasGroup(string[] groups, string[] filter) returns boolean { } isolated function hasTest(string name) returns boolean { - if testOptions.getHasFilteredTests() { - string testName = name; - int? testIndex = testOptions.getFilterTestIndex(testName); - if testIndex == () { - foreach string filter in testOptions.getFilterTests() { - if filter.includes(WILDCARD) { - boolean|error wildCardMatch = matchWildcard(testName, filter); - return (wildCardMatch is boolean && wildCardMatch && matchModuleName(filter)); - } + if !testOptions.getHasFilteredTests() { + return true; + } + int? testIndex = testOptions.getFilterTestIndex(name); + if testIndex == () { + foreach string filter in testOptions.getFilterTests() { + if filter.includes(WILDCARD) { + return matchWildcard(name, filter) == true && matchModuleName(filter); } - return false; - } else if matchModuleName(testName) { - return true; } return false; } - return true; + return matchModuleName(name); } isolated function matchModuleName(string testName) returns boolean { string? filterModule = testOptions.getFilterTestModule(testName); - return filterModule == () ? true : filterModule == getFullModuleName(); + return filterModule == () || filterModule == getFullModuleName(); } diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/assert.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/assert.bal index 51eeb1c64953..fb04b36433ae 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/assert.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/assert.bal @@ -43,7 +43,7 @@ public isolated function createBallerinaError(string errorMessage, string catego # Asserts whether the given condition is true. If it is not, a AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -57,14 +57,14 @@ public isolated function createBallerinaError(string errorMessage, string catego # + condition - Boolean condition to evaluate # + msg - Assertion error message public isolated function assertTrue(boolean condition, string msg = "Assertion Failed!") { - if (!condition) { + if !condition { panic createBallerinaError(msg, assertFailureErrorCategory); } } # Asserts whether the given condition is false. If it is not, a AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -78,14 +78,14 @@ public isolated function assertTrue(boolean condition, string msg = "Assertion F # + condition - Boolean condition to evaluate # + msg - Assertion error message public isolated function assertFalse(boolean condition, string msg = "Assertion Failed!") { - if (condition) { + if condition { panic createBallerinaError(msg, assertFailureErrorCategory); } } # Asserts whether the given values are equal. If it is not, an AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -104,7 +104,7 @@ public isolated function assertFalse(boolean condition, string msg = "Assertion # + expected - Expected value # + msg - Assertion error message public isolated function assertEquals(any|error actual, anydata expected, string msg = "Assertion Failed!") { - if (actual is error || actual != expected) { + if actual is error || actual != expected { string errorMsg = getInequalityErrorMsg(actual, expected, msg); panic createBallerinaError(errorMsg, assertFailureErrorCategory); } @@ -112,7 +112,7 @@ public isolated function assertEquals(any|error actual, anydata expected, string # Asserts whether the given values are not equal. If it is equal, an AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -131,7 +131,7 @@ public isolated function assertEquals(any|error actual, anydata expected, string # + expected - Expected value # + msg - Assertion error message public isolated function assertNotEquals(any actual, anydata expected, string msg = "Assertion Failed!") { - if (actual == expected) { + if actual == expected { string expectedStr = sprintf("%s", expected); string errorMsg = string `${msg}: expected the actual value not to be '${expectedStr}'`; panic createBallerinaError(errorMsg, assertFailureErrorCategory); @@ -140,7 +140,7 @@ public isolated function assertNotEquals(any actual, anydata expected, string ms # Asserts whether the given values are exactly equal. If it is not, an AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -165,7 +165,7 @@ public isolated function assertNotEquals(any actual, anydata expected, string ms # + msg - Assertion error message public isolated function assertExactEquals(any|error actual, any|error expected, string msg = "Assertion Failed!") { boolean isEqual = (actual === expected); - if (!isEqual) { + if !isEqual { string errorMsg = getInequalityErrorMsg(actual, expected, msg); panic createBallerinaError(errorMsg, assertFailureErrorCategory); } @@ -173,7 +173,7 @@ public isolated function assertExactEquals(any|error actual, any|error expected, # Asserts whether the given values are not exactly equal. If it is equal, an AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # @@ -198,7 +198,7 @@ public isolated function assertExactEquals(any|error actual, any|error expected, # + msg - Assertion error message public isolated function assertNotExactEquals(any|error actual, any|error expected, string msg = "Assertion Failed!") { boolean isEqual = (actual === expected); - if (isEqual) { + if isEqual { string expectedStr = sprintf("%s", expected); string errorMsg = string `${msg}: expected the actual value not to be '${expectedStr}'`; panic createBallerinaError(errorMsg, assertFailureErrorCategory); @@ -207,14 +207,14 @@ public isolated function assertNotExactEquals(any|error actual, any|error expect # Assert failure is triggered based on your discretion. AssertError is thrown with the given errorMessage. # -#### Example +# ### Example # ```ballerina # import ballerina/test; # # @test:Config {} # function foo() { # error? e = trap bar(); // Expecting `bar()` to panic -# if (e is error) { +# if e is error { # test:assertEquals(e.message().toString(), "Invalid Operation", msg = "Invalid error reason"); # } else { # test:assertFail(msg = "Expected an error"); @@ -238,34 +238,34 @@ public isolated function assertFail(string msg = "Test Failed!") returns never { # + expected - Expected value # + msg - Assertion error message # + return - Error message constructed based on the compared values -isolated function getInequalityErrorMsg(any|error actual, any|error expected, string msg = "\nAssertion Failed!") returns @tainted string { - string expectedType = getBallerinaType(expected); - string actualType = getBallerinaType(actual); - string errorMsg = ""; - string expectedStr = sprintf("%s", expected); - string actualStr = sprintf("%s", actual); - if (expectedStr.length() > maxArgLength) { - expectedStr = getFormattedString(expectedStr); - } - if (actualStr.length() > maxArgLength) { - actualStr = getFormattedString(actualStr); - } - if (expectedType != actualType) { - errorMsg = string `${msg}` + "\n \nexpected: " + string `<${expectedType}> '${expectedStr}'` + "\nactual\t: " - + string `<${actualType}> '${actualStr}'`; - } else if (actual is string && expected is string) { - string diff = getStringDiff(actual, expected); - errorMsg = string `${msg}` + "\n \nexpected: " + string `'${expectedStr}'` + "\nactual\t: " - + string `'${actualStr}'` + "\n \nDiff\t:\n" + string `${diff}`; - } else if (actual is map && expected is map) { - string diff = getMapValueDiff(>actual, >expected); - errorMsg = string `${msg}` + "\n \nexpected: " + string `'${expectedStr}'` + "\nactual\t: " + - string `'${actualStr}'` + "\n \nDiff\t:\n" + string `${diff}`; - } else { - errorMsg = string `${msg}` + "\n \nexpected: " + string `'${expectedStr}'` + "\nactual\t: " - + string `'${actualStr}'`; - } - return errorMsg; +isolated function getInequalityErrorMsg(any|error actual, any|error expected, string msg = "\nAssertion Failed!") + returns @tainted string { + string expectedType = getBallerinaType(expected); + string actualType = getBallerinaType(actual); + string errorMsg = ""; + string expectedStr = sprintf("%s", expected); + string actualStr = sprintf("%s", actual); + if expectedStr.length() > maxArgLength { + expectedStr = getFormattedString(expectedStr); + } + if actualStr.length() > maxArgLength { + actualStr = getFormattedString(actualStr); + } + if expectedType != actualType { + errorMsg = string `${msg}${"\n \n"}expected: <${expectedType}> '${expectedStr}'${"\n"}` + + string `actual${"\t"}: <${actualType}> '${actualStr}'`; + } else if actual is string && expected is string { + string diff = getStringDiff(actual, expected); + errorMsg = string `${msg}${"\n \n"}expected: '${expectedStr}'${"\n"}` + + string `actual${"\t"}: '${actualStr}'${"\n \n"}Diff${"\t"}:${"\n"}${diff}`; + } else if actual is map && expected is map { + string diff = getMapValueDiff(>actual, >expected); + errorMsg = string `${msg}${"\n \n"}expected: '${expectedStr}'${"\n"}` + + string `actual${"\t"}: '${actualStr}'${"\n \n"}Diff${"\t"}:${"\n"}${diff}`; + } else { + errorMsg = string `${msg}${"\n \n"}expected: '${expectedStr}'${"\n"}actual${"\t"}: '${actualStr}'`; + } + return errorMsg; } isolated function getFormattedString(string str) returns string { @@ -274,7 +274,7 @@ isolated function getFormattedString(string str) returns string { int itr = (str.length() / maxArgLength) + 1; foreach int i in 0 ..< itr { // If the calculated substring index is less than string length - if ((i + 1) * maxArgLength < str.length()) { + if (i + 1) * maxArgLength < str.length() { // Formulate the substring string subString = str.substring((i * maxArgLength), ((i + 1) * maxArgLength)); // Append substring with newline @@ -293,7 +293,7 @@ isolated function getKeyArray(map valueMap) returns @tainted string[] { string[] keyArray = valueMap.keys(); foreach string keyVal in keyArray { var value = valueMap.get(keyVal); - if (value is map) { + if value is map { string[] childKeys = getKeyArray(>value); foreach string childKey in childKeys { keyArray.push(keyVal + "." + childKey); @@ -309,7 +309,7 @@ isolated function getMapValueDiff(map actualMap, map expectedM string[] expectedKeyArray = getKeyArray(expectedMap); string keyDiff = getKeysDiff(actualKeyArray, expectedKeyArray); string valueDiff = compareMapValues(actualMap, expectedMap); - if (keyDiff != "") { + if keyDiff != "" { diffValue = diffValue.concat(keyDiff, "\n", valueDiff); } else { diffValue = diffValue.concat(valueDiff); @@ -317,40 +317,37 @@ isolated function getMapValueDiff(map actualMap, map expectedM return diffValue; } -isolated function getValueComparison(anydata actual, anydata expected, string keyVal, int count) returns @tainted ([string, int]) { +isolated function getValueComparison(anydata actual, anydata expected, string keyVal, int count) + returns @tainted ([string, int]) { int diffCount = count; string diff = ""; string expectedType = getBallerinaType(expected); string actualType = getBallerinaType(actual); - if (expectedType != actualType) { - diff = diff.concat("\n", "key: ", keyVal, "\n \nexpected value\t: <", expectedType, "> ", expected.toString(), - "\nactual value\t: <", actualType, "> ", actual.toString()); + if expectedType != actualType { + diff = diff.concat(string `${"\n"}key: ${keyVal}${"\n \n"}` + + string `expected value${"\t"}: <${expectedType}> ${expected.toString()}` + + string `${"\n"}actual value${"\t"}: <${actualType}> ${actual.toString()}`); diffCount = diffCount + 1; - } else { - if (actual is map && expected is map) { - string[] expectedkeyArray = (>expected).keys(); - string[] actualKeyArray = (>actual).keys(); - int orderCount = diffCount; - foreach string childKey in actualKeyArray { - if (expectedkeyArray.indexOf(childKey) != ()){ - anydata expectedChildVal = expected.get(childKey); - anydata actualChildVal = actual.get(childKey); - string childDiff; - if (expectedChildVal != actualChildVal) { - [childDiff, diffCount] = getValueComparison(actualChildVal, expectedChildVal, keyVal + "." + childKey, diffCount); - if (diffCount != (orderCount + 1)) { - diff = diff.concat("\n"); - } - diff = diff.concat(childDiff); + } else if actual is map && expected is map { + int orderCount = diffCount; + foreach [string, anydata] [childKey, actualChildVal] in actual.entries() { + if expected.hasKey(childKey) { + anydata expectedChildVal = expected.get(childKey); + string childDiff; + if expectedChildVal != actualChildVal { + [childDiff, diffCount] = getValueComparison(actualChildVal, expectedChildVal, + keyVal + "." + childKey, diffCount); + if diffCount != (orderCount + 1) { + diff = diff.concat("\n"); } + diff = diff.concat(childDiff); } - } - } else { - diff = diff.concat("\n", "key: ", keyVal, "\n \nexpected value\t: ", expected.toString(), - "\nactual value\t: ", actual.toString()); - diffCount = diffCount + 1; } + } else { + diff = diff.concat(string `${"\n"}key: ${keyVal}${"\n \n"}expected value${"\t"}: ${expected.toString()}` + + string `${"\n"}actual value${"\t"}: ${actual.toString()}`); + diffCount = diffCount + 1; } return [diff, diffCount]; } @@ -360,21 +357,21 @@ isolated function compareMapValues(map actualMap, map expected string[] actualKeyArray = actualMap.keys(); int count = 0; foreach string keyVal in actualKeyArray { - if (expectedMap.hasKey(keyVal)) { + if expectedMap.hasKey(keyVal) { anydata expected = expectedMap.get(keyVal); anydata actual = actualMap.get(keyVal); - if (expected != actual) { + if expected != actual { string diffVal; [diffVal, count] = getValueComparison(actual, expected, keyVal, count); - if (count != 1) { + if count != 1 { diff = diff.concat("\n"); } diff = diff.concat(diffVal); } } } - if (count > mapValueDiffLimit) { - diff = diff.concat("\n \nTotal value mismatches: " + count.toString() + "\n"); + if count > mapValueDiffLimit { + diff = diff.concat(string `${"\n \n"}Total value mismatches: ${count.toString()}${"\n"}`); } return diff; } diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/concurrentExecuter.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/concurrentExecuter.bal index d0b1dcf08d36..45b9ea9ed66c 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/concurrentExecuter.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/concurrentExecuter.bal @@ -42,7 +42,7 @@ isolated function executeBeforeGroupFunctionsIsolated(TestFunction testFunction) TestFunction[]? beforeGroupFunctions = beforeGroupsRegistry.getFunctions('group); if beforeGroupFunctions != () && !groupStatusRegistry.firstExecuted('group) { handleBeforeGroupOutput(testFunction, 'group, executeFunctionsIsolated(beforeGroupFunctions, - getShouldSkip())); + getShouldSkip())); } } } @@ -93,7 +93,7 @@ isolated function executeNonDataDrivenTestIsolated(TestFunction testFunction, return true; } boolean failed = handleNonDataDrivenTestOutput(testFunction, executeTestFunctionIsolated(testFunction, "", - GENERAL_TEST)); + GENERAL_TEST)); if executeAfterFunctionIsolated(testFunction) { return true; } diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/execute.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/execute.bal index 15c7007b9d81..b75e317f8d5d 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/execute.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/execute.bal @@ -68,11 +68,11 @@ public function startSuite() returns int { function executeTests() returns error? { decimal startTime = currentTimeInMillis(); foreach TestFunction testFunction in testRegistry.getFunctions() { - if !testFunction.serialExecution { + if testFunction.serialExecution { + executionManager.addInitialSerialTest(testFunction); + } else { executionManager.addInitialParallelTest(testFunction); - continue; } - executionManager.addInitialSerialTest(testFunction); } while !executionManager.isExecutionDone() { if executionManager.getSerialQueueLength() != 0 && executionManager.countTestInExecution() == 0 { @@ -111,7 +111,7 @@ function executeAfterSuiteFunctions() { function orderTests() returns error? { string[] descendants = []; foreach TestFunction testFunction in testRegistry.getDependentFunctions() { - if (!executionManager.isVisited(testFunction.name) && executionManager.isEnabled(testFunction.name)) { + if !executionManager.isVisited(testFunction.name) && executionManager.isEnabled(testFunction.name) { check restructureTest(testFunction, descendants); } } @@ -150,7 +150,7 @@ function restructureTest(TestFunction testFunction, string[] descendants) return isolated function printExecutionError(ExecutionError err, string functionSuffix) { println("\t[fail] " + err.detail().functionName + "[" + functionSuffix + "]" + ":\n\t " + - formatFailedError(err.message(), 2)); + formatFailedError(err.message(), 2)); } isolated function getErrorMessage(error err) returns string { @@ -218,7 +218,7 @@ isolated function isTestReadyToExecute(TestFunction testFunction, DataProviderRe error? diagnoseError = testFunction.diagnostics; if diagnoseError is error { reportData.onFailed(name = testFunction.name, message = diagnoseError.message(), testType = - getTestType(testFunctionArgs)); + getTestType(testFunctionArgs)); println(string `${"\n\t"}${testFunction.name} has failed.${"\n"}`); enableExit(); executionManager.setExecutionSuspended(testFunction.name); @@ -284,8 +284,8 @@ isolated function handleDataDrivenTestOutput(ExecutionError|boolean err, TestFun TestType testType) { if err is ExecutionError { reportData.onFailed(name = testFunction.name, suffix = suffix, message = - string `[fail data provider for the function ${testFunction.name}]${"\n"} ${getErrorMessage(err)}`, - testType = testType); + string `[fail data provider for the function ${testFunction.name}]${"\n"} ${getErrorMessage(err)}`, + testType = testType); println(string `${"\n\t"}${testFunction.name}:${suffix} has failed.${"\n"}`); enableExit(); } @@ -310,11 +310,11 @@ isolated function handleAfterFunctionOutput(ExecutionError? err) returns boolean } isolated function handleTestFuncOutput(any|error output, TestFunction testFunction, string suffix, TestType testType) -returns ExecutionError|boolean { + returns ExecutionError|boolean { if output is TestError { enableExit(); reportData.onFailed(name = testFunction.name, suffix = suffix, message = getErrorMessage(output), - testType = testType); + testType = testType); println(string `${"\n\t"}${testFunction.name}:${suffix} has failed.${"\n"}`); return true; } @@ -326,8 +326,8 @@ returns ExecutionError|boolean { return error(getErrorMessage(output), functionName = testFunction.name); } -isolated function prepareDataSet(DataProviderReturnType? testFunctionArgs, string[] keys, - AnyOrError[][] values) returns TestType { +isolated function prepareDataSet(DataProviderReturnType? testFunctionArgs, string[] keys, AnyOrError[][] values) + returns TestType { TestType testType = DATA_DRIVEN_MAP_OF_TUPLE; if testFunctionArgs is map { foreach [string, AnyOrError[]] [k, v] in testFunctionArgs.entries() { @@ -366,12 +366,9 @@ isolated function skipDataDrivenTest(TestFunction testFunction, string suffix, T // get the matching wildcard prefixMatch = true; foreach string filter in testOptions.getFilterTests() { - if filter.includes(WILDCARD) { - boolean|error wildCardMatch = matchWildcard(functionKey, filter); - if wildCardMatch is boolean && wildCardMatch && matchModuleName(filter) { - functionKey = filter; - break; - } + if filter.includes(WILDCARD) && matchWildcard(functionKey, filter) == true && matchModuleName(filter) { + functionKey = filter; + break; } } } @@ -384,22 +381,20 @@ isolated function skipDataDrivenTest(TestFunction testFunction, string suffix, T string[] subTests = testOptions.getFilterSubTest(functionKey); foreach string subFilter in subTests { string updatedSubFilter = subFilter; - if testType == DATA_DRIVEN_MAP_OF_TUPLE { - if subFilter.startsWith(SINGLE_QUOTE) && subFilter.endsWith(SINGLE_QUOTE) { - updatedSubFilter = subFilter.substring(1, subFilter.length() - 1); - } + if testType == DATA_DRIVEN_MAP_OF_TUPLE && subFilter.startsWith(SINGLE_QUOTE) + && subFilter.endsWith(SINGLE_QUOTE) { + updatedSubFilter = subFilter.substring(1, subFilter.length() - 1); } string|error decodedSubFilter = escapeSpecialCharacters(updatedSubFilter); updatedSubFilter = decodedSubFilter is string ? decodedSubFilter : updatedSubFilter; string|error decodedSuffix = escapeSpecialCharacters(suffix); string updatedSuffix = decodedSuffix is string ? decodedSuffix : suffix; - boolean wildCardMatchBoolean = false; + boolean wildCardMatch = false; if updatedSubFilter.includes(WILDCARD) { - boolean|error wildCardMatch = matchWildcard(updatedSuffix, updatedSubFilter); - wildCardMatchBoolean = wildCardMatch is boolean && wildCardMatch; + wildCardMatch = matchWildcard(updatedSuffix, updatedSubFilter) == true; } - if (updatedSubFilter == updatedSuffix) || wildCardMatchBoolean { + if (updatedSubFilter == updatedSuffix) || wildCardMatch { suffixMatch = true; break; } diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/filter.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/filter.bal index d1f1b59a7587..9453dac5a6e3 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/filter.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/filter.bal @@ -69,8 +69,8 @@ function filterKeyBasedTests(string packageName, string moduleName, string[] tes int separatorIndex = updatedName.indexOf(DATA_KEY_SEPARATOR); string suffix = updatedName.substring(separatorIndex + 1); string testPart = updatedName.substring(0, separatorIndex); - if testOptions.isFilterSubTestsContains(updatedName) && testOptions.getFilterSubTest(updatedName) - is string[] { + if testOptions.isFilterSubTestsContains(updatedName) + && testOptions.getFilterSubTest(updatedName) is string[] { string[] subTestList = testOptions.getFilterSubTest(testPart); subTestList.push(suffix); testOptions.addFilterSubTest(testPart, subTestList); @@ -137,12 +137,8 @@ isolated function readRerunJson() returns map|error { return content.fromJsonStringWithType(); } -function containsModulePrefix(string packageName, string moduleName, string testName) returns boolean { - if containsAPrefix(testName) { - return isPrefixInCorrectFormat(packageName, moduleName, testName); - } - return false; -} +function containsModulePrefix(string packageName, string moduleName, string testName) returns boolean => + containsAPrefix(testName) && isPrefixInCorrectFormat(packageName, moduleName, testName); function containsAPrefix(string testName) returns boolean { if testName.includes(MODULE_SEPARATOR) { @@ -154,16 +150,13 @@ function containsAPrefix(string testName) returns boolean { return false; } -function containsDataKeySuffix(string testName) returns boolean { - return testName.includes(DATA_KEY_SEPARATOR); -} +function containsDataKeySuffix(string testName) returns boolean => testName.includes(DATA_KEY_SEPARATOR); function isPrefixInCorrectFormat(string packageName, string moduleName, string testName) returns boolean { string prefix = testName.substring(0, testName.indexOf(MODULE_SEPARATOR)); return prefix.includes(packageName) || prefix.includes(packageName + DOT + moduleName); } -isolated function getFullModuleName() returns string { - return testOptions.getPackageName() == testOptions.getModuleName() ? testOptions.getPackageName() +isolated function getFullModuleName() returns string => + testOptions.getPackageName() == testOptions.getModuleName() ? testOptions.getPackageName() : testOptions.getPackageName() + DOT + testOptions.getModuleName(); -} diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/register.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/register.bal index 3e82bd41b891..b0558c0be7ca 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/register.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/register.bal @@ -464,6 +464,7 @@ isolated class GroupStatusRegistry { return self.executedTests.get('group) > 0; } } + isolated function lastExecuted(string 'group) returns boolean { lock { return self.executedTests.get('group) == self.enabledTests.get('group); diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/report.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/report.bal index 8bd263c14a78..34baf2705d36 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/report.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/report.bal @@ -168,9 +168,7 @@ isolated function formatFailedError(string message, int tabCount) returns string string[] lines = split(message, "\n"); lines.push(""); string tabs = ""; - int count = 0; foreach int i in 1 ... tabCount { - count += 1; tabs += "\t"; } return string:'join("\n" + tabs, ...lines); @@ -251,7 +249,7 @@ function moduleStatusReport(ReportData data) { function escapeSpecialCharactersJson(string name) returns string { string|error encodedName = escapeSpecialCharacters(name); - return ((encodedName is string) ? encodedName : name); + return encodedName is string ? encodedName : name; } function replaceDoubleQuotes(string originalString) returns string { diff --git a/misc/testerina/modules/testerina-core/src/main/ballerina/serialExecuter.bal b/misc/testerina/modules/testerina-core/src/main/ballerina/serialExecuter.bal index c369e8722a21..0a54e3d0f90c 100644 --- a/misc/testerina/modules/testerina-core/src/main/ballerina/serialExecuter.bal +++ b/misc/testerina/modules/testerina-core/src/main/ballerina/serialExecuter.bal @@ -30,8 +30,7 @@ function executeTest(TestFunction testFunction) { shouldSkipDependents = executeNonDataDrivenTest(testFunction); } } else { - reportData.onSkipped(name = testFunction.name, testType = - getTestType(dataDrivenTestParams[testFunction.name])); + reportData.onSkipped(name = testFunction.name, testType = getTestType(dataDrivenTestParams[testFunction.name])); shouldSkipDependents = true; } testFunction.groups.forEach('group => groupStatusRegistry.incrementExecutedTest('group)); @@ -44,8 +43,7 @@ function executeBeforeGroupFunctions(TestFunction testFunction) { foreach string 'group in testFunction.groups { TestFunction[]? beforeGroupFunctions = beforeGroupsRegistry.getFunctions('group); if beforeGroupFunctions != () && !groupStatusRegistry.firstExecuted('group) { - handleBeforeGroupOutput(testFunction, 'group, executeFunctions(beforeGroupFunctions, - getShouldSkip())); + handleBeforeGroupOutput(testFunction, 'group, executeFunctions(beforeGroupFunctions, getShouldSkip())); } } } @@ -70,15 +68,12 @@ function executeNonDataDrivenTest(TestFunction testFunction) returns boolean { if executeBeforeFunction(testFunction) { executionManager.setSkip(testFunction.name); reportData.onSkipped(name = testFunction.name, testType = getTestType( - dataDrivenTestParams[testFunction.name])); + dataDrivenTestParams[testFunction.name])); return true; } boolean failed = handleNonDataDrivenTestOutput(testFunction, executeTestFunction(testFunction, "", - GENERAL_TEST)); - if executeAfterFunction(testFunction) { - return true; - } - return failed; + GENERAL_TEST)); + return executeAfterFunction(testFunction) || failed; } function executeAfterEachFunctions() => @@ -103,19 +98,16 @@ function executeFunctions(TestFunction[] testFunctions, boolean skip = false) re } } -function prepareDataDrivenTest(TestFunction testFunction, string key, AnyOrError[] value, - TestType testType) { +function prepareDataDrivenTest(TestFunction testFunction, string key, AnyOrError[] value, TestType testType) { if executeBeforeFunction(testFunction) { - reportData.onSkipped(name = testFunction.name, testType = getTestType( - dataDrivenTestParams[testFunction.name])); + reportData.onSkipped(name = testFunction.name, testType = getTestType(dataDrivenTestParams[testFunction.name])); } else { executeDataDrivenTest(testFunction, key, testType, value); _ = executeAfterFunction(testFunction); } } -function executeDataDrivenTest(TestFunction testFunction, string suffix, TestType testType, - AnyOrError[] params) { +function executeDataDrivenTest(TestFunction testFunction, string suffix, TestType testType, AnyOrError[] params) { if skipDataDrivenTest(testFunction, suffix, testType) { return; } @@ -148,7 +140,7 @@ function executeAfterFunction(TestFunction testFunction) returns boolean { function executeFunction(TestFunction|function testFunction) returns ExecutionError? { any|error output = trap function:call(testFunction is function ? testFunction : - testFunction.executableFunction); + testFunction.executableFunction); if output is error { enableExit(); return error(getErrorMessage(output), functionName = testFunction is function ? "" : diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt index d62f56be1247..a74f82306417 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt @@ -23,10 +23,10 @@ Running Tests with Coverage callableName: testDividingValuesNegative$lambda14$ moduleName: intg_tests.dataproviders$test.0.tests.test_execute-generated_*****lineNumber: 18 ",functionName="testDividingValuesNegative") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt index d3a8749e72fe..85af93c109b3 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt @@ -16,20 +16,20 @@ Running Tests [fail data provider for the function testInvalidDataProvider] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(int)' cannot be passed to function expecting parameter list '(string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test.bal lineNumber: 37 ",functionName="testInvalidDataProvider") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt index c80c73073bb0..1bb37ae1fccd 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt @@ -18,20 +18,20 @@ Running Tests [fail data provider for the function testInvalidDataProvider2] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(int,int,int)' cannot be passed to function expecting parameter list '(string,string,string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test2.bal lineNumber: 39 ",functionName="testInvalidDataProvider2") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt index e4e3270f74ed..dcdbb9b72e57 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt @@ -15,20 +15,20 @@ Running Tests [fail data provider for the function testInvalidTupleDataProvider] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(string,int)' cannot be passed to function expecting parameter list '(string,string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test3.bal lineNumber: 36 ",functionName="testInvalidTupleDataProvider") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt index 9af0622d91df..a59ff77390dc 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt @@ -23,10 +23,10 @@ Running Tests with Coverage callableName: testDividingValuesNegative$lambda14$ moduleName: intg_tests.dataproviders$test.0.tests.test_execute-generated_*****lineNumber: 18 ",functionName="testDividingValuesNegative") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt index 8298a3d541b0..bcbe73b7d4c7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt @@ -16,20 +16,20 @@ Running Tests [fail data provider for the function testInvalidDataProvider] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(int)' cannot be passed to function expecting parameter list '(string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test.bal lineNumber: 37 ",functionName="testInvalidDataProvider") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt index ddae8eaf4b04..cecfee58b15f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt @@ -18,20 +18,20 @@ Running Tests [fail data provider for the function testInvalidDataProvider2] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(int,int,int)' cannot be passed to function expecting parameter list '(string,string,string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test2.bal lineNumber: 39 ",functionName="testInvalidDataProvider2") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt index 037aa194e799..86770687cebc 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidTupleDataProvider.txt @@ -15,20 +15,20 @@ Running Tests [fail data provider for the function testInvalidTupleDataProvider] error {ballerina/test:0}ExecutionError ("error("{ballerina/lang.function}IncompatibleArguments",message="arguments of incompatible types: argument list '(string,int)' cannot be passed to function expecting parameter list '(string,string)'") callableName: call moduleName: ballerina.lang.function.0 fileName: function.bal lineNumber: 37 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 137 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 129 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53 callableName: __execute__ fileName: invalid-data-provider-test3.bal lineNumber: 36 ",functionName="testInvalidTupleDataProvider") callableName: handleTestFuncOutput moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 326 - callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 138 - callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 122 - callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 112 - callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 65 + callableName: executeTestFunction moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 130 + callableName: executeDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 114 + callableName: prepareDataDrivenTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 105 + callableName: executeDataDrivenTestSet moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 63 callableName: executeTest moduleName: ballerina.test.0 fileName: serialExecuter.bal lineNumber: 28 callableName: executeTests moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 81 callableName: startSuite moduleName: ballerina.test.0 fileName: execute.bal lineNumber: 53