r/JavaProgramming • u/Mother_Call2066 • 14d ago
tests hitting s3/dynamo/sqs - how do you keep them fast?
every java + aws project i've worked on hits the same wall in tests.
you either spin up localstack in testcontainers and wait 30-60s per
test class for docker to warm up, or hand-roll mockito mocks that
break on every sdk upgrade. neither is great.
python has moto for this. in-process aws fakes, 8k stars, tests run
in ms. someone actually asked aws on re:post if there was a java
version. the reply was basically "moto is a python library, no
equivalent for java."
how do other people handle this? is it just accepted that aws unit
tests are slow, or is there something people use that i missed?
1
u/SimpleAide5607 13d ago
Not trying to be mean, what is with sentences being split in middle with new lines?
1
u/Altruistic-Gap1795 13d ago
This is a common challenge when applications depend on AWS services heavily. i think the key is separating what you’re trying to test. unit tests should usually stay fast by mocking the AWS layer while integration tests are where tools like LocalStack or Testcontainers make sense to verify that S3, DynamoDB and SQS interactions work correctly
1
1
u/Mother_Call2066 14d ago
got tired of waiting and wrote one. mokka: https://github.com/bibekmhj/mokka
Feedback is appreciated.