简体   繁体   中英

how to unit test aws lambda with SQS Event

I am implementing a AWS Lambda that gets triggered from SQS, and then do some other thing. This is my current Handler:

how I can pass a fake SQSEvent to test my function?

public class Handler implements RequestHandler<SQSEvent, Void> {
    @Override
    public Void handleRequest(SQSEvent sqsEvent, Context context) {
        helper(sqsEvent.record);

        return null;
    }
}

The aws-lambda-java-tests helps to simplify java lambda testing. Please refer here for details.

For sample code, refer Testing AWS Lambda functions written in Java blog.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM