Software Quality Assurance
Tuesday, February 25, 2025
Thursday, May 9, 2024
Jmeter to Grafana dashboard using core influx DB back end listener.
Important things.
1). Make sure to set influxdbToken at the jmeter influx DB back end listener
Get the token:
2). URL need to be have below format:
http://localhost:8086/api/v2/write?org=cja&bucket=jtest
- Highlighted Properties must available to view transactions at the Grafana dashboard.
- Set summary Only to True to get transaction level details at Grafana.
3). Make sure to import valid Grafana template.
Because only dashboard ID 5496 was using core influx DB back end listener.
4). Make sure to set "Authorization" header "Token <ur token>" at grafana data source configuration.
5). Also set the correct database name. Its the bucket name at InfluxDB

Monday, April 8, 2024
Fix - javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification
Download the certificate from the web browser and install it using keytools.
Click on "Connection is secure"
Click on export and save it to your hard disk
Open CMD and type below command.
keytool -import -alias ANY_NAME_YOU_WANT_TO_GIVE -file PATH_TO_YOUR_CERTIFICATE -keystore PATH_OF_JAVA_KEYSTORE
PATH_OF_JAVA_KEYSTORE - file will be available at C:\Program Files\Amazon Corretto\jdk11.0.20_9\lib\security
If the keytools are not recognize as a valid command, add java/bin folder to your system environment variable paths.
Sunday, March 24, 2024
How to execute selenium test in Github Actions
Create a simple Maven TestNG Selenium project as below.
System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
driver = new ChromeDriver(chromeOptions);
driver.get("https://www.xxxx.com/playlists");
WebElement element = driver.findElement(By.xpath("(//*[@class='yt-simple-endpoint style-scope ytd-playlist-thumbnail'])[4]"));
element.click();
driver.quit();
Make sure to give a correct web driver path when you are testing the code in our local environment.
We will change it when we deploy it to GitHub actions.
Now push your code GitHub and enable actions from the project settings section.
There will be a new yml file available as for the below screen shot.
In adition to default content I have to add
- Chrome driver
- Chrome web browser
This is the code to download above from the yml file.
# Download Chrome version 114.0.5735.90
- name: Download ChromeDriver
run: |
# Download Chrome version 114.0.5735.90
wget -q "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.90-1_amd64.deb" -O chrome.deb
# Install Chrome
sudo dpkg -i chrome.deb
# Install dependencies
sudo apt-get install -f
# Clean up
rm chrome.deb
LATEST_CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE")
wget "https://chromedriver.storage.googleapis.com/${LATEST_CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -P ~/
unzip ~/chromedriver_linux64.zip -d ~/ && rm ~/chromedriver_linux64.zip
sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
sudo chmod +x /usr/local/bin/chromedriver
Then add below code to execute the test.
- name: Build with Maven
run: mvn clean install -B
You can find the full code with copying screen shots at https://github.com/chathurahjm/gitActionWIthScreenShots
Friday, March 1, 2024
How to execute custome jar file in JMeter
1). Create your jar file using Eclipse.
2). Because Eclipse will allow you to convert a single java method (without any main method) to a jar file.
- Package name : tempDBUpdate
- Class name : update
- Method name : updatedb
All my libraries are inside reference Libraries folder.
3). Convert to a jar file by right-click on your project → select Export → Select JAR file under java folder.
5). From open JMeter and add a JSR223 Sampler
6). Set language as groovy
7). Import the jar file as for the line number 1.
8). Create an object of the class as for the line 3.
9). Call the method.
Dont use Main method to call in J Meter as it will give errors and it will not call the actual Main method implementations.
Don't use IntelliJ to cremate jar files as IntelliJ only allow Main method to convert to jar file.
Monday, February 19, 2024
How to re execute failed Selenium / Playwright Java testcases with the help of TestNG
- Create a new class with any name at the test project.
- With this class we are going to implement the IRetryAnalyzer class which is available with TestNG
- Here is the sample working implementation.
import com.novatti.common.Constants;
import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;
public class RetryAnalyzer implements IRetryAnalyzer {
private static int maxTry = 3;
private int count = 0;
@Override
public boolean retry(ITestResult iTestResult) {
System.out.println("------------------------ Retrying test: " + iTestResult.getName());
if (!Constants.IS_RETRY) maxTry = 0;
if (!iTestResult.isSuccess()) {
if (count < maxTry) {
count++;
iTestResult.setStatus(ITestResult.FAILURE);
return true;
} else {
iTestResult.setStatus(ITestResult.FAILURE);
}
} else {
iTestResult.setStatus(ITestResult.SUCCESS);
}
return false;
}
}
Or we can manually update each test method which is not the best approach.
import com.novatti.utils.RetryAnalyzer;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.testng.IAnnotationTransformer;
import org.testng.annotations.ITestAnnotation;
public class TestNGRetryListener implements IAnnotationTransformer {
@Override
public void transform(
ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
annotation.setRetryAnalyzer(RetryAnalyzer.class);
}
}
DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="UI Test Suite">
<listeners>
<listener class-name="com.XXXXXX.listeners.TestNGRetryListener"/>
</listeners>
<test verbose="1" preserve-order="false" name="UI Tests">
<classes>
<class name="com.xxx.tests.XXXXX"/>
<class name="com.xx.tests.XXXXXXXX"/>
<class name="com.xx.tests.XXXXXX"/>
</classes>
</test>
</suite>
private static int maxTry = 3;
I'm with Test NG version 7.9.0
Thursday, April 20, 2023
How to wait till page load selenium Java.
public void waitTillDocumentStateReady()
{
LocalDateTime now = LocalDateTime.now();
while (LocalDateTime.now().isBefore(now.plusSeconds(20))) {
while (!((JavascriptExecutor) driver.getDriver()).executeScript("return document.readyState").equals("complete")) {
driver.sleep(1);
}
}
}