Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| indigo_2024.1_documentation:plugin_testing_tutorial [2024/10/18 14:46] – [Unit Testing Indigo Plugins] davel17 | indigo_2024.1_documentation:plugin_testing_tutorial [2024/10/21 18:51] (current) – [Folder Structure] davel17 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Plugin Testing | + | ====== Plugin Testing |
| - | Once you have developed a functioning plugin, it's a good idea to add automated methods to test your code before publishing plugins and plugin updates. "Unit testing" | + | Once you' |
| ===== Python Unit Testing ===== | ===== Python Unit Testing ===== | ||
| Line 12: | Line 12: | ||
| - The ''// | - The ''// | ||
| - The ''// | - The ''// | ||
| - | - An IDE that supports unit testing - which not required, having an IDE that supports unit testing can be very helpful. | + | - An IDE that supports unit testing - while not required, having an IDE that supports unit testing can be very helpful. |
| === Testing Structure === | === Testing Structure === | ||
| Line 18: | Line 18: | ||
| === Environment Variables === | === Environment Variables === | ||
| - | While optional, it is a good idea to create an environment variable framework that allows you to create and make references to elements of your development environment. Once you have installed ''// | + | While optional, it is a good idea to create an environment variable framework that allows you to create and make references to elements of your development environment. Once you have installed ''// |
| .ENV file | .ENV file | ||
| Line 30: | Line 30: | ||
| === Folder Structure === | === Folder Structure === | ||
| - | While optional, it's probably best to organize your test files and keep them separate from your main plugin files. For the purposes of this tutorial, we will store them in a ''// | + | While optional, it's probably best to organize your test files and keep them separate from your main plugin files. For the purposes of this guide, we will store them in a ''// |
| < | < | ||
| Line 39: | Line 39: | ||
| |_ ... | |_ ... | ||
| </ | </ | ||
| - | Of course, you can put them anywhere | + | Of course, you can put them anywhere your plugin can see them. Depending on your development environment, |
| === Main Plugin === | === Main Plugin === | ||
| - | You'll need to add a few things to your plugin to support this approach. | + | You'll need to add a few things to your plugin to support this testing |
| * A Plugin Action Item - add a plugin action to your Actions.xml file that will be used to run the tests. It is recommended that you hide the action so it's not visible to users. | * A Plugin Action Item - add a plugin action to your Actions.xml file that will be used to run the tests. It is recommended that you hide the action so it's not visible to users. | ||
| < | < | ||
| Line 71: | Line 71: | ||
| === Test File Structure === | === Test File Structure === | ||
| - | This is where the bulk of your testing code will reside. You could add your tests directly to your plugin but, as mentioned above, it offers a way to segregate your testing code from your published plugin to reduce its footprint by adding them to your ''// | + | This is where the bulk of your testing code will reside. You could add your tests directly to your plugin but, as mentioned above, it offers a way to segregate your testing code from your published plugin to reduce its footprint by adding them to your ''// |
| * an __init__() file - to make your Tests available for module level imports. | * an __init__() file - to make your Tests available for module level imports. | ||
| Line 77: | Line 77: | ||
| === Test File Structure === | === Test File Structure === | ||
| - | The ''// | + | The ''// |
| < | < | ||
| Line 133: | Line 133: | ||
| </ | </ | ||
| + | That's all you need to run tests that access the IOM. If all went according to plan, you should see something like: | ||
| + | < | ||
| + | | ||
| + | My Indigo Plugin | ||
| + | My Indigo Plugin | ||
| + | My Indigo Plugin | ||
| + | ... | ||
| + | </ | ||
| === Even More Tests === | === Even More Tests === | ||
| You can, of course, build tests that run independent of the IOM such as: | You can, of course, build tests that run independent of the IOM such as: | ||
| Line 138: | Line 146: | ||
| * using Indigo' | * using Indigo' | ||
| - | These approaches are a bit more " | + | These approaches are a bit more " |