Testing with the Message Shape

Document created by thanh_n88 Employee on Feb 6, 2018Last modified by thanh_n88 Employee on Jun 25, 2018
Version 13Show Document
  • View in full screen mode

Often it is easier to test with data that is already present than have to go through the connectors to grab data. This is practical for a variety of reasons:

  • Data is deleted or modified after it is picked up
  • Testing specific scenarios require the source connector to have that data which might take a bit more work and time
  • Quicker to test when you can modify data on the fly
  • Connecting to different sets of data requires changing connector information
  • For data coming from local on-premise sources like Disk and Databases, you do not need the specific local atom anymore once you have a copy of the data in the message shape

 

To test in the Boomi platform, the message shape can be used and you can place the content directly into the message field and link it to the next shape like a map or connector. Having multiple message shapes labelled clearly and already linked to the rest of the process makes swapping data easier. This way, you only need to link the No Data start shape to the message shape you want to test. 

 

Note: the message shape will replace documents if it is placed where documents are going to. For example, if you use the FTP connector to get a file and put a message shape after the FTP connector, the file from the FTP connector will be replaced by whatever content is in the message shape

 

Related Articles

Here are additional links to testing related articles and concepts:

 

Scenarios on How to Test with the Message Shape

Scenario 1 - Testing with XML

 

For XML, you can copy directly into the message shape. You do not need the tabs or extra spaces, the message shape will still accept it. You still have to follow the usual rules for XML like escaping special characters appropriately (see table below). For example:

<?xml version="1.0" encoding="UTF-8"?>

<Component>
   <Id>eec1a6e6-93a4-43e9-a83b-3bd67bfe7443</Id>
    <Type>webservice</Type>
   <Name>Calculator</Name>
   <Object>
      <webservice urlPath="toast&amp;eggs"> (XML will be interpreted as toast&egg)
         <restApi>
            <route processId="a4519fef-2e10-47b5-ac95-496c7ac6922c">
               <overrides outputType="" inputType="" httpMethod="POST" objectName="addition2" urlPath="" />
            </route>
         </restApi>

      </webservice>
   </Object>

</Component>

Special characterescaped formgets replaced by
Ampersand&amp;&
Less-than&lt;<
Greater-than&gt;>
Quotes&quot;"
Apostrophe&apos;'

 

Note: You have to use double quotes (") in the top line, <?xml version="1.0" encoding="UTF-8"?>, the message shape will not take single quotes in XML

 

Scenario 2 - Testing with JSON

For JSON, you need to wrap the whole profile in single quotes:

'{
   "list": [
      {
         "id": "A",
         "value": "A"
      },
      {
         "id": "B",
         "value": "B"
      },
      {
         "id": "C",
         "value": "C"
      }
   ]
}'

Scenario 3 - Testing with Database

For a database (DB) profile, you need to match the component ID of the Database Profile to the component ID present in the data (in bold), after the "DBSTART". If you copy a process for testing or development, your profiles will be copied and they will have a new component ID. Just replace the component ID in the DB data and the map should be able to pick it up now. Let's say in process A my DB profile had a component ID of gy96db7f-5a6d-4agd-8509-j5ah7b3f7058, now that I've copied it to process B, the DB profile gets a component ID of ae83db7f-0a6d-4aed-8509-7FaF7b3f7058, to use the same data from the process A in B without having to go through the connector,

Process A:

DBSTART|gy96db7f-5a6d-4agd-8509-j5ah7b3f7058|2|@|BEGIN|2|@|OUT_START|3|@|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-7|^|705057|^|FL_RG|^|2|^||^|A7|#|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-2|^|705057|^|FL_RG|^|2|^||^|A7|#|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-3|^|705057|^|FL_RG|^|2|^||^|A7|#||#|OUT_END|3|@|END|2|@|DBEND|gy96db7f-5a6d-4agd-8509-j5ah7b3f7058|2|@|

 

Process B:

DBSTART|ae83db7f-0a6d-4aed-8509-7FaF7b3f7058|2|@|BEGIN|2|@|OUT_START|3|@|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-7|^|705057|^|FL_RG|^|2|^||^|A7|#|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-2|^|705057|^|FL_RG|^|2|^||^|A7|#|2078-07-77 75:49:00.0|^|20780777|^|A76593P7778BWB026|^|A76593P7778BWB026|^|04|^|ZZ|^|Z|^|WH|^|FongebeF - Falgary|^|97|^|2580|^|IL|^|7500070490|^|07|^|20780777|^|RG|^|2|^|FA|^|006736243295|^|BN|^|6736243295|^|7778BWB026|^||^|ReFeption|^|76593|^|20780777|^||^|705057-3|^|705057|^|FL_RG|^|2|^||^|A7|#||#|OUT_END|3|@|END|2|@|DBEND|ae83db7f-0a6d-4aed-8509-7FaF7b3f7058|2|@|

If you forget to change the component ID in the message shape and it's going into a map, the data will not be recognized. You will get a "No data produced from map, please check source profile and make sure it matches the source data" error. 

 

Note: |^| denotes column separation and |#| denote row separation

 

Scenario 4 - Testing with EDI/Flat File

You can copy an EDI and Flat File profile as is directly into the message shape without any modifications.

 

Common Errors

Error: Unable to create XML files from data, the document may not be well-formed xml ; Caused by: Unexpected character '1'

You most likely have <?xml version='1.0' encoding='UTF-8'?> or a single quote somewhere. You need to use double quotes instead. Full error: "Unable to create XML files from data, the document may not be well-formed xml ; Caused by: Unexpected character '1' (code 49); expected a quote character enclosing value for 'version' at [row,col {unknown-source}]: [##,##]"

 

Error: can't parse argument number (when testing with JSON)

Your JSON profile in the message is missing the single quotes wrap around the whole profile.

 

FAQ

How do I simulate multiple records?

For flat files, a new line denotes a new record (or set of information) so it is easy to simulate by adding in multiple lines for the flat file. Same goes for the database, each row automatically gets treated as separate record by default when going through something like the map shape.

 

However, for EDI, XML and JSON, you cannot just add another profile one after the other and expect the map shape to separate them automatically. At this point you cannot use the message shape for that purpose. You can simulate multiple records by using the disk connector to pick up all of your EDI, XML, and JSON files at some location. 

 

Can I troubleshoot production data errors this way?

If you have production errors and want to know if the data is causing the issue or at what point the data is causing the issue, you can pull that data from process reporting and then put it in a message shape also. Make a copy of your process, put in the message shape with the production data (using above mentioned scenarios), and remove any CREATE/SEND endpoints (to avoid changing anything). Run the data through the process in test mode and you will have more visibility with how the data is being transformed. Use stop shapes so you can see what data is coming out of a shape. 

 

Why is the source data from the message shape missing single quotes?

The message shape treats single quotes as special characters. To use single quotes as values in your message shape, they must be escaped via another single quote. 

In Message shape:                                                                                        Output when running process:

testing to 'see if the single quotes appear'                                                     testing to see if the single quotes appear

testing to ''see if the single quotes appear'' (pair of single quotes)               testing to 'see if the single quotes appear'  

 

Why are my variables in the message shape not populating?

If the data coming out of the message shape is still showing the curly brackets and number (i.e. {1}, {2}, etc) that usually means you have a single quote somewhere. You need to escape it. Where you escape it matters.

In Message shape, {1} is set to static value of "nice" :                                  Output when running process:

Today's weather is {1}                                                                                    Todays weather is {1}

Today's weather is '{1}                                                                                   Todays weather is nice

Today''s weather is {1} (pair of single quotes)                                               Today's weather is nice

 

Why is the message shape showing unable to parse error?

Make sure everything looks right and you are following the standard rules for each format. You can use a syntax checker online. Sometimes the message doesn't parse data correctly even if it is in the correct profile format because of its own internal parsing rules. Easiest way to get around this (after you are sure the syntax is correct) is to use the variables. Use {1} and set {1} to have a Type of static and set the Static Value as the profile, you can just copy/paste the whole profile into the static field. 

 

How to handle apostrophes (') in the message shape?

You can escape the apostrophe according to the above methods or use a disk connector to retrieve the file instead.

 

Special Thanks

Pete McCoy for FAQ contribution, Why is the source data from the message shape missing single quotes?

Sheng Liao and Ruchika Yadav for FAQ contribution, Why are my variables in the message shape not populating?

Sheng Liao for FAQ contribution, How to Handle Apostrophes (') In Message Shape?

8 people found this helpful

Attachments

    Outcomes