Skip to main content

Posts

How to run your postman (Newman) automation collection in a Continuous Integration environment like Azure DevOps build Pipeline?

  How to run your postman (Newman) automation collection in a Continuous Integration environment like Azure DevOps build Pipeline? Postman Introduction: Postman is a tool that simplifies each step of building and testing APIs. If you've ever used it in your development or testing phase, you must already know what an incredible tool it is. It presents the possibility to automate your API tests and integrate them into your CI/CD pipeline to make certain that any code changes won’t introduce any new regression issues in upper environments like QA, Stage, Production, etc. Newman Introduction: Newman is a tool, using which one can effortlessly run and test Postman Collections directly from the command line. Azure DevOps CI/CD Introduction: Azure DevOps by Microsoft Azure is one of the leading tools that automate CI/CD's process. Using continuous integration and continuous deployment with Azure DevOps, these pipelines are used to construct build-deploy-test workflows used mainly in c

How to integrate TestNG Test Automation Results (Selenium/RestAssured/Appium) with TestRail?

  To integrate TestRail with any automation suite, we can use the TestRail APIs with the following basic flow: Create test cases in TestRail.   Provide those unique Test IDs from TestRail to your TestNG tests. Run automation: Create a test suite in TestRail before test execution using the TestRail API. And then post the run results according to test automation results using the TestRail API. Create test cases in TestRail:        2.  Creating a custom annotation and calling it as TestRails:      3.  After that, we associate our test cases with actual Test Rails ID’s like:     4.  These ids 1, 2, 3, and 4 are test case ID that we got from TestRail test cases, you can hover over your test case and see that ID in the URL (as shown below):     5. Create a Test Run in TestRail through code,  as you can look at that we have not created any Test Run manually (see below): Snapshot of TestRail before execution of automation suite: 6. Retrieve Test Case ID from Annotation: 7. Run the test cases a

Postman: Parse XML and response data value verification using the cheerio library

How to parse XML and validate the response fields using the cheerio library in postman? Sample URL :  https://www.w3schools.com/xml/tempconvert.asmx Sample Request Payload : <soap12:Envelope xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd=" http://www.w3.org/2001/XMLSchema " xmlns:soap12=" http://www.w3.org/2003/05/soap-envelope ">     <soap12:Body>         <FahrenheitToCelsius xmlns=" https://www.w3schools.com/xml/ ">             <Fahrenheit>108</Fahrenheit>         </FahrenheitToCelsius>     </soap12:Body> </soap12:Envelope> Expected Response : <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap=" http://www.w3.org/2003/05/soap-envelope " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd=" http://www.w3.org/2001/XMLSchema ">     <soap:Body>         <FahrenheitToCelsiusResponse xmln

Cucumber interchangeable keywords

  Did you know that following keywords are interchangeable in cucumber, but should be better use depending on the context of your flow? Feature | Ability | Business Need Scenario Outline | Scenario Template: Examples | Scenarios #bdd   #cucumber   #syntax   #keywords   #tips   #automation   #gherkin

NPM: peer dependency is not detected for global packages

  Issue : In npm, peer dependency is not detected for global packages like when you try to install "newman" and then install "newman-reporter-htmlextra" so that you can run Postman/Newman tests collection with htmlextra reporter, it keeps failing because no suitable Newman version is found: npm install -g newman npm install -g newman-reporter-htmlextra newman run "Publish.postman_collection.json" -e QAUS.postman_environment.json -r htmlextra --reporters cli,junit,htmlextra  --reporter-htmlextra-export TestReport.html You may get this error: "npm WARN newman-reporter-htmlextra@1.20.4 requires a peer of newman@^5.1.2 but none is installed. You must install peer dependencies yourself" Solution : Peer dependency and the required package should be installed together like:  npm install -g newman newman-reporter-htmlextra

Docker restart policy and how to start containers automatically

 Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts.  Note * If you use docker stop or docker kill, it is expected that Docker does not restart the container. In case of docker stop or docker kill, its restart policy is gong to be ignored until the Docker daemon restarts or the container is manually restarted.  Container restart policy : Container restart policy controls the restart actions when Container exits. Following are the supported restart options: no – This is default. Containers do not get restarted when they exit. on-failure – Containers restart only when there is a failure exit code. Any exit code other than 0 is treated as failure. unless-stopped – Containers restart as long as it was not manually stopped by user. always – Always restart container irrespective of exit status. The following example starts a "selenium/node-chrome" container and configures it to always restart unless it is

Encode/Decode the variable/response using Postman itself

We get a lot of use cases where we may have to implement Base64 encoding and/or decoding while building our APIs. And, if you are wondering if it is possible to encode/decode the variable/response using Postman itself or how to encode/decode the token or password in postman and save it in a variable? To Base64 encode/decode, the quickest way is to use JavaScript methods btoa, atob: atob - It turns base64-encoded ASCII data back to binary. btoa - It turns binary data to base64-encoded ASCII. Sample code : var responseBody = pm.response.json(); var parsedPwd = JSON.parse(atob(responseBody.password)); // presuming password is in the payload pm.collectionVariables.set("password", parsedPwd);