You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While looking into this forum thread, I found that students cannot output anything to debug their code. Also the test feedback somehow is incomplete:
Code Run
): void {
$class = new LuckyNumbers();
$actual = $class->validate($input);
$this->assertSame('', $actual);
Test Failure
LuckyNumbersTest::testErrorMessageForValidInput with data set #5
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-''
+'Must be a whole number larger than 0'
LuckyNumbersTest.php:138
This test file uses @dataProvider to ease coding of tests, but that must be designed to deliver acceptable test feedback (students must see test input, not "data set #5"). It is best to avoid data providers.
Anyways, there should be test output delivered when using echo or var_dump(). And that's missing.
Code submitted:
<?phpclass LuckyNumbers
{
publicfunctionsumUp(array$digitsOfNumber1, array$digitsOfNumber2): int
{
return\implode($digitsOfNumber1) + \implode($digitsOfNumber2);
}
publicfunctionisPalindrome(int$number): bool
{
return (string)$number == \strrev($number);
}
publicfunctionvalidate(string$input): string
{
echo$input;
if ($input == ""){
return"Required field";
}
elseif(!is_numeric($input) || intval($input) <= 0 || (intval($input)) != $input){
return"Must be a whole number larger than 0";
}
elsereturn"";
}
}
The text was updated successfully, but these errors were encountered:
I have analysed the possible sources for including the input values into the test feedback. There is no hint in JUnit results.xml nor teamcity.txt. So this must be solved by re-designing the test files in the PHP track:
While looking into this forum thread, I found that students cannot output anything to debug their code. Also the test feedback somehow is incomplete:
This test file uses
@dataProvider
to ease coding of tests, but that must be designed to deliver acceptable test feedback (students must see test input, not "data set #5"). It is best to avoid data providers.Anyways, there should be test output delivered when using
echo
orvar_dump()
. And that's missing.Code submitted:
The text was updated successfully, but these errors were encountered: