How to test code written against AWS API

0 votes
Please help me out in this:

As I'm writing an application in Java that uploads a file to AWS S3.
The file is given to the application into an argument, not hardcoded.

I wish to write tests, so as to ensure that the file is actually getting uploaded to my S3. The test gets written before the code for TDD. I myself have written the code already, but I want to ingrain TDD practices into all of my work to gain a habit.

I will be using JUnit as that's what I'm most familiar with. So, how precisely I can do this?
May 17, 2018 in AWS by Cloud gunner
• 4,280 points
38 views

1 answer to this question.

0 votes
The actual uploading and the tests that u are doing are a part of your integration testing, not the unit testing.

If you wrap the S3 API in a very thin class, you will mock that class for unit testing of your business classes, and you will use the real implementation for integration testing.

If you have decided, your business classes to take directly the AmazonS3 interface, then for unit testing you have to mock that one.

The actual exploratory testing (learning and verifying) if and how amazon s3 works is what you actually do in separate experimental setup.

BTW I do not recommend using the AmazonS3 interface directly in your business classes, rather, wrap it in a thin interface of yours, so that if you decide to change the 'back-end storage' you can easily change it.
answered May 17, 2018 by Flying geek
• 3,160 points

Related Questions In AWS

0 votes
1 answer

How to Enable CORS for an AWS API Gateway Resource

Since you're using Lambda Proxy integration for ...READ MORE

answered Jul 10, 2018 in AWS by Hammer
• 360 points
879 views
0 votes
1 answer
0 votes
1 answer

How to get AWS account/service cost using CloudWatch API?

You can check this link for a ...READ MORE

answered Jul 13, 2018 in AWS by Priyaj
• 57,300 points
158 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
261 views
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 6, 2018 in AWS by bug_seeker
• 15,360 points
427 views
+1 vote
2 answers

How to use jenkinsfile to get content from AWS SQS?

You can import standard AWS SDK to ...READ MORE

answered Jul 20, 2018 in AWS by Flying geek
• 3,160 points
280 views