Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QTest] Support for test case data in CheckAllTestCases and RunAllTestCases #2026

Open
Manvi-Agrawal opened this issue Nov 15, 2024 · 0 comments
Labels
enhancement New feature or request needs triage

Comments

@Manvi-Agrawal
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently CheckAllTestCases and RunAllTestCases function take a tuple of the form: (name : String, test_case : () -> 'T, expected : 'T). So, Iif someone wants to test a function for multiple inputs/outputs it leads to code duplication.

CheckAllTestCases([
("Should add 1 to 5", () -> AddOne(5), 6),
("Should add 1 to 5", () -> AddOne(6), 7),
]);

function AddOne(x: Int) : Int {
     return x+1;
}

Describe the solution you'd like
Allow CheckAllTestCases and RunAllTestCases function by having input array and expected output array for a function. This is motivated by pytest.mark.parameterize that allows listing inputs and expected outputs

CheckAllTestCases([
("Should add 1 to 5", (x) -> AddOne(x), [5,6], [6, 7]),
]);

function AddOne(x: Int) : Int {
     return x+1;
}

Describe alternatives you've considered
Have duplicate entries in testcases array in CheckAllTestCases and RunAllTestCases function.

Additional context
See #2013 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

1 participant