Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
AdamR_AYX
Alteryx Alumni (Retired)
The latest release of the CReW macro pack is available for download now at
 
 
NOTE: You will require Alteryx 10.0 or later to use this macro pack.
 
For installation instructions see this page
 
NOTE: Check out this Knowledge Base article for Support policies and fixed/ known issues.


WHAT'S NEW?

 

New Macros

 

Wait A Second - This month I am very excited to be able to introduce another new contributor to the CReW macro pack: Daniel Brun.  Who as well as contributing this macro here has also released his own macro pack "The Inviso macro pack for Alteryx" available for download here.
 
The Wait A Second macro is a different spin on the throttle tool which allows a user to specify a wait time between records passing through the tool.
 
 

Blocking Test Tool - This macro came directly from a client request and is actually something which I have seen asked for many times before.  It is very useful when updating an external data source and you want to check some condition before you write *any* data out.  It checks all of the data against the given expression and only if all of the records pass that expression does it then pass its records downstream.  If any record fails the expression then an error message is thrown and no records are output.
 
 
The Test Macros
 
These are four new macros which were born out of a series of blog posts I wrote back in 2015 about trying test-driven development for Alteryx macros.  That experiment actually hit some stumbling blocks which I am yet to write up about, but the macros that were born out of it live on and are very useful for testing in a TDD style or otherwise.
 
I am releasing them in this release with a BETA flag as they are still very much a work in progress and I know I still have some work to do on them.  However, I believe they are in good enough condition to get some other people looking at them and feeding back any issues and improvements they might find.
 
They are under their own tool category "CReW Test" which you can hide for now if you want to wait for them to evolve some more.
 
They are:



Test Runner - This is the macro that runs all of your tests.  You generally have a workflow containing only this macro.  Running that workflow will run all of your tests.
 
 


Expect Equal - This macro takes two data streams (Expected and Actual) and throws a (hopefully useful) error message if they differ.
 
This is the macro where I know I have some work to do and where you as a community can help out.  I need any examples you can find where this tool isn't doing what you expect.  So data sets you think are equal, but it thinks are different and vice versa.

 
 


Expect Zero - This macro expects to receive zero records into it and if it doesn't, throws an error telling you.
  


Expect Error - This macro is for checking that workflows correctly error.  An essential part of testing.  If it is placed within a tool container then it expects a tool in that same tool container to throw the expected error message.  If the correct error message is not thrown then the Test Runner will mark that test as failed.
 
I intend a follow-up article on how to use the macros, but to get started quickly take a copy of the GettingStartedTemplate folder in TestMacros, rename it to something meaningful and run the contained RunTests.yxmd to run the sample tests.
 
You can also take a look at the CReW macro test suite which you can find in Samples\CReW Macros\Tests.  Again a work in progress, but the starting of what is to follow.
 
As always please let me know about any issues/feedback you have and hopefully see many of you at Inspire Europe in September!
 
(If you are not registered already, what are you waiting for? http://www.alteryx.com/inspire-europe-2016)
Adam Riley
-

Former account of @AdamR. Find me at https://community.alteryx.com/t5/user/viewprofilepage/user-id/120 and https://www.linkedin.com/in/adriley/

Former account of @AdamR. Find me at https://community.alteryx.com/t5/user/viewprofilepage/user-id/120 and https://www.linkedin.com/in/adriley/

Comments