Friday, March 25, 2022

How to handle Select certificate popup from Chrome using Selenium WebDriver?

For one of the applications, when I run some Selenium WebDriver tests. I see a Select a certificate popup. I am not able to handle this, and hence my test fails. 

Has anyone been able to handle this popup, or rather, avoid this popup being shown?


If I manually select a certificate and click OK, I am prompted for my mac credentials:


Thanks in advance!

Tuesday, March 22, 2022

Ways to implement fakesms service / otp validation in Functional Test Automation

I had asked a question in my earlier blog post about 

How do you automate OTP related test scenarios? Do you use a fake SMS service? Does it have restapi to query the SMS messages? geography support? 

A lot of people replied to it directly on the post, or via twitter and LinkedIn. I thank them all for their responses and suggestions!
 
In addition, if anyone needs to test email flows, getnada.com is a great way you can automate and validate emails. They have rest apis for the same.
 
These solutions will allow you to automate seemingly difficult to automate functionality, WITHOUT having to create "testing-hooks" in your product. Hence, you will be able to test the code that will be shipped to Production, which is very important!

Hope this helps others who may be looking for similar things.

Friday, February 25, 2022

Evolving TDD

I had posted an update to my earlier blog post about TDD & its variations. Well, not surprisingly, I have encountered some more variations of this amazing practice. Here is the updated list with the new additions called out.

ATDD = Anti-Trust Driven Development
BDD = Benefit Driven Development
CDD = Cribbing Driven Development
CDD = Control Driven Development
IDD = Indifference Driven Development
ODD = Optimism Driven Development
PDD = Punishment Driven Development
RDD = Reporting Driven Development
SDD = Slide(s) Driven Development
SDD = Short-cut Driven Development

A few variants kindly shared by the community members:
FDD = Food Driven Development
SGDD = Style Guide Driven Development
http://styleguidedrivendevelopment.net/

To recap, here is the original list
ATDD = Acceptance Test Driven Development
BDD = Behavior / Business Driven Development
BDD = Blame Driven Development
BDD = Buzzword Driven Development
CDD = Complexity Driven Development
CDD = Calendar Driven Development
CDD = Checklist Driven Development
CDD = Chadi (stick) Driven Development
CDD = Constraint Driven Development
CPDD / CDD = Copy-Paste Driven Development
DDD = Demo Driven Development
DDD = Date Driven Development
DDD = Defect Driven Development
DDD = Document (PRD) Driven Development
EDD = Escalation Driven Development
EDD = Estimation Driven Development
EDD = Excel Driven Development
FDD = Fake-it Driven Development
FDD = Fashion Driven Development
FDD = Fear Driven Development
FDD = Footwear (punishment) Driven Development
HDD = Hope Driven Development (fingers crossed)
IDD = Instinct Driven Development
IDD = Issue Driven Development
JDD = Jira Driven Development
MDD = Metrics Driven Development
MDD = Manager / Management Driven Development
MDD = Mandate Driven Development
MDD = Meeting Driven Development
NDD = No-Drive (towards) Development
PDD = Patch(work) Driven Development
PDD = Plan Driven Development
PDD = Prayer Driven Development
PDD = Process Driven Development
PDD = Profanity Driven Development
RDD = Resource Driven Development
RDD = Resume Driven Development
SDD = Stackoverflow Driven Development
SDD = Stakeholder Driven Development
SDD = Swallow-exceptions Driven Development
SDD = Sprint Driven Development
TDD = Trust Driven Development
VDD = Velocity Driven Development

Monday, February 21, 2022

Why not to use PageFactory and FindsBy in Selenium WebDriver

Many users of Selenium WebDriver may be using the PageFactory created by Simon Stewart. However, it is not a good idea to use it.

You may be thinking why should I not use it? It is so easy to use it, and its popular.

Well, here are 2 reasons why you should not use the PageFactory:

Reason #1. Simon Stewart (https://twitter.com/shs96c), the creator of WebDriver, and the PageFactory himself says, do not use it. It is not recommended.

The `FindsBy` annotation isn't recommended, because the PageFactory class is really badly implemented and inflexible, but it's not going away in the java bindings.

The `FindsByX` interfaces are going away. Better to use a `By` locator and use that.


PageFactory is really badly implemented
 

https://twitter.com/shs96c/status/1196865907185868801


Reason #2: While Reason #1 should have been sufficient, many people implementing automation using Selenium WebDriver do not know, or did not pay heed to what Simon said. So another WebDriver & WATIR contributor, Titus Fortner (https://twitter.com/titusfortner) explained in detail why using PageFactory is not a good idea in his blog post - https://titusfortner.com/2021/02/03/page-factory-optimization.html

 

I sincerely hope these reasons are sufficient for you to move away from the PageFactory and use something more efficient. 

 

Friday, January 28, 2022

Switching jdk versions on mac, easily!

I have struggled many times to switch between different JDK versions quickly. There always seemed to be many steps required to be done.

Ever since I started using openjdk, and then focussing on doing my machine setup via a script (as opposed to doing each step manually), I came across this very simple way of switching the jdk.

https://github.com/AdoptOpenJDK/homebrew-openjdk#switch-between-different-jdk-versions