Comments (20)
Four people +1'ing within 10 minutes of each other only counts as one vote.
from lagom.
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.
No schedule for the support in the API? 🤔
from lagom.
Please! Is it good form to write +1?
from lagom.
Looks like this issue has been dormant for a while - is there a plan for integration tests?
from lagom.
+1!
from lagom.
+1
from lagom.
+1
from lagom.
+1
from lagom.
+1
from lagom.
+1
from lagom.
+1
from lagom.
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-java
sample 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.
@ignasi35 Ah. That's interesting. Haven't hit that yet as not currently using Kafka (although that's expected to change).
from lagom.
+1
from lagom.
Do you know the ETA?
from lagom.
How do you mock a service and the service locator in tests? Is there any example?
from lagom.
Discussing in https://discuss.lightbend.com/t/mocking-services-in-a-test/1189/4
from lagom.
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.
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)
- lagom-nightly-deploy-master failed HOT 6
- JDK16 compatibility issues HOT 5
- Support sbt 1.4 virtual files when displaying error source
- `mapFuture` with `ec.prepare()`
- Lagom 1.6.5 has conflicting transitive dependencies on other lightbend projects HOT 2
- how to compile lagom service in scala3 HOT 1
- Circuit breaker panel memory leak (?)
- Compilation failed - breakCompilation
- CI fails on master - NoClassDefFoundError: sjsonnew/BasicJsonProtocol HOT 1
- How can I run Lagom service in Prod Mode? HOT 2
- readside and readside offset produce duplicate entry error HOT 1
- [epic] reduce repository maintenance cost HOT 2
- Upgrade to log4j2 2.17 per Apache Log4j vulnerability guidance and security. HOT 2
- Lagom runAll failing because of semver check HOT 1
- Lagom bom-pom includes transitive dependencies HOT 1
- Make it easier to independently init SlickProvider HOT 1
- `atLeastOnce` Kafka Consumer not restarting on error
- At-most-once for Read Side Processor HOT 1
- Kafka client upgrade
- Reviving Lagom in the context of Pekko, Play 3.0, Scala 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lagom.