Skip to main content

Posts

Best place to add code for taking Screenshots with Selenium and Java

  If your UI automation code takes screenshot on failure in test method or page method, then it’s not good. We should handle that using a listener Or have a base class containing AfterMethod annotation that captures screenshots on failure. Use lateral approach (i.e. base class with afterMethod) if you aren’t using listeners in your framework. Go through this well explained article by Alex Siminiuc for more details: https://levelup.gitconnected.com/the-good-the-bad-and-the-ugly-of-taking-screenshots-with-selenium-and-java-c9da23e09842

Making SOAP Requests with Postman

  Even after following what is mentioned here: https://learning.postman.com/docs/sending-requests/supported-api-frameworks/making-soap-requests/ i.e., set Content-Type = text/xml in the Headers and setting POST as a call, at times we get 500 internal server error or bad request with the message like " error message: The message with Action '' cannot be processed at the receiver... " So, what are we missing here? Setting SOAPAction in Headers is worth giving a try... How do we get that? 1. Open your WSDL in a browser with the service URL appended by “?WSDL" and find soapAction for which you want to execute your SOAP call. Like for the "Add" method in http://www.dneonline.com/calculator.asmx?WSDL , soapAction should be set to http://tempuri.org/Add 2. Copy the value of soapAction attribute of your SOAP method. Add a new key, provide Key as “SOAPAction” and the value that you copied in the above step i.e., http://tempuri.org/Add 3. Set “Content-Type” hea

AWS Signature with RestAssured

  AWS Signature authentication support is not something that is available in RestAssured as out-of-box feature. At least I wasn't able to find any good documentation for the same. So, how we can implement AWS Signature Headers with Rest Assured? Signing AWS requests with Signature Version 4... This explains step by step how to create a signature and add it to an HTTP request to AWS: https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html Below given source code (AWSV4Auth.java) helps to calculate signature based on given data and return the headers. Once you get headers suing aWSV4Auth.getHeaders(), you just need to add these headers in your Rest API call (Sample for the same is given below: RATest.java) AWSV4Auth.java: public class AWSV4Auth {     private AWSV4Auth() {     }     public static class Builder {         private String accessKeyID;         private String secretAccessKey;         private String regionName;         private String serviceName;         private Str

Pickles- Living doc generator of your Gherkin feature files

  You have a set of BDD feature files written in the Gherkin language but your stakeholders doesn’t really like the text-only format? Plus they don’t want to open each feature file by one by one to go through it? Start using Pickles, it generates a document containing all features in a single documentation in just one step and it’s an opensource too. Pickles has a lot of other ways and parameters, do checkout more details here:  http://docs.picklesdoc.com/en/latest/,   https://github.com/picklesdoc/pickles  and  https://www.picklesdoc.com/# P.S. It can generate your documentation in a variety of formats like JSON, Excel, Word, etc. and not only HTML. #pickles #gherkin #bddAutomation

Monitor your APIs in postman

If you are not using any CI/CD tool like Jenkins, Azure DevOps, etc. but still want to schedule your postman automation collection suite to check the health and performance of your APIs; then you can use Monitor option provided by Postman.   You can also enable email notifications for failures and can configure the available integrations to receive alerts in tools like Slack, PagerDuty, etc. Check here for more details: https://learning.postman.com/docs/designing-and-developing-your-api/monitoring-your-api/setting-up-monitor and https://www.postman.com/pricing/   Note* With the FREE plan, we get only 1000 hits/requests per month as of writing this post.   You can monitor the performance on your account web dashboard as shown below.

Steps to execute postman collection through newman

  Here is what you need to do to start executing the postman collection through newman on your system: 1. Install NodeJS – https://nodejs.org/en/download . Click on the 32-bit or 64-bit Windows Installer package, depending on your machine configuration. Skip this if NodeJS/npm is already installed on your system. 2. Open a command prompt, and type “node -v” and "npm -v". These commands should work and provide version number if nodeJS installation is successful. 3. Run this command to install newman:   npm install -g newman 4. Install npm package newman-reporter-htmlextra for creating reports.   npm install -g newman-reporter-htmlextra 5. Pull/Export the collection, environment json (if any), test data csv (if any) files from the Postman UI or code repo (git) to your local and run this command through the folder on your local where you have these files: Command where you have collection json and environment json file : newman run "<<your_collectio

Tips and tricks for automation using Postman/Newman

   1. How do we run multiple newman/postman collections sequentially (back to back) at one run ? Batch running multiple newman/postman test collections : Create a batch file like this and run: call newman run Collection1.postman_collection.json -e qa1.postman_environment.json -r htmlextra --reporters cli,junit,htmlextra --reporter-htmlextra-export TestReport1.html -d TestData1.csv call newman run Collection2.postman_collection1.json -e qa2.postman_environment1.json -r htmlextra --reporters cli,junit,htmlextra --reporter-htmlextra-export TestReport2.html -d TestData2.csv   Side note : Give a shot to https://medium.com/@mnu/run-multiple-postman-collection-in-parallel-stress-ee20801922ed in case you would like to run it in parallel (P.S. haven’t tried this yet)   2. How can we set environment variable based on another environment variable value ? Like for QA1, we need accountNo say "123" but for QA2, we need accountNo say "345", etc.   pm.test(&q