I have been trying to automate a test scenario wherein I need to fetch a JSON file from S3 bucket, read it and then apply my logic. Please note I am using JavaScript with Karate.
Since I am fairly new to test automation I have been doing some research online about this. So far I have got the Maven Artifact aws-java-sdk-s3
that I am trying to use.
I put this dependency in the pom.xml file.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.953</version>
</dependency>
How do I use this artifact to fetch a file from the S3?
Meanwhile, I am trying to fetch a particular file using the S3 URL as follows:
@sampleTest
Scenario: Get Call Test
Given url 'http://test-bucket.s3.amazonaws.com/'
When method Get
Then status 200
This is currently giving me 403 status because the bucket is not public.
How do I add the S3key and S3secret to the URL? Also, how to fetch the particular file given I know the location (JSONPathURL)? Can someone who is familiar with this tool help me?