TYPO3 Flow Base DistributionPackagesApplications

Bug #85

Package "Testing" should not manage abstract tests/class

Added by Malte Jansen over 7 years ago. Updated almost 5 years ago.

Status:Closed Start date:
Priority:Should have Due date:
Assigned To:Karsten Dambekalns % Done:

0%

Category:-
Target version:-

Description

Abstracts test-classes are treated like normal ones, so they cannot be instanciated.
-> An error occures while testing.

History

#1 Updated by Karsten Dambekalns over 7 years ago

  • Status changed from New to Accepted

While I don't (yet) get the need for an abstract test class, the simplest (and maybe even only) way to solve this would be to extend the check when collecting the tests to not only check for the filename ending in 'Test.php', but also to make sure it does not contain '_Abstract'.

Would this be good enough?

#2 Updated by Malte Jansen over 7 years ago

Replying to [comment:1 karsten]:

While I don't (yet) get the need for an abstract test class, the simplest (and maybe even only) way to solve this would be to extend the check when collecting the tests to not only check for the filename ending in 'Test.php', but also to make sure it does not contain '_Abstract'.

Would this be good enough?

Not needed any more, because I though I the beginning, that all files in the Tests-folder must end with Test.php...

I need it because I have to add some assert-functions and have to modify the runBare-function. I'm testing the TYPO3CGL-Checks. So every check-file has to be tested with a bunch of tests having same configuration.

But perhaps you could unset variablesin some classes, which are not needed anymore after there usage (especially if the classObject is stored tempoarly). Because otherwise mememory usage gets very high (now we have over 64MB). So when we are finshed with TYPO3CGL we will have more than 50 test-files.

#3 Updated by Malte Jansen over 7 years ago

Replying to [comment:1 karsten]:

While I don't (yet) get the need for an abstract test class, the simplest (and maybe even only) way to solve this would be to extend the check when collecting the tests to not only check for the filename ending in 'Test.php'

Hi!

I have forgot that, I tested it and I just try to leave out the 'Test'. But the file/class is still loaded. There is no check for 'Test.php'
So it would help, if the check would work...
Than there is no check for a abstract needed.

Cheers,

Malte

#4 Updated by Karsten Dambekalns over 7 years ago

Are you sure it loads file not ending in "Test.php" and runs them as test? I checked and it worked as expected (the related code is around 202 in source:Packages/Testing/Classes/T3_Testing_TestRunner.php#398).

#5 Updated by Malte Jansen over 7 years ago

I'm pretty sure it loads Files without "Test.php"

Here are the first line of my testing output:

TYPO3_Base_Testsuite
T3_TYPO3CGL_AbstractBaseFile
Tests: 1 total, 0 skipped, 0 incomplete, 0 failed, 0 errors
T3_TYPO3CGL_Checks_WhiteSpace_LineEndingsSniffTest
...

There is one dummytest in T3_TYPO3CGL_AbstractBaseFile, because otherwise there would be an error, due to no tests in a Testclass...

It seems to me, that source:Packages/Testing/Classes/T3_Testing_TestRunner.php is not used anymore. Instead this file is used: source:Packages/Testing/Classes/DomainModel/T3_Testing_DomainModel_TestRunner.php.
And in this file there is no check...

#6 Updated by Karsten Dambekalns over 7 years ago

Hm, changes in the file source:Packages/Testing/Classes/T3_Testing_TestRunner.php#398 had an effect during my testing.

#7 Updated by Karsten Dambekalns over 7 years ago

Ok, I know what happens. The files not ending in "Test.php" are not loaded by the test runner, but when the actual tests are loaded the e.g. !BaseTestCase file is autoloaded as the tests extend it. Afterwards the test runner adds all classes as testcases that exist, assuming all classes loaded at that point are tests... The check for the filename needs to be applied likewise to class names to fix this.

#8 Updated by Karsten Dambekalns over 7 years ago

  • Status changed from Accepted to Closed
  • Sprint set to fixed
(In r435) Testing:
  • The test runner now reads the package and/or test to run from $_REQUEST, so it's also possible to request this via a simple GET request - helps with debugger use...
  • Only classes ending in "Test" are considered to be testcases now, fixes #85

#9 Updated by Robert Lemke about 7 years ago

  • Target version deleted (1)

Also available in: Atom PDF