Showing posts with label Automation Strategy. Show all posts
Showing posts with label Automation Strategy. Show all posts

Monday, June 16, 2025

Solution Approach - How to Automate to Use the Magic Link for Login?

 

The question asked in The Test Chat community on 14th June 2025 22:42,

Hi All,
Has anyone implemented test automation for an application that uses a magic link for login?
If yes, could you please share the approach you followed?
Thanks in advance🙏🙏


My Analysis and Understanding

  1. The question asked is around automation.
  2. That is, how to automate to use the link (hypertext) generated for login.
  3. There are several ways to approach this, via
    1. GUI
    2. API
    3. Combination of GUI and API
  4. I prefer to use it in combination of GUI and API for first without using any email client services and app.
    • Why?
      • I want to keep it simple, quick and not to complicate the testing problems much more.


Solution and Approach

I see, it is not a complicated Test Engineering problem unless the project and floor do not support.


I understand, it is about using a link (hypertext) to login into a application via automation.

How do you get this hypertext?
  • It should be generated somewhere within the system's boundary.
  • Can you get that generated hypertext without using any mail client and its service points? How?
    • Do you have an endpoint that generates this hypertext?
    • If so, then this endpoint should also have some means to share the generated hypertext for login request?
    • Pick this generated hypertext via an API request in your automation.
  • This should work!  Unless the test goal in the automation is not to open some configured mail client and read the received mail.
    • But, how many times will you do this in automation, if the goal is to open configured mail client?
    • Is this a good use of automation?
If there is an endpoint to GET that generated hypertext (POST), it is a fair simple task.  

Say, there is no endpoint with GET request to give the generated hypertext. Then, look at the response payload of POST request that generates the login hypertext.   Consume this hypertext now and use it in GUI automation to login.  Say, there is no response payload in POST request.  Ask your team to build a GET request to consume internally and maintain it securely so that no external access is allowed.

Let us keep the testing problems simple!

 

Friday, February 2, 2024

Deep Link and its Testing via Automation

 

I get these question consistently from my fellow testers and community.

  1. How to automate the mobile apps and web applications using Deep Links?
  2. How to automate the business flows using Deep Links?
  3. How to achieve end-to-end business flows testing on using Deep Links?
  4. How to automate scenarios in mobile apps using Deep Links?
  5. What is the best approach to automate the mobile apps using Deep Links?
  6. What is the best practice to automate using the Deep Links?
And, more questions on same pitch.


No Deep Dive into - What is Deep Link?


A hyperlink in HTML is a kind of deep link within a website or to another website.

Deep Link is known with different names for web, Android app and iOS app.  All these names have the same understanding and intent at some point.

The Deep Links are URIs that takes me directly to a specific part (activity or fragment) of the app that I'm using or testing.  The Deep Link will have an intent which tells where I will be taken on using it.

When we converse on diving deep technically into testing and automation of Deep Link, will share more insights into its internals.



Deep Link and Challenges


This question is discussed with me often:
How to do end-to-end testing using the Deep Link?
Automation of a mobile app using Deep Link poses a challenge which is not experienced in web application.  

One such challenge is, say you have not installed the mobile app.  [This is solvable!]
  • On using a Deep Link, I should be taken to Apple Store or Play Store based on the app.
  • I have to install the app.
    • Post this, in the traditional automation, I should start traversing the business work flows via GUI.
    • Is this adding to the flakiness aspect of automation via GUI?

When we talk so much about flakiness and how to avoid (not prevent), should we exercise business workflows when automating using Deep Link?  What you are thinking?  Let me know!



Scoping of Automation Using Deep Link


Back to the fundamentals.
  • We have to automate, no escape from it.  Let us automate what must be automated!
  • Let us not fall into trap of "Automate everything!"
    • For today, I'm in this mindset and attitude,
  • What we automate depends on the objective or goal that we want to accomplish.
    • Each test should have precise and deterministic goal.
      • A test via automation is not an exemption to it.
      • A test defined in automation should be precise, deterministic and have a single objective - Single Responsibility Principle.

What is the objective of my testing via automation for the Deep Link?  This define the scope and extent of my automation.  This will minimize the number of checks that I do using Deep Link.

The purpose of Deep Link is to take me to specific part of the mobile app.
  • Should I start the end-to-end or exercising the workflow to be included in the Deep Link tests?
    • If included, am I not complicating the testing via automation?



Automation using Deep Link

I ask this question to myself and to my team.
What is the goal of testing via automation using Deep Link?

This question helps me to pick minimal and necessity flow actions.   It has lead and leads me to define minimal tests for Deep Link based on what we want to learn from automation of same.

To me, the purpose of Deep Link is not end-to-end testing.  It's purpose is,

Am I taken to the intended state and data when used the Deep Link?

I have kept the test intent to this.

With this, I have come with tests that has minimal must evaluation and assertion to learn if the app is responding or not to the Deep Link.  This is what the business wants when the Deep Links are created.

The app usage and workflow function is not a problem statement of Deep Link in a general context.

Deep Link is not for end-to-end.  It is to take to you from a point to another point, that's it.


Are you automating using Deep Link?



Tuesday, March 8, 2022

Solving: Question on Automating a Finance Web Application

 

Requirement for Web App Test Automation Framework


I read this question on The Test Tribe's Discord community server.




Here is the copy-paste of the question:

Hi all,

Could I have your expertise on below.

I have a requirement to build a test automation framework for a Web Application. Web application is developed using java and MySQL.

And the domain is related with finance sector. 

Most of the functions in the application is working with scheduling services which the service will triggered automatically. Mainly they wanted to verify the data which are displayed in UI with the database. Which means the data which is created with the scheduling services are added correctly. 

Some of the testing scenarios are as below:

1. For each transaction it will create a ticket and need verify the data which is on the ticket.

2. There are some configurations ( like rules) which will used to create behaviors of the transactions and have to verify the transactions will work according to the rule.

3. Whether the ticket is created for the correct user.

4. There are notification rules as SMS, Email and Letters, and needed to verify whether the correct notification rule is triggered. 

5. Verify if the ticket is automatically closed if outstanding or arrears is fully settled.

For automate this kind of scenarios what is best testing methodology ( tools, BDD vs TDD, framework type) should I use for create the framework and writing the test scripts.

Hope you got the above.

Could you please share your thoughts on this. It will be grateful. 

Thank you.



The Common Large Question


Listen to any Test Engineer who wants to start the automation, more or the same this will be the voice and words.  I was here and at times I will land up here when I have to pick the tooling part.  How I drill through this landscape and accomplish the mission will define who am I.  

This is the strategic part of testing and automation.  If this is firm to support the context, it can bring the values.  Else, I keep adding the costs to myself, the project, and the business.  The execution of the strategy will happen with what we pick; but, did it serve what we expect?

I want to demonstrate and share strategic thinking and apply it to arrive at an approaching and execution plan.  Doing this best to the context, will leave me with minimal costs to handle and survive with.  At least, I believe it so.  Just to make sure you are with me till here, do you hear such a similar question from Test Engineers who want to automate or start the automation practice?  

To me, this is one such common large question that I come across when I listen to testers and me.  I say it large for this reason -- the number of times I hear this question is beyond the count I can keep in my practice.



Interpretation of the Need and Requirement


As I read the requirement written and the follow-up discussion on same in the TTT's Discord space, I learn:
  • The present execution state of automation
    • Looks like no automation is written for this web application
  • What's the product?
    • It is a finance application
      • The web UI is the user interface for this application
    • Is there any other user interface for this application?
      • Not sure
  • What does the product do?
    • As said in the requirement,
      • The majority of business use case and function flow is to do with scheduling service
      • This scheduling happens automatically that is the system takes care of it using the input from the user -- which can be seen as one transaction
      • There are rules which can be called configurations
        • These rules will define how and what the transaction must do
        • Need to validate if the transaction adheres to the set rule
        • Need to validate if the ticket is created to the right user using this rule
        • Need to validate if the notification rule executed is right
          • The different types of notifications available
            • SMS
            • Email
            • Letters
              • Postal letter?
        • Each transaction will create a new ticket
      • Validate if the ticket is closed by the system on outstanding credit or arrears is completely settled
  • Technology and Tech Stack
    • Java and MySQL is used in this web application
    • Could be, 
      • The backend is written in Java
      • The database uses MySQL
    • But the system as this that involves scheduling and notification will have queuing, caching, messaging, and searching operations
      • The tech stack used for this is not mentioned in the requirement
      • Imagine a system that has to initiate the postal letter notification
        • This is something which involves not just software but also the people interaction very much
  • Help Expected from Community
    • As written in  the question posted
      • "For automate this kind of scenarios what is best testing methodology ( tools, BDD vs TDD, framework type) should I use for create the framework and writing the test scripts."



Microservices and Where to Automate


I guess this product should have been built using Microservices.  When I say Microservices, I mean, a small, modular, replaceable, independently developed, and independently deployed software application that is responsible for performing one function within a large system.

The diagram of microservice system

An illustrative representation of Microservices system


When I have to pick the automation in the large system built using Microservices, I will know what is that I want to accomplish from automation?  And, this is one of the primary questions to be answered irrespective of what the system is and how it is built.

Further, this leads me to know and understand:

  1. What data do I need to test and validate?
  2. Where to validate data?
  3. How to validate data?
  4. Which is faster and more efficient when validating the data?
  5. What is the expectation when validating the data?
This does not rule out or hold up any layer of the system.  In fact, this helps to know the importance, priority, and criticality of the layer (seam) where I have to start or have my tests concentrated.

I have missed showing the "data" within the hosting area in the above picture.  With that, I ask where should I test and automate to look for what I want to learn.  When I have this picture of my system in mind and how the microservices interact with the tech instances, it directs me to talk with appropriate team members and get started.


Getting Started to Automate in this System

Reading the problem statement and what is expected, it is nowhere mentioned by the tester -- how to automate on the web UI or API or other tech instances of the product.  But, the tester has mentioned the flows and their outcome which should be covered in the automation.

If I had to start testing and automation, I will do the below and assess:

  • APIs:
    1. I look at how good and deterministic is the APIs in processing the requests
    2. Can I take the response of API to infer the system looks to function as expected
    3. If yes, just this has to be taken by the client interface and display the result?
    4. Can I test the notifications at this layer with help of automation?
    5. Can I test the rules at this layer with help of automation?
    6. Can I test for the configuration here?
    7. Can I test for the ticket creation and its state updates?
  • Web UI:
    1. Do the contract between the web UI and API is obliged or does it have any problem?
    2. Is there any JS feature on web UI that takes and processes data further?
      • If yes, do I need to validate this to understand the correctness degree of the data to decide?
    3. Or, the web UI just accepts the response and display the data?
  • Databases, Queuing, Messaging, and Caching:
    1. Is there a need that I should be testing and automating at this layer to decide on the data displayed?
    2. Should I test here in association with other tech instances or in isolation to know the data?
    3. Is testing of Microservice and its endpoint is sufficient?  Or, should I also include these tech instances in testing together with Microservice?

This will set me on the path now to decide where to start automation so that it assists and speed up my testing.  If the Web UI consumes the data from the endpoint and display, I will begin automation at the API layer.  This is simpler, faster, and can help me to figure out the problems distinctly at web UI and API layer.  

If I started automation at the web UI layer to determine the correctness degree of data, maybe I will have to spend more time to automate in this context.  If I have the freedom to go ahead, I will update the team and stakeholders on why I'm going ahead with this decision.  Or, if I have to present it to stakeholders and then start, I will present the work with data i.e. time, what is covered, and how much along with what is not covered and why.

That said, I'm not saying -- I do not automate at the web UI layer.  I'm saying, where will I start and why.  Making sure one part of the system is deterministic will help to figure out the problems in the other parts of the system.  The question from a fellow test engineer says, a requirement of automation for web application and not automating the application on web layer.

The tools and methodology come with culture and practice followed in the project.  At least the test engineer will have choices on the tools and library side though not at methodology.



Wednesday, January 26, 2022

Automation Strategy - How to Automate on Web UI Table for the Data Displayed in Table

 

Use Case to Automate and a Problem Statement


I read the below question in The Test Tribe's Discord community server.  As I read, I realized, we all go through it when we think of automating a use case.  The credit of this question is to Avishek Behera.


Picture: Description of a use case to automate and a problem statement

Here is the copy-paste of the use case and problem statement posted by Avishek Behera:

Hello everyone, here is a use case I came across while having a discussion on automating it.

A webpage has a table containing different columns,let's say employees table with I'd, name, salary , date, etc

It also has pagination in UI, we can have 20 rows in one screen or navigate to next 20 records based on how many total records present,it could go about 10 + pages and so on....


Problem statement:

How to validate the data displayed in table are correctly displayed as per column header , also correct values like names, amount etc. Use case is to validate data.

The data comes from an underlying service, different endpoints basically.

Now it's not about automation but about right and faster approach to test this data.

What are different ways can we think of?

I know this is a basic scenario but since I was thinking of different possible solutions.

One way my friend suggested to use selenium, loop through tables ,get values ,assert with expected. Then it is time consuming, is it right approach just to validate data using selenium?


 These are the useful attributes of this question:

  1. It had the preset of context and the context information to the reader
  2. The availability of context information gave an idea of
    • What would API look like
    • The request and type
    • The response and details
    • The consumer of this API
  3. It helped to imagine and visualize how the data would be interpreted by consumers to render
  4. I get to see what Avishek is looking for in the said context


Interpreting the Use Case and Problem Statement


What it is?
  • Looks like the consumer is a web UI interface
    • Mention of Selenium library supports this interpretation
  • The response has a data which is displayed in the table kind of web UI
  • There can be no data to multiple rows of data displayed in the table
  • Pagination is available for this result in the UI
    • Is pagination available in the API request and response or not, this is not sure from the problem description
    • 20 rows are shown on one page of a table
    • The number of pages in the table can be more than one
    • The response will have a filter flag
      • I assume that data displayed in the table can be validated accordingly
    • The response will have the data on the number of result pages
      • This makes the result in a page to be of fixed length
      • That is 20 results on each page and I cannot choose the number on the UI
      • The response will have the offset or a value that tells the number of records displayed or/and returned in the response
  • Is it a GET or POST request?
    • This is not said in the problem description
    • But from the way the problem is described, it looks like a GET request
    • But should I assume that it is an HTTP request?
      • I assume it for now!
  • I assume the data is received in JSON format by the consumer
  • I assume the data responded by the endpoint or the service, are sorted and returned
    • The consumer need not process the response, sort, filter, and display
    • If the consumer has to process the response, then filter, sort and display, 
      • it would be a heavy operation on the client and the client-side automation for this use case

If it is other than an HTTP request, it should not matter much.  The underlying working and representation may remain something similar to HTTP requests and responses unless the data is transferred in binary format.



Automation Strategy for the Use Case


The key question I ask myself here is:
What is the expectation from automating this use case?

How I automate and where I automate is important but it comes later on answering the key question. The key is in knowing:
  • What is the expectation by automating this use case? 
  • What am I going to do from the outcome of this automation? 
  • What if the outcome of the automation gives me False Positive information and feedback?

These questions help me to see:
  • How should I weigh and prioritize the automation of this use case?
  • How should I approach automating this use case to be close to precise and accurate with deterministic attributes?
  • What and whose problem am I solving from automating this use case?

It gives me the lead to the idea of different approaches for automating the same; helps in picking the best for the context

That said, the use case shared by Avishek Behera is not a problem or a challenge with the Selenium library or any other similar libraries.  Also, it is not a problem or a challenge with libraries used in the automation of web requests and responses.



Challenges in the Problem Statement


I do not see any problem in automating the use case.  But there are challenges in approaching the automation of this use case.

On the web UI, if I automate on data returned, filtered, sorted, and displayed, it is a heavy task for automation.  Eventually, this is a very good candidate for soon to be a fragile test.  

Do the below said are the expectation from automation of the use case?
  • To have a fragile test
  • To have high code maintenance for this use case
  • To do high rework in the automation when UI of the web change
  • To complicate the deterministic attribute of this use case automation
If these are not the expectations, then picking an approach that has lower cost and maintenance is a need.

The challenges here are:
  • It is an Automation Strategy and Approaching challenge
  • It is a sampling challenge
    • Yes, automation at its best is as well a sampling, not just the testing
  • It is about having better data, state, and response which helps to have accuracy in the deterministic attributes of automation
    • To know if it is a:
      • true positive
      • false positive
      • true negative
      • false negative
      • an error
      • not processable
  • The layer where we want to automate
    • The layers which we want to use together in automation, and how much
  • Automate to what extent for having information and the confidence -- if this sampling works then most data should work in this context of a system?
  • The availability of test data that helps me to evaluate faster and confidently

Let whatever the system have in the underhood that is GraphQL, gRPC, ReST API, or any other technology stack services, one has to work on -- how to make a request; go through the response, and analyze it in context.  Like testing depends on context, automation as well depends on contextIn fact, context drives testing and automation better when it is included.



My Approach to Automate this Use Case


I will not automate the functional flow of this use case entirely on the web UI.  My thought will be to have those tests which are more reliable and the result influencing and driving the decision.

This thought has nothing to do with the Test Automation Pyramid and its advocacy that is to have the minimal number of UI tests at the UI layer and much more at the integration (or service) layer.  I'm looking for what works best in the context and where to have the tests that give me information and feedback so I have the confidence to decide and act.

To start, I identify the below functional tests for the said use case:
  1. Does the endpoint exist and serve?
  2. Assuming it is HTTP,  I see what HTTP methods this endpoint serves?
  3. What does the endpoint serve when it has no data to return?
    • The different HTTP status code this endpoint is programmed to return and not programmed but still returns
  4. What inputs (data, state, and event) does this endpoint need to return the data?
  5. In what format and how the input is sent in the request?
  6. In what format the response will be returned from the endpoint?
  7. Is the response sorted and filtered by the endpoint?
  8. How does the response look when there is no data available for any key?
  9. What if certain keys and their value are not available in the response?  How does it impact the client when displaying the data in a table?
    • For example,
      • No filter data is returned or it is invalid to a consumer to process
      • No sorted data is returned or it is invalid to a consumer to process
      • No pagination data is returned or it is invalid to a consumer to process
      • The contract mismatch between provider and consumer for data returned
        • What the web UI shows in the table data
      • Any locale or environment-specific data format and its conversion when the client consumes the data that is returned by the endpoint
      • The data when sorted by consumer and provider differs
      • The data is sorted on a state by the endpoint and that might change at any time when being consumed by the consumer
      • Is it a one time response or a lazy loading
        • If it is a lazy response, does the response have the key which tells the number of pages
      • and more cases as we explore ...
  10. and more tests as we explore ...

Should we automate all of these tests?  Maybe no per business needs.  Imagine the complexity it carries when automating all these tests at the UI level.  But there are a few cases that need to be automated at the UI level.  

Then, should we to look at the table rows on different pages to test in this automation?  No!  But we can sample and thereby we try to evaluate with as much as minimal data.  This highlights the importance and usefulness of the Test Data preparation and availabilityWhile, preparing the test data is a skill, the using of minimal test data to sample is also a skill.


API Layer Test


I have a straight case here for first.  That is to evaluate:
  1. The key (table header) and its value are returned as expected
    • Is it filtered? 
    • If yes, is it filtered on key what I want?
    • Is it sorted upon filtering?
    • There is no null or no value for a key that needs to have a value in any case
    • The data count (usually the JSON array object), that is the number of rows
    • The page index and current offset value
    • The number of result pages returned by the endpoint
  2. Can I accomplish this with an API test? 
    • Yes, I can and it will be efficient for the given context
  3. I will have five to ten test data which will help me to know if the data is sorted and filtered
  4. Another test will be to receive more than 10 rows and how these data look on filtered and sorted
    • Especially in case of lazy loading
    • I will try to evaluate the filtering and sorting with minimal data
    • I will have my test data available for the same in the system

UPDATE: I missed this point so adding it as an update.  I'm exploring the Selenium 4 feature where I can use the dev toolbar and monitor the network.  If I can accomplish what I can and it is simple in the context, this will help.


UI Layer Test


I have a straight case here as well to evaluate in the given context:
  1. I assume the provider and consumer abides by the contract
    • If not then this is not an automation problem
    • It is a culture and practice problem to address and fix
  2. I assume the data returned data is sorted on the filter; the web UI just consume it to display
    • If not, I will understand why the client is doing heavy work to filter and sort
      • What makes it to be this way?
    • You see, this is not an automation problem; it is a design challenge that can become a problem to product, not jot just for automation
  3. Asserting the data in the web UI table:
    • I will keep minimal data on the UI to assert that is not more than 4 or 5 rows
    • These rows should have data that tells me the displayed order is sorted and filtered
      • Let's call the above 1 and 2 as one test
    • To evaluate pagination that is number of result pages, I will use the response of API and use the same on the web UI to assert
      • Let's call the above another test that is the second test
      • Again, the test data will be the key here
    • To see if the pagination is interactive and navigatable on UI, I make an action to navigate for page number 'n'
      • If it is lazy loading, I will have to think about how to test table refresh
        • Mostly I will not assert for data
          • In testing the endpoint, 
            • I would have validated for the results returned and its length
        • I will assert for number of rows in the table now
      • Let's call it a third test
  4. I will not do the data validations and its heavy assertions on the web UI unless I have no other way
    • This is not a good approach to pick either
    • One test will try to evaluate just one aspect and I do not club tests into one test

Note: The purpose of the test is not check if the web UI is loading the same rows in all pages.  If this is the purpose, then it will be another test and I will try to keep minimal assertion on the web UI.


The Parallel Learnings


If observed, the outcome of automation and its effectiveness is not just dependent and directly proportional to how we write automation.  It is also dependent on:
  • The design of the system (& product)
  • The environment and maintenance
  • The test data and maintenance
  • The way we sequence the tests to execute in automation
  • Where and how we automate
  • The person and team doing the automation
    • The organization's thought process and vision for testing and automation
    • The organization's expectation from testing and automation
    • How, why, and what the people, organization, and customers understand for testing and automation
  • Time and resources for testing and automation
  • The automation strategy and approach
  • More importantly, the system having and providing
    • Testability
    • Automatability
    • Observability


Note: This is not the only way to approach the automation of this use case.  I shared the one which looks much better to the context.