Thursday, September 22, 2022

WebDriver: Tracing the Interface WebDriver - Part 2

 

In the previous post of this WebDriver series, I shared a gist about what WebDriver does and how.  In this blog post as Part 2 of this series, I'm sharing a bit more details on WebDriver and RemoteWebDriver.  

From there, we will see how AppiumDriver is related to WebDriver -- which extends the interface SearchContext.

This blog post is written as part of 21Days21Tips from The Test Chat.  The tip shared in this post is to know more about WebDriver internals and how it associates with RemoteWebDriver and AppiumDriver.

This should help in understanding the Selenium APIs better and from where it comes.  This helps in having a better mental model of the Selenium WebDriver and how we want to structure the instructions in the tests and utilities we write


SearchContext and WebDriver



Picture: Representation of SearchContext and hierarchy of WebDriver


  • The SearchContext is the parent interface in the WebDriver hierarchy
    • The subinterfaces of SearchContext are
      • WebDriver
      • WebElement
  • This SearchContext defines two methods
    • findElement(By by)
      • Modifier and Type is: WebElement
      • It finds the first WebElement using the given method
    • findElements(By by)
      • Modifier and Type is: java.util.List<WebElement>
      • It finds all elements within the current context using the given mechanism
        • NoteI'm referring to Java APIs of Selenium in this blog post
        • More details of this can be found here.

Note: Selenium's Ruby client describes the Interface SearchContext as this.  


The WebDriver provides the below methods:
  • close()
  • findElement(By by)
  • findElements(By by)
  • get(java.lang.String url)
  • getCurrentUrl()
  • getPageSource()
  • getTitle()
  • getWindowHandle()
  • getWindowHandles()
  • manage()
  • navigate()
  • quit()
  • switchTo()

More details of these methods can be found here.


RemoteWebDriver and AppiumDriver


Further, we see the class RemoteWebDriver implements the interface WebDriver.  Today, the WebDriver and RemoteWebDriver communicate using standard W3C specifications.

That way, all the modern browser which adheres to W3C specification should not have (much) trouble when using WebDriver and RemoteWebDriver to mimic the user action on them.  We see the ChromiumDriver(), ChromeDriver(), FirefoxDriver(), Edgedriver, SafariDriver(), and OperaDriver() extending the RemoteWebDriver.

This hints us to know and learn:
  1. Why do we initiate the WebDriver for first
  2. And, then we instantiate the browser's driver
  3. Later how we use WebDriver's instantiation to drive action (mimic the user action) on the browser using the respective browser's driver
When we want to automate using Selenium Grid, we make use of RemoteWebDriver to drive the action between the client and server.

The class AppiumDriver extends the WebElement and RemoteWebDriver from the project Selenium.  And further, it has its own methods to interact with the mobile elements.  More details about the Java Client of AppiumDriver can be found here.

The subclasses of AppiumDrivers are:

  • AndroidDriver
  • iOSDriver
  • WindowsDriver


21 Days 21 Tips -- #day17

Here are my pointers to fellow test engineers

  1. Interface SearchContext is top in the hierarchy of the WebDriver interface
  2. Interface SearchContext defines
    • Should I want to search for the element in the whole page
      • using WebDriver object
    • Or, should I search within a containing element
      • using WebElement object
        • We can notice methods returning the type WebElement
  3. RemoteWebDriver implements the interface WebDriver
  4. The modern browsers drivers extends the class RemoteWebDriver
  5. AppiumDriver extends the class RemoteWebDriver and interface WebElement
For more understanding of the SearchContext and WebDriver, refer to below git repository of SeleniumHQ:

The below understanding should give a mental model of how the call happens in Selenium's library:
  • WebDriver and browser's driver instantiation
  • The order in which it is instantiated and used in programming to automate actions on the  browser

If noticed, the automation we do is more of programming and not of Selenium's library.  We extend and implement the Selenium library in our programming to mimic the action on the browsers and mobile apps.


Tuesday, September 13, 2022

A Direction Sign for Beginners and Everyone to Start and Grow in Software Testing

 

I'm volunteering for the Agile Testing Alliance (ATA) for this year 2022.  This 10th September 2022, we had an ATA Round Table Talk 2 on account of International Testers Day.  We planned two events on this day -- QuizATAhon-1 and Ask Me Anything (AMA) with ATA volunteers.

One of the questions that we volunteers got from the community is:

"Best advice for beginners who wants to start there career in the testing field as per there experience level"

I shared my thoughts on this question in the AMA session.  I have a strong intuitive feeling that this will be the question of the interns, freshers, and also of experienced test engineers.  Hence, I want to write it as a blog post, so that it can be referred to as one of the directional heuristics.


This is Not an Advice

What I'm sharing in this post it is not advice.  It is information. You can use this information to advise yourself on what you should be doing to grow consistently in the practice of Software Testing and testing job.  As said, it is a directional heuristic that you can use.

This information will make sense to every one of us irrespective of experience in the industry with software testing as a career and practice.  There is no best advice.  I see, advice is information or carries a piece of information that can show us a direction.  And, the advice is a heuristic!


Direction Sign To Be a Skilled Tester

This will be super useful to you if you actually make use of it to your need and to the maximum possible extent that you can.

  1. Find your Software Testing Community
    • You might find the community quicker than finding the people, books, and syllabus of Software Testing
      • If you don't read Software Testing and Programming resources, someone in the community might be reading it
      • You can use their learning for your growth
    • Look out for the Software Testing Communities in your place (city or country)
    • Just do not look at one testing community; find more than one active communities
      • Collaborate with the communities
      • Interact with fellow Test Engineers in the community
      • Start contributing to the communities in the possible ways you can
    • Note that, the groups on Social Media will not make it a community
      • People come together in a community
      • Events, Meetups, Conferences, Discussions and much more will happen in the communities
    • Today we can associate with Software Testing Communities which are in other countries
      • Could be this community will have one of its chapters in your city or country
    • Find the Software Testing communities
  2. Mindset - Do not get easily influenced
    • You are bound to get influenced and follow easily
      • when you look into the community and the people in the community
        • with their works, writing, accomplishments, social presence, and identity
      • when your fellow peers in college or the workplace talk about testing to you in anyways and in any dimensions
        • It is their opinion
        • It is their understanding
        • It is their assumptions
        • It is their mindset
      • and, with what you read or watch about testing posted on social spaces
    • Have the mind and thought that questions; try to seek what makes sense rationally to you
      • Be practical and experimental
      • Do not attach your past and present experience's emotion to others' opinions
        • You evaluate it
        • Pick what makes sense to you and to your context
    • Do not be a mind of other Test Engineer or practitioner
      • Have our own voice and identity
      • Express your opinion while you respect the work and opinion of other Test Engineers and practitioners
      • Develop your working style, learning style, and problem-solving style
        • But do not stop observing others and how they are doing it!
    • Question!
      • It is about being included than being influenced
      • Do not stop questioning
      • Talk, and talk with respect!
    • A test is a question asked to learn what it is and to understand what actually it is
      • It needs a mindset
      • A mindset not to get easily influenced and accept an opinion or a thought
    • Note: Do not be influenced by this blog of me; just read it as a heuristic
      • You build your approach using this heuristic only if it helps you
  3. Knowing the chaos around Software Testing is very important
    • Everyone knows Software Testing and everyone believes to have an idea of what it is
      • This is the state of mind in the college that teaches computers and programming
        • This is the state of mind in the software industry
      • Chaos starts right from the syllabus, textbooks, and reference books, and with you
    • Here are some chaos and myths existing for 20+ years and they will exist in the coming years
      • Software Tester has no bright career as Software Testing is not technical
      • End of Software Testing is coming soon
      • Software Testing has seen its end
      • No need of knowing the programming
        • It is a necessity in today's Software Development context
      • It is an easy job
        • Is it so?
        • Try finding at least 3 business stopping risks and problems in the system every day
          • If you do this consistently, label it as an easy job
          • Let your business stakeholder acknowledge the findings of your testing as a business stopping risks and problems
      • No good money earned when compared to a programmer
      • No career in Software Testing as we grow with our experience in the industry
      • To be a Software Tester one need not be technical
      • It is a Women's job
        • Yes, that is how it was projected and was said
          • I'm saying this from my experience in India
            • I'm not aware of how it was or it is in other countries
        • 2014 and onwards, I have not heard this statement
        • Happy, that we don't hear this today
          • Thanks to SDET and SET roles
            • At least, this removed the gender bias is what I see
            • Today both women and men work in the role of SDETs
              • I worked with women SDETs and I did learn from them; I say this is in pride
          • I'm happy that women are taken out of this framing today
            • I'm very happy!
            • We don't have to bring gender discrimination in Software Testing career and jobs anymore
            • I see, there is no job that women cannot do today in the technology space
              • This is an empowerment of women
              • Women are equally skilled and work to upskill
          • We have skilled women technologists, CTOs, VP Engineering, Architects, Test Architects, SDETs, & Test Engineers
          • I'm happy that I have worked with technically skilled women and I reported to a few of them
          • Ah! I should stop calling men and women here; it is we Test Engineers
    • Do not panic with the chaos that is created frequently and consistently
      • Talk to your community
  4. Find your Mentors
    • I said mentors and not a mentor
      • Have more than one mentor
      • Know how to work and practice while you have more than one mentors
      • Respect your mentors by giving the credits and with your gratitude
    • Find your mentors in the workplace and in the community
    • Good if your mentors have the contrasting thought process and ideologies
      • Pick from both sides
      • Know what both sides advocate and practices
      • Apply the appropriate one to your work when the context demands it
    • Do not be the mouthpiece of your mentor
    • Do not be the mind copy or replica of your mentor
    • Do not imitate your mentor
    • Seek your mentor's assistance in you being you
      • Seek help in growing with your identity and voice
      • Have a voice and your identity
  5. Communicate with your Software Testing Community
    • When you talk to the community, you will know
      • where you are
      • where is Software Testing
      • the challenges your fellow testers in the community are having
      • how the challenges and problems are being solved
    • It will set you a tempo with an attitude if you talk and share your learning
    • In simple, just read or listen to the problems the testers share everyday
      • This is awareness!
      • At least, it opens to the awareness of technology, tech stacks, problems, solutions, industry, people, and more
    • Attend the meetups
      • Small crowd and high interaction with networking
      • High exchange of learning and experiences
  6. Be the Technical Mind
    • We Test Engineers are said to think like a user
      • Good!
      • This is an empathy mindset that is being cultivated in us for the users who use the solution we are building
      • But this empathy is alone enough today? No!
    • Empathy with technical skills will be much value adding
      • And it is today's need
    • When I say technical, it is not just programming
      • Programming is one small aspect of being technical
    • Let your technical journey start from learning:
      • How this works and what makes it work
      • Know the technology layers internally and externally when you learn how it works or when it does not work
      • Start here! And expand your technical capability dimensions
    • Today, we are said and expected to think like an engineer
      • An engineer who understands the user
      • An engineer who understands the business
      • An engineer who understands the investor
      • An engineer who understands the management and managers
      • An engineer who understands all this can change at any time
      • An engineer who can work, scale and deliver in a startup mindset and environment
  7. Seek and Share Awareness
    • What sets back we Test Engineers is the lack of awareness before lack of attempts to practice
    • We don't work, collaborate and associate to be aware of
    • We are not aware of -- what to be aware of
      • This includes me as well
      • I consistently keep trying to be aware
    • Do not just attend  and be part of the Software Testing community
      • Attend the community of programmers, DevOps, products, businesses, startups, enterprise
      • You will see the direction sign -- which happens to be a heuristic
  8. Know what is your Software Testing
    • Everyone has their understanding of Software Testing
    • Engineering Managers and Director of Engineering with whom I worked had their own understanding of Software Testing
      • No one was similar nor did match anywhere
      • All have their version of testing in their work
    • Know what is Software Testing you want to practice
    • Software Testing is contextual
      • Tailor and deliver Software Testing to what is expected at your workplace
      • While you do that, try educating your fellow Test Engineers
        • That's the seeding
        • This is the place where we can seed and harvest for a better tomorrow in Software Testing and for our growth
  9. Practice your Software Testing in all dimensions
    • Software Testing is with people, software, hardware, and more
    • When we are dealing with Software we cannot be away from programming
    • Programming gives a different order to our testing
      • Practice programming
      • Embrace it
      • Shell out the fear of programming
      • Start small; more importantly start and continue
        • To keep going, find one tester in the community who wants to do it
        • Go to your mentors and follow up with your accomplishments, setbacks, challenges, and problems
        • Get unblocked; make progress; learn, implement and share
    • Do not run away from the practice of automation
      • It is a necessity for today's Software Development & Engineering
    • Find all possible dimensions you can
  10. Build your portfolio
    • Explore how to build your portfolio in Software Testing
    • Ask community
      • We have several portfolios to refer to in the community
    • Build it and continue improvising it with the time and context
  11. Solve the Software Testing problems
    • Before solving at least be aware of the problems
    • Community is one place where you can hear the problems and challenges
    • Contribute to the solution and solving
      • This helps you a lot as a practicing Test Engineer
    • Problems come in flavors and contexts
      • Testing, Automation, DevOps, Product, Requirement, Delivery, and more
        • Have yours hands-on on all these verticals to help and scale your testing and automation
    • This will make you talk and help you grow with experience and learning
  12. Tune up yourself with Business, Political, and Management skills
    • Not all problems can be solved with a technical mindset and skills
    • It needs the skill of political and management orientation
      • Do good and be good
      • Work on how you communicate; it is important
    • Know how the business decisions are made
    • Know how business decisions influence technology, engineering, and anything
      • The business decision need not be based on logical and technical analysis
  13. Beat your EGO and respect your self-respect with dignity for Software Testing
    • Ego has killed a lot of us from talking and growing
    • Ego has made many managers lose their engineers
    • Ego had made many testers lose what their managers could offer to learn and grow
    • Software Testing has its touch points in every vertical of Software Development
      • Programming
      • DevOps
      • Product Management
      • Solutions
      • and, what else?
    • Testing is done in all these verticals
      • Ego can set us back and block from what we can make for our benefit and contribute to the organization and business
    • Managing the ego is a skill
      • While managing ego, balancing one's self-respect is a challenge
        • Know what is the objective and what you make out of it for your growth
      • While doing this keep the dignity of Software Testing and team morale high along with your self-respect
      • Talk to your mentors!
    • Yes, talk to your mentors
      • Mentors might be handling ego, self-respect, and dignity of their work and practice
      • Your mentors can tell you the ways to do it
    • Take care of your Mental Health and help others too
      • Physical health is also important


This information should hint you with the direction of practice, growth, and excellence as a Software Testing practitioner.  I'm here to connect with you anytime and talk more and take it forward.


Monday, September 12, 2022

Testability: More About it from the Programming Literature

 

My friend Parimala Hariprasad gifted me the book Essential Skills for The Agile Developer, authored by Alan Shalloway, Scott Bain, Ken Pugh, and Amir Kolsky.  Thank you, Parimala, for gifting this book.  I'm experiencing the value of this book and using it.

In this post, I'm sharing the content shared in Chapter 3 of this book. It is about Testability and how it improves the code quality.  


Why this Blog Post?

I continue to read Software Testing literature.  I understand the below as one of the primary key skills for a Software Test Engineer practice:

  • Identifying the Testability attribute in the system
  • Mapping and classifying how the available Testability attribute can be used in Tests
  • Asking for the Testability attribute
With that, I understand "how easy it is to test by a test engineer in a given context" as Testability.  If noticed, this is from Software Testing literature.  And, I see it has these three elements which tell the prominence of each:
  • How easy it is to test?
    • what factors make it easy to test?
    • how does it make it easier?
    • how does it bring the deterministic character?
    • how can I isolate the observations with my analysis with the help of deterministic character and aid added?
  • By a Test Engineer's
    • awareness, experience, learning, applying the skills, and more
  • In a given context
    • time, people, environment, availability, and more
If any of these three elements has trouble, it has its effects on the test and testing.  If you ask what effects, I don't know.  If I pick from my case to share one of the effects, I say, I was not very sure what was happening though the product looked to do what is expected.  But will it continue to do what is expected to do and in what all ways? I had no answer for in what all ways and in what contexts. This is one such case of how the absence or not using the Testability can influence the tester to be unsure about the learning made with help of a test.

The book I mentioned here gives another perspective from the Computer Programming literature.  It talks at the fundamental level and I see this is important to understand for we Test Engineers.  Soon in the coming days, we Test Engineers will be working and testing in these layers of product development. 

In the next section, I will share the lines from the book as is in italics and blue font color word.  The credits are to the authors of this book. I'm taking the text as it is from this book.  And, I will share my interpretation for the same and see the relativity of Computer Programming and Software Testing literature.  

Note: The credit is to James Bach for the Testability definition used above.  I added "the tester and context" to it as these two influence the Testability and outcome of using the Testability to a greater extent.


Testability and Code Quality

The authors of the book say, "testability is highly correlated to the code qualities we want to manifest, in particular, loose coupling, strong cohesion, and no redundancy."  Further, they illustrate how one remarks at the start of testing one's code by saying the below:

I can't test this code; it does too many things that are so interwined -- weak cohesion

I can't test this code without access to dozens of other things -- excessive cohesion

I can't test this code; it's been copied all over the place, and my tests will have to be duplicated over and over again -- redundancy

I can't test this code; there are too many ways for external objects to change its internal state -- lack of encapsulation


Then I read this line from the authors, "Gee, I wish they had thought of how this code was going to be tested while they were writing it!".  That's a question that every one of us has to ask ourselves for the work we deliver and not just for the programming.  

Alan Shalloway says he is kind of slow sometimes because it took him some time to realize this -- I should consider how my code is going to be tested before writing it! 

Testability is related to loose coupling, strong cohesion, no redundancy, and proper encapsulation.  Another way to say this is:

  • the tighter your coupling, the weaker your cohesion; 
  • the more your redundancy and the weaker your encapsulation, the harder it will be to test your code
Therefore, making your code easier to test will result in the loose coupling, strong cohesion, less redundancy, and better encapsulation.  This leads to a new principle -- Considering how to test your code before you write it is a kind of design.

Since testability results in so many good code qualities and since it is done before you write your code, it is a very highly leveraged action.  That is, a little work goes a long way; it is a great trim tab.


I and Testability


I try to understand and learn about Testability every day in my practice.  When I started my career 15 years back, I learned from my network, that one of our fellow testers in the community that is Meeta Prakash did her Ph.D. in Testability.  I wanted and still want to read the thesis of Meeta Prakash.  I hope she will find it and give me soon, one day.  In those days, I referred to the slides of James Bach on RST; that legacy slides that had contents filled with blue color. 

From there, I tried looking into the testability in what I test and what programmers deliver to me.  When I worked with Moolya in 2012, I realized from my practice -- context and the skill sets of a tester matter to make use of the available testability and to identify if it is present or not, and to what extent. I added this to the definition of James Bach and I shared the same with my fellow testers with whom I was mentoring and working together.


Relating the Literature and Interpretation


When the programming is talking about testability, I see it is talking about:
  • internal aspects of how it is programmed and to test the same easily in isolation, and in integration for the context while being deterministic
The words used to express in programming literature are more programming oriented.  Whereas, what we see in the Software Testing literature, it is more of a common man's words.  But, what both means is the same and the difference between them is to which layer and aspect they are referring and how, and why.

The Weak Cohesion
  • It will be an obvious experience to a tester when it is difficult to speculate and pull a particular observation with more information for a feature or a user flow
    • For example, if the Refresh Token is used along with Auth Token everywhere, then it will be tough to isolate when Refresh Token is used and when the Auth Token is used
I feel the same when wanting to test a piece of code in isolation from other code.  I have experienced this when testing one aspect of utility or a complete utility in isolation from the rest of the automation code.


The Excessive Cohesion
  • I could not test the mobile apps as I needed data
  • Certain data came from a portal that is also under development and depends on APIs to work
  • APIs would be under development till the last day of release and did not deliver the endpoints to the portal and mobile apps team
So how could the test team create data to test for mobile apps, web portal, and for APIs themselves?  If you see this is excessive cohesion at the product development level.


The Redundancy
  • In one project, I had to login each time to see the status of a session
    • All tests were programmed in a way that I should login each time
  • The test team used the login function in every test and it was duplicated
  • When signed in, the Auth token got changed which lead to difficulty in debugging and isolating the problem
This complicated the test code and also messed up debugging.  The tests could not be deterministic here.

I see a static Auth token or one-time login and using the same Auth token in all other tests in the suite could have helped to debug the problem and where it occurred.


The Lack of Encapsulation
  • My team had a tough time when started to use an existing automation
  • It had public access modifier for all methods in all packages
    • The team picked up and authored more tests that changed the data and states
  • This led to any object of a method to modify the data or state; it was not supposed to be modified at all
  • The debugging led us here and it was not a problem with the product
    • It was the problem with the product's automation code and how the tests changed data and state;  it was in turn used in other tests
This led to much more chaos as the automation and testing environment were the same.  The invalid bugs, meetings that got scheduled to discuss and time went into the meeting that ended with no use, and a couple of releases came into a decision should we deploy or not, and more.



Continuing the Unlearning and Learning of Testability


If you see, Testability has got multi-dimensions in the dynamics of software development.  Testability is not just about Programming and Testing.  It can be from the environment, project, people, what we understand and how we use it further in work, and the business itself.

I continue to unlearn and learn testability every day as I practice testing and automation. 



Thursday, July 21, 2022

Dealing with the Fallacies of a Fallacy

 

One of my mentees asked me to help in identifying and understanding the fallacies in Software Testing.  I did not know the context in which the help was sought.  All I got is, on reading the book from Gerald M. Weinberg, the mentee wanted to understand and know the testing fallacies better and in simple terms.  For "fallacy", I understand it as -- a misconception resulting from incorrect reasoning and a false belief.  

Further, I learn that reasoning and belief are also heuristics. Can the heuristic be a fallacy? I see, the heuristic can be a fallacy.


The Reality of the Fallacy is a Fallacy

I will keep this blog post layered and oriented with technical lines so that it becomes easy for anyone in tech to understand my thoughts.  As I write this, I get hit by this question -- "Fallacy is a Fallacy?".  With that, I'm left with a successive question -- Fallacy is a Fallacy? Is that not a logical question? 

When I mean logical, I understand logic is one of the aspects of rational, scientific, and systematic analysis.  The analysis has limitations, knowns, and unknowns.  Further, this is super covered by a meta context which includes the uncertainty -- we are aware of and not aware of in our analysis.

When I write this, I see the word "meta context" in my mind.  I don't know if someone has used it earlier.  I presume, someone should have definitely used it when talking about engineering and systematic rational analysis. 

When we work on an engineering problem, we work with a context.  In that context, we learn 

  • the problem, 
  • need (requirement), 
  • assumptions we make, 
  • what we know, 
  • what we do not know, 
  • potential solutions, 
  • approaches, 
  • execution, and more

The engineer in me says, there is a meta context for every context.  Doing engineering to the meta context is an over-engineering is what I understand.  

Engineering to a context, by solving the risks and problems which are identified in that context, is what we all are doing, today.  This is my observation!  An example of this is the software system that we are building and continuing to consistently develop to be updated for the need.  The software system we are building, testing, and deploying is bound to a context and not to the meta context.

In Software Engineering, we work on a context, and, that itself is huge engineering.  Eventually we start seeing the context in which we work as a meta context, while it is actually not.  This is one of the fallacies which we encounter and most times do not identify it.  You see?  Then how to think about the meta context which comprises the infinite contexts from which we have picked a context to engineer and solve?

Once we try and continue to be aware of meta context and what it has, we start to learn everything is a fallacy, including the fallacy.  That's enough philosophical from me.  But, that's the reality and fallacy, as well. 

That said, thinking is a fallacy.  We know that exhaustive testing is not possible.  Likewise, exhaustive thinking is not possible.  When one's thinking is not exhaustive and bounded, don't a fallacy exist there? 

One's scientific and logical thinking is modeled and sampled over a few models, space and dimensions.  The decision from this thinking, practice, and testing will have limitations and fallacies that are noticed and unnoticed.

If an organism can think, then that organism will undergo the influence of a fallacy.  And, the organism can learn to identify fallacy, if at all it understands -- I can be fooled no matter what.  That is one of the byproducts of testing -- knowing the few possible ways how one can get fooled.  And, we have no leisure and luxury to find "all the ways"; this bound brings in fallacies in one's belief, thinking, work and decision.  So I say we work in a context which is pulled out of a meta context.

I see this is the stem of fallacy; the fallacies get wired to our thought process and to the engineering we do. Our systematic and scientific interpretation accepts the fallacy as -- logical, and systematic, and claims the problem we're solving is solvable.  Note that, when I say solvable here, I mean, we can deal with it for the costs and value we get out of it.  By doing so, we handle and manage the fallacy to yield the value.


What Did I Read Just Now?

Well, what you read above are engineering philosophical thoughts of me.  Now, let me pull that to the Software Engineering and Software Test Engineering.

The software system or a hardware system or any system that we have built is an assumption.  We assume it works because we work to make it work.  And, we sense that it works because we adhere to the protocols which define these assumptions.

So that tells me, that anything and everything is built, and being built is an assumption and has protocols. And if anything is working, it is on assumptions.  If anything has failed to work, it is on our assumptions.  That infers me, that rational and systematic analysis is an investigated and experimented assumption.

These protocols and assumptions can blind us to fallacies and limits us to not identify the fallacy.  On witnessing an incident, the fallacy or the outcomes of a fallacy may get uncovered a bit.  That is what we do in the RCA -- Root Cause Analysis.  We do the RCA so that we learn the fallacy in which we got trapped.

On RCA for an incident, we will experience a similar or same problem again.  Why?  We think, that once we do the RCA and practice, we do not repeat the mistake -- this is a fallacy too.  We do a new mistake, which leads to another RCA.  Does that means, the RCA of an incident says not to fall for the same fallacy again but okay for another fallacy?


Managing Self with Fallacy

I too fail in identifying the fallacies.  I continue to prompt my thinking and analysis to see the obvious traps while I test and deliver the testing.  I do not identify all the fallacies in a context.  I will work to find the list of fallacies that brings the most cost in testing delivery and system development technically.

Here are a few questions that I ask myself each time in my test session and analysis:

  1. What are the five contexts where this is a problem or risk?
  2. What are the five contexts where this is not a problem or risk?
  3. What are the five ways where this looks to work as expected?
  4. What are the five ways where this does not work as expected?
  5. What are the five contexts that matters most about this system and I have missed to know them?
  6. In what contexts this bug is not a bug anymore? Why?
  7. In what contexts this will be a bug/problem/risk/cost? Why?
  8. What are the influencing factors and practices considered in making this decision? In what contexts do these factors and practice displace the value with the cost?
  9. What are the assumptions and beliefs that are driving my testing?  Whose assumptions and beliefs are they?
  10. Do I know that I can be fooled?
  11. Do I see any problem here?
  12. Do I see any value here?
  13. Do I see any cost here?
  14. What More Can I See Here?

Understanding and learning -- how my team and stakeholders attach the importance to the same information, helps me. This potentially hints me if they are under influence of any fallacies.  I learn, the context in which team members and stakeholders are also influencing the importance attached to the same informationSometimes, the team and stakeholders use the same word; but, I notice they have other meanings.

This has lead me to learn, it is not about being precise or not for first; it is about, having the ability to communicate and help each other to have the clarity in what is expected.  And, how to achieve this clarity considering the thought processes and beliefs that each stakeholders hold, is a must to understand.

To sum up, we cannot avoid ourself from the fallacy.  What is not a fallacy at present, it can and will be a fallacy in coming time.  The goal is to how we manage to identify and deal with the fallacy which is influencing us and our work.

There is no escape from the fallacies!


Note: The count of words "fallacies" and "fallacy" in this blog post is 47.



Wednesday, July 13, 2022

IntelliJ and Cache: Maven Dependencies Not Resolved


This post is about the Maven dependencies not resolving.  I'm recording the incident, my understanding, and what worked for me. It can help a fellow Software Test Engineer.


Incident and its Details

I'm using the machine which has the below setup:

  • OS: Windows 10 Pro
  • IDE: IntelliJ IDEA 2022.13 (Community Edition)
  • JDK: 1.8
  • Maven: 3.5.4 

I created a new Maven project and in the pom.xml, I added the below dependencies.  The IDE showed that these dependencies are not resolved.

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.3.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.3.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>


I observed, that the added dependencies not getting resolved, that is, not getting added to libraries.  In the IDE, I see the error as this:

  • Dependency 'io.github.bonigarcia:webdrivermanager:4.3.1' not found
  • Dependency 'org.seleniumhq.selenium:selenium-java:4.3.0' not found 
  • Dependency 'org.testng:testng:7.3.0' not found
  • Dependency 'io.rest-assured:rest-assured:4.4.0' not found

Note: I have other Maven projects to which I have added the same dependencies but of different versions, in my workspace. Each time I add a dependency it will download to the libraries in my workspace though it exists, and this is my configuration in IDE.

At this point, I did not know what is happening and how to approach resolving this problem.  All I know is, that there are other versions of the same dependencies in the Maven's library on my machine.


Understanding the Problem


I tried to understand what it is saying to me.  It says it cannot find the dependency.  Could be that it is looking for the dependency in the Maven's library on my box, and it is not finding it.  

Further, I looked into the web to see did someone else face the same incident and said behavior.  Few posts said using the "compile" scope solved the problem in their case for WebDriverManager.  But, how can the change in scope fix the dependency not found incident?  This was the question in me!  To my curiosity, I did try that for WebDriverManager; I did not see any change.


Invalidating the Cache - Is that a Fix?


In the IntelliJ IDE, I tried to invalidate the cache and reboot the IDE and open the project.  I see the dependencies being resolved and I do not see the said problem.

I don't know how this fixed the said problem here.  Also, I don't know precisely what exactly the problem is, here.  Invalidating the cache and reopening the IDE (also the project) worked.

On invalidating cache, here is what happens per IntelliJ:
  • Removes the cache files for all projects ever run in the current version of IDE
  • The files will be recreated the next time you open these projects

I remember now that I upgraded the IntelliJ to the latest version before creating the said new Maven project, here.  Later, it resulted in the above said dependency problem. 

Note that, I had created a few Maven projects using an older version of IntelliJ.  I have the same dependencies in the old and new projects, just the version of these dependencies is the only difference.

Now, invalidating the cache on this new version of IntelliJ, it got fixed.  I understand that the IDE uses the cached instances of these dependencies.  Could be there is a relationship between this cache, dependency versions, and the IDE version?  I'm technically not sure of the same, but my instincts say it is.



Saturday, June 4, 2022

Between the words Smoke and Sanity, and Test

 

Why Testing and Tests?

In simple and short, we test to have confidence in what we expect to believe or claim.  For example, I believe this code does what it is supposed to do in a context.  The tests in the testing may help to learn that and thereby help in having confidence.  Likewise, if the tests in testing are intended to prove with rational evidence that this does not work as expected -  this is also a confidence in how we see the claim.

Testing and Tests:

  • are highly contextual
  • it depends on the person who is testing
    • her/his understanding of testing and tests
    • how she/he applies the testing and tests
    • her/his thought process and ideologies on testing and tests
  • it depends on the person who is referring to the outcome of testing
  • it is highly oriented toward the expectation of the stakeholders
    • on what it has to be
    • on how it has to be
    • on what it has to serve
If there is anything in Software Development that can be tailored to the need, I see it is Software Testing.  It happens that everyone has her/his own understanding and definitions for Software Testing and how it has to be implemented and executed.  And, it is done that way!

But the same is not observed with programming, DevOps, finance, sales & marketing; or, not to the extent seen in Software Testing.  This is my observation and understanding.  Is that wrong?  That's altogether a different topic of discussion.

In the organizations, I have worked and in the projects that I have worked on within an organization, the software testing was defined and executed how they wanted it.   Though they were a few common things, how these common things were implemented and understood is not the same.



Smoke and Sanity, and Test


Before I begin, here are the questions that I would want you to answer for yourself:
  1. Would you start with Smoke Test and then start the Sanity Test?
  2. Would you continue with Sanity Test after the Smoke Test?  Why?
  3. What do you consider in Smoke Test and Sanity Test?  Anything in common?
  4. What did you learn from the outcome of the Smoke Test and Sanity Test?
  5. What did you decide and what was the next action to the outcome of the Smoke Test and Sanity Test?
  6. What was the need if you carried out Smoke Test and Sanity Test as a different testing activities?
    • How this is helping you and your stakeholders?
  7. What will you lose if you do not perform either the Smoke Test or the Sanity Test?
    • What is the cost of doing so?
  8. What is your understanding of the Smoke Test?
    • How did you establish this understanding?
    • Any update to this understanding of yours?
    • What is the coverage expected out of the Smoke Test?
  9. What is your understanding of the Sanity Test?
    • How did you establish this understanding?
    • Any update to this understanding of yours?
    • What is the coverage expected out of the Sanity Test?
  10. Do software engineers, software companies and practitioners, and engineering teams use these terms as you use?
I learn the word "Smoke Test" comes from the hardware testing context.  Then from where did the word "Sanity Test" come from?  I don't know!  

Further, I understand that the intent of these two words is the same.  That is, to have confidence in either continuing to use the build for further tests or not to use that particular build to test.


Scope and Coverage of Smoke and Sanity Tests


What comes in the scope of the "Smoke Test" or "Sanity Test" is again the question and confusion that is being carried and passed on to the generation of Software Test Engineers.  Could be this is creating a gap in understanding what it is.

Often, I have seen the scope and coverage expected out of the Smoke Test and Sanity Test are the same.  Just these two words, the Smoke Test and Sanity Test are being used interchangeably in the Software Engineering community and practice.

I could not differentiate and identify the uniqueness among them to date in my experience.  All I see is the words "test" and "testing" associate very well with any word you bring into a context. Later, everyone will define their own idea and words to it.  

If observed, the same does not happen in the other areas of software engineering.  Why?  I learn that we have kept Software Testing to be far from being technical.  This is one of the major setback reasons.



Software Testing is Technical


When I say technical, the programming is treated and accepted as technical; the DevOps is considered technical; the database administration is taken as technical.  But the software testing which overlaps with all of these engineering areas is not considered technical.

I started my software testing career in the waterfall practice days.  At times, the testing and programming teams were independent and did not interact at all. The business and project management team which got the requirement did not have interaction with testing unless for asking "can you sign off saying this be shipped.".

Today, I see the mindset of accepting software testing is technical.  In my career, over the last 7 years, I see the industry is slowly including software testing to tech excellence.  But it is yet to get its one common standards and glossary which will be used by all practitioners.

However, I see the software industry and communities yet to accept and acknowledge that people and context dynamics are also the propellers of Software Testing while it is technical.



A Solution to the Problem


When a subject and practice are considered technical, the ideas and how it is defined will also be taken seriously.  There will be no casual language when communicating the subject, work and practice.  

When I say technical, I mean it in the context of Software Engineering.  How we perceive what is technical in Software Engineering, I mean that.

I wish, this comes to Software Testing and possibly put an end to the casually used language and words.


Friday, April 1, 2022

WebDriver: Clarifying the Confusion on Why and What is the WebDriver - Part 1

 

I had a question "What is WebDriver and why should I use it to automate on a browser?"  I tried to understand it and relate its presence in code written using Selenium.  I see this question in the test engineers who are starting the practice of automation on browsers. 

And, most of us get confused with WebDriver, WebDriverManager, and WebdriverIO.  All of these are not the same but all these work around the same space that is automation on the web and mobile.

Between, I learn understanding of WebDriver is fundamental to the practice of automation on web browsers. The same idea is taken to the automation of mobile apps using Appium. 

I'm sharing this learning of me as a part of 21Days21Tips the initiative from The Test Chat community.  The tip here is to assist by providing clarity around the WebDriver and why we use it in automation on a browser.


What is WebDriver?

The WebDriver is part of the Selenium library and we use it every time when we are trying to do any interaction with and upon a browser.  It is also a language binding and helps to write the browser controlling code.  For example, if I pick Selenium's Java WebDriver,

  • it provides the APIs that I consume to control the actions on the web page displayed on a browser
  • likewise, if I pick Selenium's Python WebDriver it provides me the APIs that I consume to automate my actions on a browser
    • I code here using Python
That said, the WebDriver is a set of APIs and to be precise it is an object-oriented API adhering to the W3C standards.  As a result, the WebDriver drives the browsers effectively today as all popular browsers to the W3C standards.  The HTTP is used as the transport protocol.


Understanding the WebDriver

On a higher level, this is what WebDrier does:

  1. The tests we write make use of WebDriver API 
  2. This WebDriver API carries the commands (written in the test) to interact with the browser's driver
  3. On receiving the commands, the browser's driver and the browser will have native communication, where the driver will translate the commands to the browser to emulate the action on a browser.
  4. The browser returns the response to its driver
  5. The browser's driver will transfer information to the WebDriver
  6. Then, WebDriver shows the information to a user who is running the test
Examples of browser's driver are:
  • chromedriver of Chrome
  • geckodriver of Firefox


Representation of Selenium WebDriver's Communication


The instructions (commands) that I pass via WebDriver's object are translated to stateless information.  That is, there is no state maintained between the client and the browser's driver.



Representation of Selenium's WebDriver SPI & Browser Interaction

When the code enters into Stateless Programming Interface (SPI), it is called into a process that breaks down what the element is, by using the unique identification and then calling the command.  For example, let us look into the below statements to understand what the code looks like at SPI:


Code written using WebDriver API:

WebElement greetBox = driver.findElement(By.id("greeting_textbox"));
greetBox.sendKeys("Welcome to Testing Garage's Blog");

 SPI:

findElement(using="id", value="greeting_textbox")
sendKeys(element="greetBox", value="Welcome to Testing Garage's Blog");


Note: The findElement and sendKeys are the commands provided by Selenium's WebDriver API to find the web element on the web page and enter the text into the web element. The browser's driver receives these commands and data, then emulates the command (a user action) on the browser, and carries back the response to WebDriver.


21 Days 21 Tips -- #day13

Here are my pointers to fellow test engineers who are confused about WebDriver
  1. WebDriverManager and WebdriverIO are not WebDriver
    • But all of these are around automation of the web and mobile
  2. WebDriver interface helps in
    1. Control of the browser
    2. Identification and selection of web elements on the web page
    3. Provides assistance to debug
  3. Browser Level API
    1. driver.manage().window().maximize();
    2. driver.get("https://testingGarage.blogspot.com");
    3. driver.navigate().back();
    4. driver.navigate().forward();
    5. driver.getWindowHandle();
    6. driver.getWindowHandles();
  4. Few Page Level API
    1. driver.findElement(By by)
    2. driver.findElements(By by)
    3. driver.getCurrentURL();
    4. driver.getTitle();
    5. driver.getPageSource();
  5. If you notice, we use these APIs to automate the browser
    • The tests we write use these APIs of Selenium WebDriver along with the assertion
  6. Why are we using "driver" in the above commands?
    • This is another question and confusion among fellow test engineers starting to practice automation
    • I will share this in the next tip :)
This understanding of WebDriver, and the why and how it is instantiated (in the next post) will help you to be comfortable in starting to read the test code written using Selenium.



Saturday, March 19, 2022

Time to Update the 101s for Test Engineers

 
The thought I'm sharing in this post is growing stronger in me, in recent years. I shared it as points with the community in the #21Days21Tips initiative from The Test Chat.  I post it on my blog as well so that it will be a reminder to me when I scroll through my posts.


The 101s for Test Engineers

Today, the first few stepping lessons of Testing and Automation to be on -- "How to Overcome the Fear of Failure".  If this is not available in the team and organization, it is time to start and build it.  The present and future Test Engineers need it.

The starting lessons or 101 of the Testing and Automation need not necessarily be:

  • What are Testing and Automation?
  • Test Design and Techniques
  • Programming Language
  • Tech Stack, Full Stack
  • Clean Code
  • Design Patterns
  • Tools
  • What should I pick; how & where to start here?

All these will connect and align when one can handle self-doubts and fear of failure.


Approach Goals and Avoidance Goals

As a team, organization and mentor, help your Test Engineers to have "Approach Goals" than letting them build "Avoidance Goals" out of fear.  I see practicing the Approach Goals is a life skill, today.

I take the below lines from this post:

Approach Goals are those with positive outcomes that we work towards.  Positive can mean different things in different contexts, such as liked, desirable, pleasurable, or beneficial.

Avoidance Goals are those with negative outcomes that we work to avoid. Negative can mean different things, including disliked, undesirable, painful, or harmful.

Examples:

  • Approach Goals
    • Know why I have those fears when I think of automation?
    • I need to be skilled in automation. How can I manage my fears and proceed with practicing automation?
    • I need to do better testing with help of automation. What I should practice for doing this? What help I will need?
  • Avoidance Goals
    • I will start practicing automation next month
    • I will start automation once I understand and write good code
    • I will start automation once I understand Design Patterns and Clean Code
    • I will start automation once I learn how to write a framework
    • I need to do it well; let me learn the basics very well first and then let me do automation
    • I will check for workshops and people who can help me to do automation

Approach Goal: I will start it! No matter how small it is, I will start. I will keep updating as I learn. I start it from here -- Automate a browser to launch and open a new tab.

Frame the Approach Goal that helps to take one ahead by dealing with the fear.  The goal needs to make sure the milestones of learning are highlighted to one.  That way, one feels confident and has clarity along with skills of learning better be it what is new or what one is aware of.

Note: If the question is why I talk of automation in the examples of Approach Goals and Avoidance Goals, this is what we hear from the majority of Test Engineers today.


My Experience

When the Test Engineers know to build and use the Approach Goals, they will align and practice better on subjects:

  • With which Test Engineers are unfamiliar
  • With which Test Engineers are uncomfortable

Also, help the Test Engineers to build skills to spot Avoidance Goals.  So that, they are aware of the Avoidance Goals they tend to have and construct positive Approach Goals to learn new skills and solve the problems.




Thursday, March 10, 2022

Understanding - Are Framework and Library the Same?


We Have This Question

  • What is a Framework?
  • What is a Library?  

I had these questions when I started my testing career.  At times, I ask this question today as well, when I listen to fellow engineers talk about it.  

I can say firmly that you had these questions.  You would have asked these questions to yourself or to your fellow testers.


Using Interchangeably

In the teams in which I have worked and in the community, I have seen these two terms are used interchangeably.  This has added to the confusion.  At times you might see the programmers using these two words interchangeably; but, they might know what it does and how to use it.

If I were to start my automation practice, to what should I call framework and library?  Does this question have crossed your mind and thoughts?


Framework and Library - What it is?

I understand both Framework and Library as code.  Yes, both are programming code that is structured and organized in a way.  This code is written by a programmer and will be consumed by other programmers and testers.  

Why do we use it?  We use it to assist in solving a problem we have in our work.  May be is what leads one to get confused or use these words interchangeably.  But are they one and the same?  I had this question.  I spoke to programmers and testers with whom I worked.  I observe each of them having their own ideas and perspectives about it.  

But are they one and the same?  As of today, I understand Framework and Library are not the same. It differs in -- the ease of consumption as is and the code to be written and organized for using it.  I see these two factors differentiate Framework and Library; there could be more factors and I'm not aware of it.


Framework and Library - My Experiences


I use libraries in testing and automation I do.  For example, 
  • the Selenium library to interact with the browser and perform the actions on the web pages
  • the RestAssured library to build the HTTP request
  • the Appium library to interact with the mobile OS and its app's UI

I shared the above examples as most of us are aware of them and relate to them in our work.  Then, what is the framework?  

Have we heard of these words -- React, Angular, Bootstrap, and Flutter?  Today we use them to build web apps and mobile apps (using Flutter).  These are frameworks consumed by programmers to build the applications.  Some of these frameworks provide libraries to test as well.  For example, Chai and Jest assertion libraries.

Trying to understand further, one of my programming friends said me about the principle -- Inversion of Control.  Inversion of Control allows a framework to inject dependencies, inject configuration and manage lifecycle. That way programmer's program can focus on what it must do and not have to worry about any additional responsibilities.

I learn, Inversion of Control refers to transferring the control of objects and their dependencies from the main program to a container or framework.  How this will be implemented depends on the programmer and the design used to implement the same.

Note: In one of the perspectives I learn the framework provides the abstraction to its libraries.  We use these abstractions of a framework and develop our applications.  Can I say framework means abstraction?



Difference: Framework and Library


In the way we communicate, most times it is communicated as there is no difference between them and both mean the same.  Probably this is the reason we have the confusion, especially the Test Engineers who want to start the practice of automation will have this confusion.  This is being passed on to the next generation of Test Engineers who come take up Software Testing as a career.

Technically, the difference exists between the Framework and Library.  One of the key differences lies in the principle mentioned above -- Inversion of Control.  Let me walk through this with a use case that we Test Engineers cross every day.


Use Case in using a Library: Automating a user action on a web page

  • I make use of the Selenium library
  • I initialize the WebDriver and a driver of a browser
  • I open a browser on my machine using WebDriver communicating with the browser's driver
  • I talk to the browser to launch a URL
  • I make actions on the web page

I'm not writing a code to do all of the above said.  I'm making use of APIs exposed by the Selenium library to do all of these actions.  The library's code handles all these for me.  My code will be for -- to consume Selenium's API and to aid evaluation of business logic -- the Utils is a commonly used word to describe the Class which has methods for the same.  

When I'm using a library, I have control over the code that I write in automation in deciding how the automation should execute that is in what order and what flow.  I can decide when to make what actions on the web page here.  The Selenium library does not mandate it on me.  

The only mandate I see is the sequence of actions that has to be made when using a particular API.  For example, the action events to be made in what order when used the Touch Actions API.


Use Case in using a Framework: Building a web and mobile app

  • The team developing Android and iOS mobile apps using Flutter
  • The team developing a web using Flutter or React

Just by using the Flutter and React frameworks, the apps and website will not be ready.  The programmer follows the structure and sequence insisted by the framework in her/his code.  The framework will tell how the code should be written and probably this also means the flow of code is controlled by Framework.  For example, when loading the content on the web page and screen.

In one of my current projects, the place where the message is displayed, how it is displayed, and how to interact with it, is a flow in code.  The programmer has to work oblige how the framework parses the error message.  It has to be done that way unless the programmer writes a custom code and plugs it into the framework, provided the framework supports it.  

This code which the programmer plugs in now, it is a custom library developed to use with a being used framework.  Now using this custom-built library, the reading or/and display of error messages can be made as per the need of the product.



Automation: Do We Write Library or Framework?


When we testers say automation framework, I see that we are referring to the structured library we have written consuming a framework and library.  For example, Arjuna developed by Rahul Verma is a framework.  I will consume Arjuna and build a library that has tests to automate web applications using the library as Selenium.

The automation I write consuming a framework and/or a library will have methods. Few of these methods will be written once and can be used in multiple places.  That is no repeating code and practicing the reuse of code.  It is like DRY -- Do Not Repeat Yourself.  We can see this practice in the automation we write.

For example, the below code can be written once in a class and invoked in different places where we test the business logic.  Now, these two methods will act as a library code and it is also part of a library code.  




We just call the method name and pass the parameters in different classes where it is needed.  No need to implement these methods each time in business logic where it is needed.  

Doesn't this give a perspective that a framework includes a library within it?  And, this questions me --  should I call automation what I do as an Automation Framework?  I say NO!  Unless someone uses my work as a foundation to build their tests and it dictates how the code should be written and structured, I do not call it a framework.  

But, one can use the classes that I write in their work.  This class act as a library.  Recall the class file name with Utils; this file has methods that we use by invoking it across the package.  One good example of this is, the logging part we write in our automation.  This logging part of code can be built as a library and can be used in different automation projects in which we work.

This is my understanding of Library and Framework at this point in time.  You have any questions or other perspectives that I'm not seeing, do share.