{"id":1043,"date":"2012-04-23T12:36:31","date_gmt":"2012-04-23T16:36:31","guid":{"rendered":"http:\/\/mainlinetest.com\/?p=1043"},"modified":"2012-04-23T12:52:55","modified_gmt":"2012-04-23T16:52:55","slug":"creating-a-custom-step-type","status":"publish","type":"post","link":"https:\/\/mainlinetest.com\/?p=1043","title":{"rendered":"Creating a Custom Step Type"},"content":{"rendered":"<p>In a previous blog post called <a href=\"http:\/\/www.mainlinetest.com\/?p=968\">&#8216;Sequence Call Step Type vs. Sequence Adapter&#8217;<\/a> I showed how one can couple the Action Step Type with the Sequence Call Adapter to create a Sequence Call Step that does NOT return a \u2018Passed\u2019 status upon completion.&nbsp; Feel free to to read my previous blog post if you are wondering why I would want to do such a thing.&nbsp; However, for this post I do want to remind you that the reason this could not be done with simply using the Sequence Call Step Type is because of the fact that the Status Expression is defaulted to either return \u2018Passed\u2019 or \u2018Failed\u2019 as shown in the Figure below.<\/p>\n<p><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb.png\" width=\"503\" height=\"165\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 1<\/strong><\/p>\n<p align=\"left\">Now lets say that you decide to make this a best practice in your organization and want to ensure that all developers going forward will utilize the new coding standards and be consistent with their coding practices when using Sequence Calls.&nbsp; An ideal way to achieve this is by creating a Custom Step Type.&nbsp; In this blog post, I am going to expand on a previous blog post to demonstrate how to get started creating Custom Steps.&nbsp; In this case, to create a custom Sequence Call Step Type such that it does NOT return a \u2018Passed\u2019 status upon successful completion.<\/p>\n<p align=\"left\"><strong><em>Getting Started<\/em><\/strong><\/p>\n<p align=\"left\">In order to do this I need to first access the Types window by clicking the Types icon as shown in Figure 2 or I can simply hit (CTRL+T).<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb1.png\" width=\"117\" height=\"105\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 2<\/strong><\/p>\n<p>Your screen should now look similar to that shown in Figure 3.<\/p>\n<p><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb2.png\" width=\"372\" height=\"334\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 3<\/strong><\/p>\n<p>Now under the Type Palettes tree, highlight the MyTypes.ini and notice the ability on the right to create custom Step Types and Date Types.&nbsp; For this post, all I am going to worry about is the Step Types.&nbsp; So next, where it says &lt;Right click to insert Type&gt;, I am going to do just that and select \u2018Insert Step Type\u2019.&nbsp; Next, we need to name our new Step Type and for this example I will call it something crazy original like \u2018CustomSequenceCall\u2019.&nbsp; Note that the name cannot have any spaces or start with a number.&nbsp; Unfortunately, we aren\u2019t done yet as there is still a little configuration left to go.<\/p>\n<p>Once we have inserted a new Step Type we now need to configure it such that it will have the behavior we expect it to.&nbsp; In order to do this, we need to right-click on \u2018CustomSequenceCall\u2019 and select Properties to pull up the Properties window as shown in Figure 4 below.<\/p>\n<p><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb3.png\" width=\"364\" height=\"464\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 4<\/strong><\/p>\n<p align=\"left\">At first glance, this dialog can be a little overwhelming but remember that the power of TestStand is the configurability and be rest assured that the majority of these options will be rarely used as you will see whenever we configure this step. <\/p>\n<p align=\"left\"><strong><em>General Tab<\/em><\/strong><\/p>\n<p align=\"left\">So on the General tab, we are first presented with the ability to select an Icon.&nbsp; Clicking on the \u2018Designate an Icon\u2019 checkbox will allow you to select from the combo box one of several options of Icons that TestStand comes with.&nbsp; Note however that a lot of Icons already have a specialized meaning in TestStand and that sometimes it might be better to create your own.&nbsp; If that is the case, the Icon files can be located in your Program Files&gt;&gt;National Instruments&gt;&gt;TestStand Ver##&gt;&gt;Components&gt;&gt;Icons folder.&nbsp; Once you have an Icon selected, next we are given the ability to define the \u2018Default Step Name Expression\u2019.&nbsp; This field accepts a String value representing what you want the Step Name to default to whenever you insert it into a sequence.&nbsp; I\u2019ll demonstrate with images a little later, but for now note I am going to type in \u201cNew Sequence Call\u201d.&nbsp; <\/p>\n<p align=\"left\">The next field is called \u2018Step Description Expression\u2019.&nbsp; This field accepts a String value representing the text you want displayed under the description column in the Sequence Editor.&nbsp; Once again, it is easier for me to demonstrate with images a little later, but for now I will enter the string \u201cMy New Step\u201d.&nbsp; Normally all of these fields would be named something similar, but for this example I want to differentiate between them so you can see exactly where each is used.&nbsp; <\/p>\n<p align=\"left\">Finally, we have the ability to \u2018Designate an Adapter\u2019.&nbsp; If nothing is selected here, the developer has the ability to select any adapter during script development.&nbsp; For our example, I want to restrict the user to only be able to use the Sequence adapter.&nbsp; My final configuration for the General tab can be seen in Figure 5 below.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb4.png\" width=\"356\" height=\"454\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 5<\/strong><\/p>\n<p align=\"left\"><strong><em><\/em><\/strong>&nbsp;<strong><em>Menu Tab<\/em><\/strong><\/p>\n<p align=\"left\">Once we have the General tab configured we now need to jump to the Menu tab to create an \u2018Item Name Expression\u2019.&nbsp; This field accepts a String value representing the text you want displayed whenever you right-click on the Sequence Editor and select a Step to insert into your sequence.&nbsp; For our example I will create another unique String called \u2018Custom Sequence Call\u2019.&nbsp; Our Menu tab should now be configured like that shown in Figure 6 below.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb5.png\" width=\"370\" height=\"471\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 6<\/strong><\/p>\n<p align=\"left\"><em><strong>Default Expressions Tab<\/strong><\/em><\/p>\n<p align=\"left\">The final tab I want you to take a look at is the Default Expressions tab as shown in Figure 7 below.&nbsp; Nothing needs to be changed here, however this is the major difference between the default Sequence Call Step Type as shown in Figure 1 and our new Custom Step.&nbsp; Now whenever we insert our new step it will no longer override the Step.Result.Status to \u2018Passed\u2019.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb6.png\" width=\"407\" height=\"516\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 7<\/strong><\/p>\n<p align=\"left\">We now have our Step Type fully configured and are ready to use it to create sequences.&nbsp; Click \u2018OK\u2019 to exit out of the Properties window and go to the Sequence Editor.&nbsp; Now right-click to insert your new Step and notice that your new step should be selectable on the menu with the \u2018Item Name Expression\u2019 text you defined under the Menu tab as well as the Icon you selected under the General tab as shown in Figure 8.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image14_thumb.png\" width=\"423\" height=\"444\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 8<\/strong><\/p>\n<p align=\"left\">So next lets go ahead and select our Step Type to insert it into our script.&nbsp; The first thing that should stick out is that the Step immediately gets named what we defined in the \u2018Default Step Name Expression\u2019 and the description for the Step gets set to what we defined in the \u2018Step Description Expression\u2019 under the General tab.&nbsp; This is demonstrated below in Figure 9.&nbsp; Figure 10 shows that under the Step Properties-&gt;General option, the Type is set to CustomSequenceCall and the Adapter is set to Sequence.&nbsp; Now you should be able to see the direct correlation of all the properties we configured and where they get used.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb8.png\" width=\"364\" height=\"140\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 9<\/strong><\/p>\n<p align=\"left\">&nbsp;<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb9.png\" width=\"244\" height=\"199\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 10<\/strong><\/p>\n<p align=\"left\">Finally I created a really quick script that executes my step and shows the Step.Result.Status upon successful completion.&nbsp; The results are shown in Figure 11 and as you can see my new Custom Sequence Call now returns a Status of \u2018Done\u2019.&nbsp; Yay!<\/p>\n<p align=\"left\">&nbsp;<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image26.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image26_thumb.png\" width=\"500\" height=\"130\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 11<\/strong><\/p>\n<p align=\"left\"><em><strong>Deployment<\/strong><\/em><\/p>\n<p align=\"left\">Now say you are super stoked about your new Custom Step and want to make sure all your Test Racks come equipped with it.&nbsp; Under the Type Palettes window, you have the option of saving your changes.&nbsp; You should notice an asterisk \u2018*\u2019 next to MyTypes.ini.&nbsp; If you decide to save your changes, TestStand will update the corresponding MyTypes.ini file.&nbsp; This file is located in the Users&gt;&gt;Public&gt;&gt;Public Documents&gt;&gt;National Instruments&gt;&gt;TestStand Ver###&gt;&gt;Components&gt;&gt;TypePalettes.&nbsp; You can simply take a copy of the modified .ini file and copy it into the appropriate location on your other Test Racks.<\/p>\n<p align=\"left\">Secondly, if you are having trouble coming up with proper names for the different String fields under the Custom Step Types Properties dialog.&nbsp; Navigating to the NI_Types.ini directory and viewing a similar Step Type configuration is always a good idea.&nbsp; For example, in our case, since we essentially wanted to modify the pre-existing Sequence Call Step Type, we could have configured our Step to look like the regular Sequence Call Step Type shown in Figure 12 below.<\/p>\n<p align=\"left\"><a href=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/mainlinetest.com\/wp-content\/uploads\/2012\/04\/image_thumb11.png\" width=\"419\" height=\"535\"><\/a><\/p>\n<p align=\"center\"><strong>Figure 12<\/strong><\/p>\n<p align=\"left\">In conclusion, Custom Steps are another powerful tool that TestStand has to offer.&nbsp;&nbsp; They offer a unique way to make both major and minor modifications to the predefined suite of Steps that NI has to offer.&nbsp; You should now feel comfortable getting started with creating Custom Steps and don\u2019t hesitate to contact your nearest NI Field Service Rep or Alliance Partner (hint hint) if you ever need some extra help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous blog post called &#8216;Sequence Call Step Type vs. Sequence Adapter&#8217; I showed how one can couple the Action Step Type with the Sequence Call Adapter to create a Sequence Call Step that does NOT return a \u2018Passed\u2019 status upon completion.&nbsp; Feel free to to read my previous blog post if you are&nbsp;<a href=\"https:\/\/mainlinetest.com\/?p=1043\" class=\"read-more\">Continue Reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":741,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[40,42,24,32,41,23,43],"class_list":["post-1043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-custom-step","tag-mytypes-ini","tag-national-instruments","tag-sequence-call","tag-step-result-status","tag-teststand","tag-type-palettes","cat-1-id"],"_links":{"self":[{"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/posts\/1043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1043"}],"version-history":[{"count":3,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/posts\/1043\/revisions"}],"predecessor-version":[{"id":1051,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/posts\/1043\/revisions\/1051"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=\/wp\/v2\/media\/741"}],"wp:attachment":[{"href":"https:\/\/mainlinetest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mainlinetest.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}