jon lee
jon lee

Reputation: 887

Testing Mule/Integration projects

I am unit testing my Mule applications using munit and Mules FunctionalTestCase. I can successfully mock connectors such as Salesforce etc. so I am not relying on external systems.

But should I be creating end to end integration tests with no mocks? What is the best practice here?

Should I use a standard Salesforce library to create records ready for my tests and run them without mocks?

Or is it ok to run these always with mocks?

Upvotes: 0

Views: 153

Answers (2)

Fefe
Fefe

Reputation: 91

Having integration tests with your external systems is a good practice if you want to test cases where that external system changed the behaviour. The problem with integration tests is that they are no isolated. For example, someone from Argentina can run your test at the same time as you so your test will be affected as the external system is being stimulated at the same time. If you want to test your app then unit tests is fine, and if those tests are in a continuous integration system then only unit test. Integration test are very useful but have to be run by a single user in a controlled scenario.

Upvotes: 1

Adarsh Shah
Adarsh Shah

Reputation: 6775

You should have some integration tests but they should be just to make sure whether you can connect successfully to external systems & you get back a valid value etc. You don't need to test the business logic in your method after you get back the value from the external system as you will do that using mocking. You should also categorize your tests (unit tests and integration tests) so that you can run them individually as well.

Upvotes: 1

Related Questions