Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Tuesday, December 27, 2022

SeleniumUtil is an open source library to help make Selenium+Java automation easier and faster

I’ve been through two tech companies where they’ve had their own test automation frameworks. The last framework that I used was built to handle Web UI, API, and AS400. The framework was built by providing wrappers for common open-source automation components such as Selenium and Rest-assured. It was easy to set up an automation project using the framework, and only a few of us had any real concerns with it. It was the responsibility of the respective development teams to use the framework to automate their products based on a few loose programming guidelines. As the teams go through this exercise, they would build any custom components they might need as they see fit. Some of these components are universally used but were not available in the framework of the respective open-source components OOTB. Components such abstractions for working with HTML tables or custom ExpectedConditions. 


When I had some time on my hand I looked around to see if there are any open-source libraries that I can use out there to cut the automation project setup time and I found that there isn’t a lightweight library that can be easily integrated to existing projects. So I started one of my own.


At the moment the library provides a few wrappers for HTML elements such as RadioButton, MultiSelect, and Table. The plan is to implement other useful features such, Wrappers for common JavaScript script snippets, custom ExpectedConditions, and sliders. The library is at version 0.6.5 and it's available on Maven Central[1]. If you’re interested in contributing to the project please follow the instructions here [2][3].


[1] - https://search.maven.org/artifact/io.github.handakumbura/Seleniumutil/0.6.5/jar

[2] - https://docs.google.com/document/d/1Diudxs53eL8QkfYwHpExkusEtpJxF0mDHVrr6XymXYE/edit?usp=sharing

[3] - https://github.com/handakumbura/Seleniumuntil


 

 




Tuesday, October 6, 2015

Java Regex


Putting this up for my own reference more than any other reason. Java Regex are useful in manipulation strings. A regex consist of pattern blocks and optional quantifiers.


Pattern Blocks


some patterns are built in to java,

\d - digit
\w – word character
\s – whitespace

if a range of characters need to be used as a pattern it should be put as follows,

[a-z] – a to z simple
[a-zA-Z] - a to z capital and simple
[1-9] – 1 to 9

Quantifiers


these add meaning to the patterns. They should be added immediately after the pattern.

* - match pattern 0 or more times
+ - match pattern 1 or more times
{n} - match pattern exactly n times
{n,m} – match pattern between n to m times


Regex Examples


[a-zA-Z]* - a to z capital and simple 0 or more times
[a-zA-Z]+ - a to z capital and simple 1 or more times
\d{2,5} – digits 2 to 5 times
[.]*[a-zA-Z]{1,5} - . 0 or more times in the beginning followed by a to z capital and simple 1 to 5 time, the whole pattern once. 

What's in my Bag? EDC of a Tester