How to test plugins

While writing plugins, I like to be able to easily force them to be called, and to view the debug messages.
I’ve gotten a process that works, so I’m posting it here so the next person might be able to find it, and to improve it if possible.

  1. stop the systemd service I normally have for updates. Probably unnecessary.
  2. make changes to the plugin code
  3. run
sudo -u www-data php update.php --force-rehash --debug-feed *feed id*
  1. goto step 2

I got the feed id by running SELECT id, title FROM ttrss_feeds; and looking for the right one.
You can also get the feed id by pressing “f D” in the web UI.

This process works, but if there is a better way to do any of that it would be cool to know about.

Is there any place that documents how to test plugins?
I wasn’t able to find anything, but I think something should be put here at least: git.tt-rss org/fox/tt-rss/wiki/Plugins
I got here by reading the code and trying things.

Cheers

there’s no generic emulator or debugging framework for plugins and tbh i’m not sure how it would work.

you don’t need to stop any services - worst thing that might happen is you getting some errors in event log and a few aborted feed updates if your plugin has a syntax error or whatever.

you can also set a separate tt-rss instance to work on, it might be configured to share your normal database so you don’t have to keep everything twice. this way you don’t need to bother other users when you’re updating code. i have a few of those - separate one to test on mysql, a general dev instance for more protracted invasive changes, etc.

if your plugin does its thing on feed update, feed debugger seems like a proper place to test it. i also have some test feeds with static sample data to run plugins on.

some plugins like af_redditimgur has their own separate test methods which can be called to see how it behaves on a particular input which could be easier then feeding it via article HTML.