While coder module has testing code itself, it would be great to have coder support in simpletest, so one can assert that a file passes coder static tests. I was thinking how best to do the integration, and there are options:

- make a UI/API option on the simpletest UI/API, so that it is possibly to run coder on any of the enabled modules while running tests, and get the failing results as part of the test result
- provide a "flag" on test classes, that coder tests to be run on the module being tested
- provide an API to run tests on a certain file on a certain severity

I implemented the third approach with this patch, but it could be made a more generic solution if a good integration method is identified.

Also, I have that coder module requirement check implemented a bit hackish I guess.

CommentFileSizeAuthor
coder_integration.patch2.4 KBgábor hojtsy

Comments

boombatower’s picture

Status: Needs review » Closed (won't fix)

Edit: misunderstanding.

boombatower’s picture

Status: Closed (won't fix) » Needs work

Talked with chx in IRC.

Chx recommended using SimpleTest UI approach instead of AP level.

dlhubler’s picture

Title: Coder module report integration » DrupalCoderTestCase

maybe coder module should have a specialized unit test case : DrupalCoderTestCase

Being informed a file you assert has no security issues and knowing immediately when that assertion is not true is very different then a report sitting on a web page that a file has a security warning along with 200 other files.

gábor hojtsy’s picture

OK, so let's first decide the focus. I'd actually prefer to be able to run coder tests/validations in tests without writing much code. In Drupal 7, we have this file listing in info files, which would automate the collection of files to test against (but in previous versions, we need some mojo, to identify those files). So ideally, we could just have a simpletest API function to run coder tests against files of a module. And we could expose that as a checkbox in every simpletest fieldset as well I guess. So automation tools could channel the information from simpletest and users testing modules could do the security/coder check on the same UI, serious check failures failing their test as well. Is this OK, or ... ?

boombatower’s picture

Project: SimpleTest » Drupal core
Version: 6.x-1.x-dev » 7.x-dev
Component: Code » simpletest.module
Assigned: gábor hojtsy » Unassigned

Needs further discussion, but should be implemented in 7.x first and will allow for more eyes.

boombatower’s picture

Title: DrupalCoderTestCase » Add coder support into SimpleTest
boombatower’s picture

Personally I think the two should be separate as testing doesn't relate to code style. SimpleTest is designed to find bugs. Coder is designed to check style and simple security bugs. I think the two should be separate.

cwgordon7’s picture

I personally see no reason why coder can't be completely converted to use SimpleTest - it's just a system to manage assertions, ultimately - but I agree that this should remain in contrib. I would like to won't fix this.

boombatower’s picture

Status: Needs work » Closed (won't fix)

Unless there are any objects.