How do I test an add-on under development?

A developer who is on their 2nd project with the Gramps API is writing a new report. I’m helping out with some testing and feedback. We’ve found and he’s corrected a number of things already.

Is there a way to target the Testing of Reports on just a single Report instead of all Reports, All Formats?

We’re now exploring whats needed to add CLI parameter passing and Book compatibility… then test it. And we’re finding the documentation a bit thin.

I have never used that script for testing, so I don’t have any advice to give you. You may have to read its code to figure out how it works.

Regarding how to set up for CLI and Book; I think it is mostly setting the report_modes value in the gpr.py file. I usually end up doing things by example; I read the code on a report with similar features, and see how it was set up. For instance, the “Individual Complete” report supports CLI and Book as well as GUI modes. See "…/gramps/plugins/textreport/textplugins.gpr.py and its associated indivcomplete.py.

BTW, don’t use the “plg=newplugin()” that is used in the gramps/plugins files gpr.py for addons, use the “register()” form instead.

When it comes to testing, I usually just laboriously try it out, trying every parameter at least once in the GUI, and combinations where it makes sense that they might interact.

If you have used the standard report options classes, then they should also work under CLI and Book modes. But you should test the CLI with your own options manually just to make sure that they are properly recognized.

In CLI using the CLI help feature to list parameters and their values will also tell you if they are properly recognized. For example:

gramps -O “Family Tree 1” -a report -p “name=family_group,show=all”

https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Command_Line#Available_Gramps_options

1 Like

Well, it now runs from the GUI, Books or CLI.

Still have to do the documentation. That’ll take a while. Figuring out how to allow the 3 custom GUI options to be selected from the CLI will have to be a future target.

But it will be a good example for setting up the most basic of reports for an expansion feature. (In this case, Attributes & Associations)

Rather than have dozens of reports, it seems like this might be a good framework for adding an option/section for each type of object and its attributes. In a variety of text formats… including CSV.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.