The following patch would allow developers to create and run tests using Drupal Testing Framework. I have written down a few sample tests, like checking whether a basic chart is generated, title is appended, axis labels are appended against an expected string. Moreover a basic test to check whether Views Data is generated and the Chart Views Plugin renders the appropriate expected string have been provided.

Developers can later include more tests, to check out expected features.
The several undefined indexes as shown in the screenshot is exactly what the issues queues #1202080: Undefined index: chts and #1103966: Notice: Undefined index: chxl, chxp, set in chart.module suggest respectively.

CommentFileSizeAuthor
chart-test.png115.96 KBmaulik.kamdar
chart-simpletest.patch20.66 KBmaulik.kamdar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

13rac1’s picture

Status: Needs review » Needs work

Doesn't apply because patch expects files to already exist. Use git diff --cached and git add to make a patch with new files.

The tests need not be in a new module. Simply adding them to the main module, and views module will work.

There are two permissions being added, but I don't see either being used. They should probably be removed.

Please update patch to work against the 7.x-1.x-mk branch.

Thanks for your efforts!

Pierre.Vriens’s picture

Title: Chart Tests » Enable use of Drupal Testing Framework
Issue summary: View changes
Parent issue: » #2371075: Chart 7.x-2.x Release

Maulik, I know we're more then 3 years later, but still: thank you very much for this suggestion. I think it's extremely valuable, a pity it has been sitting in the issue queue for so long. Can you (or anybody else?) think of a way to provide an updated version of this patch, I"d assume a patch to be applied to the most current 7.x dev version. If the items in #1 could be addressed at the same time, that would be even better.

What I don't quite understand in #1 (yet), is the 2nd paragraph about new module: why? What are the pros/cons? It appears to me that if you can put it in a separated module, you can only enable that module whenever you really want to do testing. Am I missing something?

Pierre.Vriens’s picture

Issue summary: View changes
Pierre.Vriens’s picture