Monday, November 23, 2020

Google Sheet- app scripting for giving formula with dynamic row value

 Hey folks,

If you want to give formula like =Mod((G9-E9),1)*24) in google app script than give it in below way.

var row=e.range.getRow();

e.source.getActiveSheet().getRange(row,9).setFormula("=Mod((G" + (row)+ "-F" + (row) + "),1)*24" );

Cheers.

TJ


Tuesday, October 20, 2020

Steps to implement Allure Reporting in Selenium java

 Hey Guys,

Steps to implement Allure reporting in selenium java framework.

Allure is an open-source framework designed to create interactive and comprehensive test report.

Each time when we run automation tests, we will have test results to view details about no. of tests passed, failed and failure details etc. And few reports also include test failure screenshots.

Allure report works

When we run our tests, every popular test framework generates junit-style xml report which will be used by Allure to generate HTML report. Allure reports has provided adapters for Java, PHP, Ruby, Python, Scala and C# test frameworks.

Steps to Generate Allure Reports

Install and configuration

  • Install Allure report command line application
  • do this manually by downloading the latest version as a zip archive from bintray.
    • Unpack the archive to allure-command line directory
    • Navigate to bin directory
    • Add allure to system PATH.

Implementation in code

  •            Create Maven project
  •             Add allure maven dependencies in pom.xml file and also add  AspectJ Weaver dependency along with allure.
  •             Create two test file in src/test/java folder and append the allure features in it for writing reports
  •             Create Testng.xml file
  •             We can add environment details in allure report by adding following
      •   Environment.properties
      •   Environment.xml
  •              We can categories the failed cases/defects using categories.json file
  • append the features of allure report to code like @step, @feature etc

 Run the code and generate the allure report

  •  Go to command prompt and in project directory and run the command
    • Mvn clean test
  • Or run the code through eclipse/intelij
  • Go to command prompt and generate the allure report in temporary folder using command
    • Allure serve <path of allure report>  (Generate report in temporary folder)
    • Allure generate <path of allure report> (Generate report in c:/user directory with allure folder)
    • Allure open <path of allure report>
    • Allure generate <path of allure report> --clean (will overwrite the existing report)

You can find more information on Allure documentation.

 Cheers.

TJ

Friday, October 9, 2020

Command to check version of softwares

 Hey Guys,

Recently i needed to check the versions of installed most of the time, so i thought to list down commands on finger tips.

  • Java
    • java -version
  • nodeJS
    • node -v
    • npm -v
  • newman
    • newman -version
    • install command : npm install -g newman
  • Allure reports
    • allure --version
  • maven
    • mvn -version
  • Jenkin
    • install command: java -jar Jenkins.war

Regards,

TJ

Wednesday, September 16, 2020

Smart way of Testing

Hey Folks,

Time to come up with some smart tools, which make your life easier.


1. To find the xpath from xml file : 
xpather.com 

2. To find the WSDL APIs: 
Install Google Chrome extension - wsdler

3. To test mobile app on emulator:
Install Google Chrome extension - Android online emulator

4. To do browser and excel automation without investing much time on commercial or freeware tool
Install Google Chrome extension - iMacros

Cheers,
TJ

Rest Assured Automation - API

Hello All,

 

Try to put some information around Rest Assured API testing using eClipse, TestNG. in subsequent blog, will provide some technical view.

 

API testing using RestAssured

  • RestAssured itself is API designed for automating Rest services/ Rest APIs.
  • Implemented using java classes
  • Available in jar files
  • Multiple request, get response from apis, validate data etc
  • Restassured only support Rest services, it not support SOAP services 

Setting up

  • Java
  • Eclipse
  • Test NG
  • Maven (specify dependencies)  

Steps:

  1. Create Maven project in eclipse
  2. Need to update POM.xml file
    1. RestAssured (https://mvnrepository.com/artifact/io.rest-assured/rest-assured/4.3.1)
    2. TestNG (https://mvnrepository.com/artifact/org.testng/testng/7.3.0)
    3. JSON – simple (https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple/1.1.1)
    4. Apache poi (https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml/4.1.2https://mvnrepository.com/artifact/org.apache.poi/poi/4.1.2)

 

Validations:

Status Code

Status Line

Request body n parameters

Success code

Validate Header

Json contains

Print headers

 

Data driven testing

1 prepare test data in excel

2 add apache poi dependency in pom.xml  or download apache poi & attach jars to your build path

3 XL utility file(java class file) which will read data from excel

4 write TestNG with data provider method

Cheers,

TJ 

 


Sunday, August 30, 2020

Mobile Testing - About Native, Mobile and Hybrid App

 Hi Folks,

During mobile testing, you heard about few words like one app, hybrid etc. Below are difference between them, hope it help you.

  1. Native App- native apps are those apps ... can be installed through google/apple store... accessible without internet, provide high performance as like built in app
  2. Mobile Web App -runs by mobile browsers chrome for android and safari for ios, same as desktop browser but make responsive to mobile browsers
  3. Hybrid app – combination of native and web app contained in a native container with low development time, downloadable from play store and compatible with most devices

 Cheers.

TJ


Saturday, August 8, 2020

Find a Filename from folder path

 Public Function fnFindFileFromPath(SearchPath, SearchFileName, dataSht) As String

    Dim StrFile As String

    'Debug.Print "in LoopThroughFiles. SearchPath: ", SearchPath

 '   StrFile = Dir(SearchPath & "\*" & SearchFileName)

    StrFile = Dir("D:\Test\")

     While (StrFile <> "")

      If InStr(StrFile, "Test") > 0 Then

         MsgBox "found " & StrFile

         Exit Function

      End If

     StrFile = Dir

    Wend

End Function

Wednesday, July 22, 2020

API Testing- benefits, Type of APIs, API Gateways

What is API?

Application programming interface

  • Software creation
  • System interaction
  • Consists of
    • Protocols
    • Functions
    • Objects
    • Commands
  • Code does not have to be rewritten
  • Available for web, window and mobile apps

 

Key benefits of using APIs

  • Conform to standards
  • Can be provided as a service
  • Data and functionality can be outsources
  • APIs can be offered by local systems
  • Allows developers to focus on other important aspect of application development

 

Decoupling services from applications

  • Consuming application is not connected to the servicing infrastructure
  • Service providers have great flexibility
  • Endpoint service delivery remains unchanged
  • API contract

 

Remote APIs

Overview of Remote APIs

  • Access and manipulate remote resources
  • Utilizes various protocols and standards
  • Independent of language and platform

 

Web APIs

  • Standards for connecting application to an API
  • Network or internet connections
  • Hypertext Transfer protocol
  • Web API
    • Web addressable endpoints
    • Support HTTP commands
  • Various internet based APIs

 

Common browser APIs

  • Document manipulation in browser
  • Fetch data from server
  • Audio
  • Video
  • Create and manipulate graphics like canvas and webGL

 

RestAPI

  • representation state transfer
  • web service access protocols
  • Rest aims to address soap shortcomings
  • Rest is lighter weight
  • Relies more on URL than xml
  • Provides flexibility on data output form

 

REST API tasks

  • GET -to retrieve
  • POST – to create
  • PUT – to update
  • Delete- to delete

 

REST API Advantages over SOAP

  • Designed similar to existing web technology
  • Does not require expensive tools
  • Easier to learn
  • No excessive processing
  • More efficient- smaller messaging

 

SOAP API

  • Simple object access protocol
  • Web service access protocols
  • Well established
  • More rigid than rest api
  • Relies on XML – can become highly complicated
  • Highly extensible
  • Difficulty depend on language used
  • http vs SMTP

 

SOAP advantages over rest API

  • independent of language and platform
  • independent of transport protocols
  • standardized
  • ideal for distributed environments
  • WS* standards
  • Build in error handling
  • Automation

 

API gateways

  • Classic API gateways
    • Sit between provider and consumer
    • Web services
    • Centralize functions
  • Microservice architectures
  • Microgateways
    • Functions are a subset of classic api gateway functions
    • Unique and automated deployment method
    • Scalability

 

Security functions

  • Multilayered API protection
  • Authentication
  • Authorization
  • Identity mediation
  • Security monitoring
  • Traffic encryption and signatures
  • Key and certificate management

 

Monitoring and Administration functions

  • Real time monitoring
  • Alerts
  • Insights and trends
  • Managing daily operations
  • Client management
  • Other integration scenarios

 

Control functions

  • Control and governance
  • Service level agreement
  • Throttling
  • Load balancing
  • Content based routing
  • Blocking
  • Quote management

 

Transformation functions

  • Bidirectional transformation
  • Less time to market
  • Numerous protocols, formats and various standards
  • Replacement of existing systems
  • Lightweight API orchestration tools

 

API Endpoints

  • Web service entry point : URL
  • Used to reduce latency
  • Some services support regional endpoints
  • Multiple region deployment
  • Custom domain name
  • Route clients to low latency regions

 

Cheers.

TJ

 

API Management and Strategy

API Management Strategy

  • Robust strategy is mandatory
  • Allowing users to create, manage, secure, analyze and scale APIs is important
  • Managing the architecture, performance and security is critical
  • Managing and engaging developers is crucial
  • Permitting developers to rapidly create PIs from existing data and service is essential

 

API management infrastructure

  • API gateways are platform for hosting API proxies
  • API developer portals allow for the usage of published APIs
  • API management UIs permit the management and development of APIs, API proxies and API environments

 

API management features

  • Analytics and statistics help understand how the API is being used
  • Developer friendly documentation with examples is crucial to encourage developers to use the system
  • Engaging the API consumers, developers and partners is extremely important for on boarding
  • Sandbox environments allow for developing and testing code
  • Support should be provided for public and private cloud
  • Identify and access management should be provided for security
  • Traffic management and caching features should be provided
  • Support should be provided to monetize the API
  • Support should be provided for legacy systems
  • The service should be available, scalable and redundant

 

API Management Best practices

  • Ensure the system allows for authorization, billing and payment for API usage
  • Provide an easy to use environment for user to integrate and compose APIs
  • Permit the management of the API life cycle and SOA governance
  • Provide users with a unique API key that can be used to track and set permission for SLAs
  • Enable throttling and configure SLA tiers to help prevent abuse
  • Ensure security detection and prevention are available to prevent malicious functions
  • Standards need to be enforced during the API life cycle
  • APIs should be easy to read about, discuss, and test
  • Cataloging should be performed to enable API discovery and use
  • APIs need to be monitored to track usage, errors and malicious attacks
  • An API portal should be available to engage with developers and B2B partners
  • APIs should be ritualized and protected using an enterprise gateway
  • Notification should be sent when an event impacts an API
  • APIs should be searchable using custom taxonomies or search functionality
  • API traffic should be monitored to track metrics to track metrics for monetization purposes

 

API monitoring strategy

  • Determines if APIs are available and functioning at expected
  • Works together with CI/CD automatically test new version of
  • Provides important performance data to the developers and operational teams

 

Tool selection

  • The tool needs to be intuitive in order to use it to its full potentials
  • Existing scripts created with API tools should be reusable and importable
  • Scheduling should be available to run monitors at peak times and various intervals
  • Sequencing and assertions should be available to ensure that APIs return the correct data
  • The tool should make data easy to consume and share to provide actionable insights
  • The tool should be adaptable and easy to integrate into your existing infrastructure
  • The tool should be able to alert he users when something goes wrong quickly and using multiple methods

 

Methods for creating API monitors

  • Import open API specification or swagger specification files
  • Import test scripts from soapui or ready API
  • Create new API endpoint monitors using a url and add assertions and validations
  • Create a chained API endpoint monitor using endpoints, urls and validations

 

Advantages of reusing functional tests

  • Real API functionality can be continuously tested
  • Existing functional tests already have assertions and more descriptive error messages
  • Functional API monitors imitate real usage and provide insight to technical operations
  • Using a single tool for testing and monitoring  APIs decreases expenses and the learning curve

 

API monitoring best practices

  • API availability needs to be tracked and logged
  • API transactions and authentication need to be monitored
  • Data collected from monitoring needs to be bench marked against competitors
  • To prevent SLA breaches, alerts should be sent for any outages or performance issues
  • Tests need to be configured with request headers for simulating and API transaction
  • Basic HTTP authentication needs to be supported to ensure secure and reliable data
  • Multiple APIs need to be monitored if they are part of an application to determine any performance bottlenecks
  • Analyse performance trends on monitoring data collected over time
  • APIs need to be tested to ensure the data is correct and in the right format
  • Integrate the API testing system data with the monitoring systems
  • API monitoring for performance and functional up time testing can help avoid security breaches
  • Comprehensive end to end testing and monitoring should be performed understand the big picture
  • Functional monitoring should be performed at regular interval to reduce human error
  • Business activity should be monitored to determine throw users are deriving business value from the APIs
  • Metrics need to be tracked to determine how much money is created from the API for both client and business
  • Functionality should be available for clients to write their own customized tests

 

API management tools

Tool selection criteria

  • Tools need to be easy to use and have good training and support documentation
  • Tools need to support scalability and growing demand for APIs
  • Strong single sign on and SSL support are crucial in maintaining security
  • The tools should provide functionality for publishing and consuming APIs

Kong API manament tool

  • One of the best open source API gateway
  • Good for startups, small, medium, and large sized businesses
  • Delivery can be as a proxy solution
  • Enterprise pricing plans are available as wella s a free evalution plan

 

3scale API management tool

  • Provides a strong developer portal
  • Good for startup, small,medium and large sized businesses
  • Delivery can be as a proxy, agent and hybrid solution
  • Professional and enterprise pricing plans are available

 

Apigee api management ool

>best tool for monetization of API

Good for small and medium sized business

Delivery can be as a proxy, agent or hybrid solution

Professional and enterprise pricing plans are available as well as free evalution plan

 

Akana

  • Has strong life cycle management tool
  • Good for large enterprise sized businesses
  • Delivery can be as proxy, agent or hybrid solution
  • Proessional and enterprise pricing plan

 

API monitring tools

  • Both open source and commercial api montiorning tools are available
  • Endpoints can be monitored for uptime, availability , response time, performance and other variables
  • Provide functionality for logging, visualization and time series data

Time series data gadgets

Assertible api management tools

Alertsite api monitoring tool- support mobile and saas  application

Open source tools- Prometheus is time series monitoring tool, graphite is push based monitoring tool, influxDB is part of large tick stack

 

API Metrics stakeholders

  • The infrastructure teams needs metrics to ensure the API services are running correctly
  • Development teams need metrics to ensure the apis are running quickly and bug free
  • Sales and marketing need to ensure the customers needs are being met with the apis features
  • Product management needs to balance creating new apis with maintaining existing apis, while ensuring all stakeholders are satisfied

 

Infrastructure API metrics

  • Uptime is one of the key metrics for measuring service available
  • CPU usage can indicate high demand or API performance issue
  • Memory usuage can help determine if memory needs to be increased or decreased

 

Development API metrics

  • Requests per minutes can be used by development to help make API more efficient
  • Average and max latency indicate to the developers and infrastructure team that there is something slowing down the api services
  • Errors per minute indicates that there is an issue with api having bugs or that is being called with incorrect parameters

 

Business API metrics

  • Unique api consumers is used by product managers to determine number of customers using the APIs
  • API usuage is important for product managers to determine demand for existing apis
  • Top customers by api usage tells the business who they should work with to develop new api services
  • Api retention allows the business to determine if more funding should be spent on development or growth
  • Time to first hellow world determines the effectiveness of the documentation, tutorials and marketing efforts
  • Api calls per business transaction indicates the effectiveness and efficiency of your endpoints

 

SOAP UI API testing

  • Can be used for testing SOAP and restful web services
  • Can be used for functional, performance, security interoperability and regression testing
  • Can be used for creating virtual services that be used for test driven development
  • 2 error- 400 client something wrong, 500 api something wrong

SOAP UI Rest API testing

  • Create, read, update and delete
  • Get requests can be used to read or retrieve data
  • Post requests can be used to add new data
  • Put requests can be used to update existing data
  • Delete requests can be used to remove data

 

SOAP UI SOAP API testing

  • WSDLs can be imported and default requests can be auto generated
  • Supports common standards such as ws-security, ws-addressing, ws-reliabile messaging, and MTOM
  • WS-I compatibility testing permits validating both contracts and methods
  • Mock services can be created from WSDLs to simulate simple and complex user behavior

 

SOAPUI performance testing

  • Baseline testing examines the system under normal load, which can be compared with other tests
  • Load testing involves increasing the load to test how the system performs
  • Stress testing involves increasing the load until the system stops working
  • Soak testing includes running baseline or load testing over a period of time
  • Scalability testing involves testing the system to ensure it scales as expected

 

SOAPUI API security testing and options

  • Performs common security tests such as SQL injection attacks and XML bombs
  • The empty option creates a test with no pre-configured security scans
  • The automatic option creates a default set of security scans
  • The full control option allows you to select security scans for your tests

 

SOAPUI automated testing

  • Create REST project> enter URL and click ok
  • Get resource appear as request1
  • Top window- method> get and endpoint and run the request
  • Right side shows response with XML, html, JSON
  • Right click on request one >add testcase> enter testsuite name>click ok>enter test case name> enter request name and click ok
  • Click on assertion tab in bottom of window > click + sign>JSON path expression
  • On project url> right click add resource> post
  • Same steps to add test case