{"id":212,"date":"2018-05-04T16:07:09","date_gmt":"2018-05-04T16:07:09","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/?p=212"},"modified":"2018-05-04T16:07:09","modified_gmt":"2018-05-04T16:07:09","slug":"good-practices-for-using-procedures-within-gp_test-scripts","status":"publish","type":"post","link":"https:\/\/cyflex.com\/index.php\/good-practices-for-using-procedures-within-gp_test-scripts\/","title":{"rendered":"Good practices for using procedures within gp_test scripts"},"content":{"rendered":"<p><strong>Did you know<\/strong> that there are some good practices for using procedures within gp_test scripts?<\/p>\n<p><strong>Do: <\/strong><\/p>\n<ul>\n<li>Define and reuse standard procedures that do <u>one specific<\/u> job well, where \u201cstandard\u201d means usable across multiple test cells or multiple tests.<\/li>\n<li>Make sure to clearly identify and limit the number of external dependencies, for example:<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>use @STABILITY_SPECS and @LIMIT_SPECS features within a gp_test procedure rather than relying on externally defined running averages or limit_specs.<\/li>\n<li>Use @CREATE_VAR for temporary variables used within a procedure rather than defining the variables in gen_labels.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>At the start of the script document:<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>a procedure\u2019s purpose and intended scope of use (and limitations).<\/li>\n<li>changes to the procedure with date\/time and reason for change.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Place comments in procedures about the reasons for various elements (comments on \u201cwhy\u201d are generally more useful than those on \u201cwhat\u201d or \u201chow\u201d).<\/li>\n<li>Keep flow through the procedure as linear as possible, i.e. avoid mode-to-mode jumps other than skipping one or more modes and sequence the mode numbers and order in the file consistently with the normal flow through the procedure.<\/li>\n<li>Consider whether a procedure is a \u201croot\u201d procedure (i.e. highest level that is started with \u2018nt\u2019) vs. a sub-procedure.\u00a0 Root procedures should not use RETURNs, as there would be no script to which to RETURN.<\/li>\n<li>Note that there are some procedures such as gp_shutdown and gp_emergency which don\u2019t RETURN.\u00a0 Also, procedures called from @GLOBAL_EVENTS and @UNIVERSAL*_EVENTS usually don\u2019t RETURN.\u00a0 For example, typically the \u201ctest\u201d instance of gp_test handles (or should handle) \u2018emergency\u2019 and \u2018abort_limit\u2019 events in @GLOBAL_EVENTS by triggering gp_emergency and gp_shutdown respectively.<\/li>\n<li>Make use of display strings to indicate status of procedure to users, especially when handling abnormal conditions, such as abnormal test termination due to some discovered test article or test equipment fault.\u00a0 Provide clear information and guidance to test cell operators and support personnel in these cases.<\/li>\n<li>Make use of test tables (aka \u201cfurball\u201d files), but keep it simple and well defined:<\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Document the required columns of the test table that the procedure needs.<\/li>\n<li>Use at most one active test table per procedure.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Use \u201cck\u201d to check for syntax errors, missing variables and more.<\/li>\n<li>Validate your procedure operates as expected prior to launching it into a long \/ un-observed automated test.<\/li>\n<li>There may be multiple gp_test instances running and most procedures apply to only one specific instance.\u00a0 Use the @INSTANCE keyword in each procedure to define which instance can use this procedure and prevent its use in other procedures.\u00a0 For example, a smoke meter management instance should never call a procedure which manages the engine, such as \u201cgp_shutdown\u201d.<\/li>\n<li>Use trace files and \u2018hold\u2019, \u2018release\u2019, \u2018adv\u2019 commands to troubleshoot a gp_test procedure.\u00a0 The trace file location is defined in the gp_test header for each instance of gp_test that is running, typical \/specs\/gp\/TRACE for the main test procedure<\/li>\n<li>See the CyFlex User Manual chapter on gp_test for more information.<\/li>\n<\/ul>\n<p><strong>Don\u2019t: <\/strong><\/p>\n<ul>\n<li>Change a procedure without assessing impact on any procedures that call it.<\/li>\n<li>Use multiple nested loops in one procedure.<\/li>\n<li>Start a new service (CyFlex program) in a procedure without determining where that same process will be terminated and factoring that into your overall test, for example use of background and auxiliary tasks started by a gp_test procedure should have a means to be \u2018cleaned up\u2019 at an appropriate time.<\/li>\n<li>Use a procedure from another test cell or previous test setup without checking that its contents are compatible with the present test configuration and appropriate to the test needs.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Did you know that there are some good practices for using procedures within gp_test scripts? Do: Define and reuse standard procedures that do one specific job well, where \u201cstandard\u201d means usable across multiple test cells or multiple tests. Make sure to clearly identify and limit the number of external dependencies, for example: use @STABILITY_SPECS and [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-212","post","type-post","status-publish","format-standard","hentry","category-did-you-know"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":0,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}