Coder Social home page Coder Social logo

Comments (20)

jroper avatar jroper commented on May 22, 2024 5

Four people +1'ing within 10 minutes of each other only counts as one vote.

from lagom.

TimPigden avatar TimPigden commented on May 22, 2024 1

For those people who have +'d it recently. I would point out that for me this requirement has largely disappeared. The reason being that I routinely and completely mock every service with an in-memory map or maps to emulate the persistence and simple scala collection processing to emulate the repository actions. I then subject the mock service to all the testing that the full service gets within the sub-project. Finally any cross-service testing can use either an entire set of mocks or the service under test as a service plus the others all as mocks. This works fine so long as your services are effectively only communicating via their path apis. It won't work though if you're using Kafka. But if you're not it's definitely worth consideration as you can test all sorts of complex things and run tests in a couple of seconds that take far longer when having to instantiate real services.

from lagom.

sallareznov avatar sallareznov commented on May 22, 2024

No schedule for the support in the API? 🤔

from lagom.

TimPigden avatar TimPigden commented on May 22, 2024

Please! Is it good form to write +1?

from lagom.

emarx avatar emarx commented on May 22, 2024

Looks like this issue has been dormant for a while - is there a plan for integration tests?

from lagom.

odwrotnie avatar odwrotnie commented on May 22, 2024

+1!

from lagom.

deepakmehra10 avatar deepakmehra10 commented on May 22, 2024

+1

from lagom.

aklikic avatar aklikic commented on May 22, 2024

+1

from lagom.

phil9987 avatar phil9987 commented on May 22, 2024

+1

from lagom.

luq555 avatar luq555 commented on May 22, 2024

+1

from lagom.

AdamJanasek avatar AdamJanasek commented on May 22, 2024

+1

from lagom.

Rath-san avatar Rath-san commented on May 22, 2024

+1

from lagom.

ignasi35 avatar ignasi35 commented on May 22, 2024

It won't work though if you're using Kafka.

That's an interesting scenario. @TimPigden have you tried using Broker Testing tools provided in Lagom to expand your mocks?

I am assuming there's a ServiceA under test that has a mocked ServiceB. ServiceA publishes messages to topicA and ServiceB publishes on topicB. Finally, both ServiceA and ServiceB subscribe to each other's topics.
(This is not too different from ItemService and BidService in online-auction-javasample app)
Then, when testing ServiceA you may be able to expect a message being published on topicA and, as a consequence, send a mocked response via topicB. Finally, you can eventually assert that ServiceA received and processed the message on topicB.

from lagom.

TimPigden avatar TimPigden commented on May 22, 2024

@ignasi35 Ah. That's interesting. Haven't hit that yet as not currently using Kafka (although that's expected to change).

from lagom.

nserfontein avatar nserfontein commented on May 22, 2024

+1

from lagom.

odwrotnie avatar odwrotnie commented on May 22, 2024

Do you know the ETA?

from lagom.

odwrotnie avatar odwrotnie commented on May 22, 2024

How do you mock a service and the service locator in tests? Is there any example?

from lagom.

TimMoore avatar TimMoore commented on May 22, 2024

Discussing in https://discuss.lightbend.com/t/mocking-services-in-a-test/1189/4

from lagom.

gabizou avatar gabizou commented on May 22, 2024

Starting to write my own integration tests and running into this limitation after trying to find out why they weren't running 👀.
I can understand this is all backlogged (I've my own gripes about Maven and the plugin, considering taking up the time to try and wrangle a Gradle variant). Short of writing a bunch of scripts to test after launching, I'd hope to see some better integration testing for CI management.

from lagom.

solarmosaic-kflorence avatar solarmosaic-kflorence commented on May 22, 2024

We use https://github.com/testcontainers/testcontainers-scala for this purpose. There are several ways you could stand up a replacement for the service under test -- you could start up a mock service based on an OpenAPI spec for example. Since we use Pact, we stand up a stub service containing stubs for all service dependencies prior to the tests running and it works quite well.

from lagom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.