Unit Testing Best Practice - A Discussion

Discussion created by mplatt168095 on Dec 6, 2017
Latest reply on Feb 22, 2018 by mplatt168095

I'm new to Boomi, but have plenty of experience in software development, and integration.


I'm trying to get my head around what is best practice, and more precisely what would be a sensible approach to testing.


So - I'm starting with a unit test.  I started with some of the developer 1 examples - Prospect Tracking first.  


Part of the logic to test includes a check to see if there are any existing records for a prospect with that given name (using a SQL query).  Obviously, for a unit test, this won't work, as it's an integration test with the database, and requires data to exist, which is a brittle test as it may fail and the logic under test may actually be correct.


So, I'm wondering if there is anyone can think of a good design pattern to achieve this.  I put in an idea to allow connectors to have a test mode - meaning they could run with real connections, or be put into a test mode with a property, and then whatever data you supply will be used, and no writes will occur (similar to the test mode that exists, but in a test or possibly production environment)  This way, you could ensure that the latest version did not cause regression - and the test mode can operate on the processes that are deployed rather than having to copy back to the component explorer with the correct versions.  I digress....


Can anyone think of a pattern we could use to overcome this situation?  I mean, say the pattern calls for the process to load all data first, and pass it into a document in a master process, then the logic process is executed, then the process to persist / send the data is called.  If nobody can, then we really need to have the connectors run in a test mode - like a mock or stub for the real thing, and be able to do it in place.


I believe with this piece of the puzzle Boomi would be an incredible piece of technology, able to do what nothing else has.


Any thoughts or ideas?