Best practices for Integration Tests on a Java Client application
See original GitHub issueI am looking for some suggestion about creating integration (unit) tests for a client application written in Java.
Ideally I would like to start an in memory Standalone Pravega service.
try (PravegaStandaloneForTests server = bootPravegaStandaloneForTests() {
String connectionString = server.getConnectionString();
run application that writes/reads to Pravega....
}
Context: We are going to implement an integration between Pravega and EmailSuccess.com, EmailSuccess.com will be a source of data, it will write a stream of events to Pravega. We want to create integration tests with JUnit.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
6 best practices for integration testing with continuous ...
1. Do integration testing before unit testing · 2. Don't test business logic with integration testing · 3. Know why integration testing is...
Read more >Modern Best Practices for Testing in Java - Philipp Hauer's Blog
This post contains many best practices that I collected over the years of writing unit tests and integration tests in Java.
Read more >Test a REST API with Java - Baeldung
In this tutorial, we'll focus on the basic principles and mechanics of testing a REST API with live Integration Tests (with a JSON...
Read more >Build with Confidence: A Guide to JUnit Tests - Toptal
We will focus on writing unit and integration testing for a web app written in Java's Spring framework. Most of the time, we...
Read more >Integration Testing Tools and Practices to Start Using Today
Best Practices of Integration Testing · Determine test data correctly. · Prepare test data in parallel with writing test cases or at least...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ravisharda this is my working test
https://github.com/eolivelli/pravega-testing/blob/master/src/test/java/PravegaIntegrationTest.java
This is the minimal set of dependencies: https://github.com/eolivelli/pravega-testing/blob/master/pom.xml
Issues:
I didn’t have to add pravega-shared-authplugin, maybe it is automatically imported by the java client, that you need in order to make any meaningfull test
Regarding the ‘start’ method I can raise a PR. Regarding the dependencies I prefer that someone expert of the release process would do it. It would be very good to have some integration tests that create a simple project like the one on my github. Something that is “far” from Pravega codebase and this way we are sure that it is not affected by transitive dependencies injected by parent modules
@eolivelli
A second dependency in addition to the one you mention will be needed. Both of these are required:
io.pravega:pravega-standalone:0.7.0
io.pravega:pravega-shared-authplugin:0.7.0
(That using Pravega standalone requires the second one, is a bug. Previously, the first one was sufficient. I’ve created issue 4795 for this.)
Yes, that’s an issue. We should make it public so that people can use the
LocalPravegaEmulator
. Would you consider raising a pull request for it?In the meantime, you can use the
InProcPravegaCluster
that theLocalPravegaEmulator
uses internally. Something like this:cc @derekm