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,670 points
671 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,280 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
4,068 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
• 58,020 points
928 views
0 votes
1 answer
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,040 views
+1 vote
2 answers

AWS CloudWatch Logs in Docker

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

answered Sep 7, 2018 in AWS by bug_seeker
• 15,510 points
2,040 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,280 points
2,540 views
+1 vote
3 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP