Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What exactly are you trying to accomplish?

If you are testing a single microservice and don’t want to test the dependent microservice - if you are trying to do a unit test and not an integration test, you are going to run against mock services.

If you are testing a monolith you are going to create separate test assemblies/modules that call your subject under test with mock dependencies.

They are both going to be part of your CI process then and either way you aren’t going to publish the artifacts until the tests pass.

Your deployment pipeline either way would be some type of deployment pipeline with some combination of manual and automated approvals with the same artifacts.

The whole discussion about which is easier is moot.

Edit: I just realized why this conversation is going sideways. Your initial assumptions were incorrect.

you may want to test only A: with monolithic architecture you'll have to produce another build of the application, that contains mock of B (or you need something like OSGi for runtime module discovery).

That’s not how modern testing is done.

https://www.developerhandbook.com/unit-testing/writing-unit-...



> What exactly are you trying to accomplish? Good test must verify the contract on the system boundaries: in case of the API, it's verification done by calling the API. We are discussing two options here: integrated application, hosting multiple APIs, and microservice architecture. Verification on the system boundaries means running the app, not running a unit test (unit tests are good, but serve different purpose). Feature flags make it only worse, because testing with them covers only non-production branches of your code.

> Your initial assumptions were incorrect. With nearly 20 years of engineering and management experience, I know very well how modern testing is done. :)


Verification on the system boundaries means running the app, not running a unit test

What is an app at the system boundaries if not a piece of code with dependencies?

If you have a microservice - FooService that calls BarService. The "system boundary" you are trying to test is FooService using a fake BarService. I'm assuming that you're calling FooService via HTTP using a test runner like Newman and test results.

In a monolithic application you have class FooModule that depends on BarModule that implements IBarModule. In your production application you use create FooModule:

var x = FooModule(new BarModule)

y = x.Baz(5);

In your Unit tests, you create your FooModuleL

var x = FooModule(new FakeBarModule) actual= x.Baz(5) Assert.AreEqual(10,actual)

And run your tests with a runner like NUnit.

There is no functional difference.

Of course FooModule can be at whatever level of the stack you are trying to test - even the Controller.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: