Software Engineering

Details:
Our customer wants complete test automation including test data generation for a chatbot. The test data will probably be provided to us via RestApi. Since we have not completed this area yet,
Questions:

What should we pay attention to here? Are there any differences to other test automation solutions?
Is the test via RestAPI sufficient? Or should the functional test also be in the foreground?
Are there sandboxes that could be used?
Are there guidelines that should be implemented?

I have a strange behavior : I created Test Class with 2 Test Methods as below.
When I call AddLimitedBuyOrderwithRandom in the first method it works fine without any exception, but if I call AddLimitedBuyOrderwithRandom from the second method I get a NoSuchElement exception.
This is the code for the test class:
public class TestLoginPage extends TestBase {
public HomePage homeobject;
public NewOrdersLoginPage OrderLoginObject;
public OrderMgmtPage OrdersMgmentObject;

@Test
public void SuccessLogin() throws InterruptedException
{
homeobject = new HomePage(driver);
homeobject.OpenOrdersPage();
OrderLoginObject = new NewOrdersLoginPage(driver);
OrderLoginObject.userLogin(“140”, “12345”);
OrdersMgmentObject = new OrderMgmtPage(driver);
OrdersMgmentObject.AddLimitedBuyOrderwithRandom(“10”);
}

@Test(enabled= true)
public void AddLimitOrderTest() throws InterruptedException
{
OrdersMgmentObject = new OrderMgmtPage(driver);
OrdersMgmentObject.AddLimitedBuyOrderwithRandom(“10”);
}
}

and this is the code for AddLimitedBuyOrderwithRandom:
public void AddLimitedBuyOrderwithRandom(String SharesCount) throws InterruptedException
{
clickButton(NewOrderLink);
clickButton(BuyTypeRadio);
selectDropdownByValue( companyList, “Company”);
typeText(ShareNoTxt, SharesCount);
selectDropdownByValue( OrderTypeList, “2”);
selectDropdownByValue( OrderValidityList, “0”);
double Pricerandom = getRandomNumberInRange(ReturnShareLimitDown(),ReturnShareLimitUp());
typeText(SharePriceTxt,Double.toString(Pricerandom));
clickButton(SubmitOrderBtn);
}

(Added from comments on answers)
My base class is:
public class TestBase
{
public static WebDriver driver ;
public static String downloadPath = System.getProperty(“user.dir”) + “\Downloads”;
public String BaseURL = “URL”;

@BeforeSuite
@Parameters({“browser”})
public void startDriver(@Optional (“chrome”) String browserType)
{
if (browserType.equalsIgnoreCase(“chrome”) )
{
System.setProperty(“webdriver.chrome.driver”, System.getProperty(“user.dir”)+”/drivers/chromedriver.exe”);
driver = new ChromeDriver();
}
}

driver.manage().window().maximize();
driver.navigate().to(BaseURL);
}

Using Selenium + chromedriver on Linux, like so;

chrome_options = Options()
driver = webdriver.Chrome(‘/usr/bin/chromedriver’,options=chrome_options)
driver.get(‘https://www.somewebsite.com’)

Chrome will start and will receive immediate focus (most of the time, sometimes it does not).

One can easily click outside of the Chrome window and continue working elsewhere, it will not affect Selenium/Chromedriver at all.

However, if one was typing something then the text will now be entered in the just-focused browser window. When starting many windows in sequence, this is cumbersome (keep loosing focus).

How to avoid the just-started Chrome window from receiving focus in the first place?

(Coding language used is Python)

How do you ensure your passing tests(UI automated) actually pass?
As automation engineer I think we should question our passing tests in the same spirit as we dig in our failing tests to find out reasons to fail, at least periodically.
In long standing large automation suites, there are times where a passing test has not been questioned in long time as it was always ‘passing’ until a direct bug in that area surfaces.
Please share your approach used in actual large projects to test the tests? Preferably through automation.

(I am a bit of a StackOverflow newbie, so please forgive any beginner mistakes and let me know what to improve in the future)
I am trying to select the highlighted button in the appended picture.
Problem:

There are many buttons of this kind all using the same description and XPath. So as far as I can tell there is no way of telling them apart by their cssSelector or XPath

Possible solution:

The h2 above the button contains a differentiable description of the button I need to select. So can I basically navigate to said h2 and then select the specific button belonging to it?
-> How to code it?
Are there easier ways to do this?

So far I know basic element selection as seen in this code sample:
WebElement loginElement = driver.findElement(By.xpath(“//*[@id=’login-submitBtn’]”));
loginElement.click();

Test Guild – Automation Testing Tools Community
Strategic Test Environment Setup For Automation Success
Understanding the importance of test environment setup Test environment setup is crucial for successful test automation. It involves preparing a controlled environment where you can run your tests accurately. A well-structured test environment ensures that your automation tests are reliable and provide meaningful results. Here are a few reasons why test environment setup is essential:
You’re reading Strategic Test Environment Setup For Automation Success, originally posted on Test Guild – Automation Testing Tools Community – and copyrighted by Joe Colantonio

I am working on PhantomJS with Java for one of my project. I am looking for some help in working with PhantomJS in following scenario.
Scenario:
Step-1: Mouse hover on tab/link then 2 sub-links will display
Step-2: Click on 2nd sub-link (This element is not visible if width is less than 992)
Here in Step-2, I am failing due to page is not displaying the element. I have tried following ways to resolve:

Added wait statement before clicking (Explicit wait -> wait until element clickable)

Note: Script getting failed in this step due to element is not clickable.

Set the custom window size (1920 X 1080)

Note: Here my query is when I used driver.window.maximize(), I am getting window size as “1366 X 768”. So I am not sure whether it will work if I set the window size as “1920 X 1080”.

Please share your experiences or idea’s to resolve this issue. Your help/suggestions are very helpful to me

NOTE: I am facing this issue only PhanjomJS browser only in remaining all browsers are working fine

Floods are devastating, causing significant damage globally. Generative AI enhances flood insurance by improving predictive accuracy, risk assessment, and claims processing. It utilizes pre-trained models to evaluate diverse scenarios, offering more accurate risk insights and customer-centric policies. The blog discusses how AI-driven tools enable insurers to model risks efficiently, set fair premiums, and respond to real-time events. Explore how generative AI transforms flood insurance and how Tx can support its integration for superior risk management.
The post Enhancing Flood Insurance Models with Generative AI: A Deep Dive first appeared on TestingXperts.

I am using Robot Framework and Selenium and have a drop down combo element that I need to focus on and tab off in order to fire a validation message. I cannot use Press Keys or Click Element as it will invoke the list and I cannot use Mouse Over since the only argument is location. Does anyone have suggestions to handle this scenario?

I’m trying to learn to create a pipeline in Gitlab. All my tests fail because of the compilation issue. My code is included below along with the error message.
import loginPage from “../PageObjects/loginPage”;

fixture(‘Login Tests’)
.page(‘https://www.saucedemo.com/’);

test(‘User Login to the website’, async (t) => {
await loginPage.loginWebsite(‘performance_glitch_user’,’secret_sauce’);
});

import { Selector, t } from “testcafe”;

class loginPage{
userName: Selector;
password: Selector;
loginBtn: Selector;
pageName: Selector;

constructor(){
this.userName = Selector(‘#user-name’);
this.password = Selector(‘#password’);
this.loginBtn = Selector(‘#login-button’);
this.pageName = Selector(‘.title’);
}

async loginWebsite(username, password){
await t
.typeText(this.userName, username)
.typeText(this.password, password)
.click(this.loginBtn)
.expect(Selector(this.pageName).innerText).eql(‘Products’);
}
}

export default new loginPage;

package.json
{
“name”: “testcafeproj”,
“version”: “1.0.0”,
“description”: “Assignment”,
“main”: “index.js”,
“scripts”: {
“test”: “testcafe chrome tests/**/*”,
“test2”: “testcafe edge tests/**/*”,
“test:chrome:headless”: “testcafe chrome:headless tests/**/*”,
“test:chrome:reports”: “testcafe chrome tests/* –reporter html:reports/report.html”,
“test:chrome:reports:ss”: “testcafe chrome tests/*.ts -s takeOnFails=true –reporter html:reports/report.html”
},
“author”: “test”,
“license”: “ISC”,
“devDependencies”: {
“faker”: “^5.5.3”,
“faker-js”: “^1.0.0”,
“testcafe”: “^2.4.0”,
“typescript”: “^4.9.5”
},
“dependencies”: {
“@faker-js/faker”: “^7.6.0”,
“testcafe-reporter-html”: “^1.4.6”
}
}

.gitlab-ci.yml
stages:
– test

test_job:
image: cypress/browsers:node18.12.0-chrome107
stage: test
script:
– npm ci
– npm run test:chrome:headless

This is the error message in CI

Serverless architecture is changing business operations in 2024 by offering scalability and reducing IT overhead. This technology allows companies to focus on innovation without the burden of managing servers, facilitating rapid development and deployment. With serverless models like FaaS, BaaS, PaaS, and IaaS, businesses can handle increased demands effortlessly. This blog explores the transformative potential of serverless architecture, including its top use cases and benefits. It addresses security with comprehensive testing and compliance strategies, ensuring robust protection for your serverless applications.
The post Ways Serverless Architecture is Transforming Businesses first appeared on TestingXperts.

I’m using StringUtils from the Apache commons library to check the # of matches of a sub-string within the source code of an HTML page.
I have converted the page source using the WebDriver command:
String pageSource = driver.getPageSource();

The code I’m using to find # of matches is:
int cloudfCount = StringUtils.countMatches(pageSource, “cloudfront”);
System.out.println(“There are ” + cloudfCount + ” instances of cloudf text found within the page source.”);

When I right-click within the page, view source, then Ctrl-F to find CloudFront, I get 2 matches. Which is what I’m expecting.
But when I use the above code in an automated Selenium script, I’m getting 5 results.
Any thoughts/ideas on where I’m going wrong?
Could it somehow be related to the fact, that the CloudFront text is part of 2 JavaScript tags within the page source?

Continuing on from BDD Feature Files guidelines
Say I have 10 feature files testing user actions 1-10, 1-Fund transferring, 2-Display balance, 3-etc
feature files:
In ‘Fund transferring’, login, navigate to fund transfers, transfer test.
In ‘Display balance’, login, navigate to balanes, verify balances.
etc
What is the best way to structure these to have login as a pre-req so as not to need logging in each time?
In ‘login’, login successfully. If passed:

In ‘Fund transferring’, navigate to fund transfers, transfer test.

In ‘Display balance’, navigate to balanes, verify balances.

etc

I’m using LDTP to write a GUI test case script in python. I’m running the script in a virtual machine by nosetests.

And I get a block with the error of unable to find window X, while window X is absolutely displayed on the monitor. This error always occurs after LDTP actions.

Example:

After I open my subscription manager in the virtual machine (rhel6.8), I could find the subscription manager by calling getwindowlist():

>>> getwindowlist()
[‘frmTopExpandedEdgePanel’, ‘frmBottomExpandedEdgePanel’, ‘frmroot@localhost:~’,
‘frmx-nautilus-desktop’, ‘frmSubscriptionManager’]

Then I use getobjectlist() to do some action:

>>> getobjectlist(‘frmSubscriptionManager’)
[‘flr8’, ‘flr4’, ‘mnuAbout’, ‘flr6’, ‘flr7’, ‘flr0’, ‘flr1’, ‘flr2’,
‘flr3’, ‘ukn2’, ‘ukn3’, ‘ukn0’, ‘ukn1’, ‘scpn1’, ‘scpn0’, ‘scpn3’, ‘scpn2’,
‘lblStatus1’, ‘lblContract’, ‘ptl0’, ‘flr5’, ‘txtStartEndDateText’,
‘tblBundledProductsTable’, ‘scbr0’, ‘mnuRedeemSubscription’,
‘tchEndDate’, ‘lblStatus’, ‘mnuSystem’, ‘mnuRegister’, ‘tchStartDate’,
‘lblSKU’, ‘txtSKUText’, ‘txtProvidingSubscriptionsText’, ‘tchQuantity’,
‘txtSupportTypeText’, ‘ttblMySubscriptionsView’, ‘mnuEmpty’,
‘txtArchText’, ‘mnuConfigureProxy’, ‘txtSupportLevelAndTypeText’,
‘mnuHelp’, ‘mnuOnlineDocumentation’, ‘lblStart-EndDate’, ‘mbr0’,
……etc]

The window disappeared, even though it was still displayed on my virtual machine’s monitor.

>>> getwindowlist()
[‘frmTopExpandedEdgePanel’, ‘frmBottomExpandedEdgePanel’, ‘frmroot@localhost:~’, ‘frmx-nautilus-desktop’]

Why does this error occur, and how should I deal with this situation in an automated test?

In my script below code when Thread.sleep() is not used, then it throws an exception “element click intercepted: Element <button _ngcontent-yyo-c131=”” class=”btn btn-sm btn-light border ml-3″>…</button> is not clickable at point (226, 567).
When using the Thread.sleep() it runs and clicks on the Next button, but the problem is that in my application total 9 times next button should be clicked.
For that I printed message on the log so here only 6 times message gets printed (‘btn50-400clicked’) and then next button is disabled and unable to proceed to next code.
Even after waiting for up to 30 minutes it’s not working.
How do I resolve it?
var next=WDS.browser.findElement(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))

while(next.isEnabled())
{
java.lang.Thread.sleep(9000);
//var wait15=new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 20000)
//wait15.until(org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”)))
var wait9 =new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 9000)
wait9.until(org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))).click()
//next.click();
WDS.log.info(‘btn50-400clicked’)

}
WDS.log.info(‘btn2clicked’)
//java.lang.Thread.sleep(3000);
if(!next.isEnabled()){
WDS.log.info(‘Next button disabled’)}

I am looking for a solution for the below problem statement:

Authentication is done through ADFS.
I recorded a script via jmeter/blazemeter/badboy, but observed that RequestSecurityTokenResponse is never returned in response for any request.
Observed that the RequestSecurityTokenResponse is directly sent over a URL via reply by ADFS.

Due to above situation I am not able to extract the RequestSecurityTokenResponse and hence I’m not able to parameterize it.

I’m working on automation test for a big project and I’m using Phpunit for functional test and as a server selenium webdriver.
I want to execute many tests using different browsers, I don’t know what’s the appropriate configuration to addend my objective, it’s in phpunit.xml or in the test class, because in the SetUp() method I can work only with one browser.
This is my SetUp() method
public function setUp()
{
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => ‘internet explorer’);
$this->webDriver = RemoteWebDriver::create(‘http://10.157.3.206:4570/wd/hub’,$capabilities);
}

I tried to follow this Link :
http://elnur.pro/using-environment-variables-to-add-flexibility-to-phpunit-tests
But Error is generated , Class Browser Not found
Can anyone help me to resolve this ??

I’ve started investigating dogtail as a solution for writing GUI-driven unit tests in a GNOME Wayland session. Before I dive deeper I want to understand what I’ll need to run these GUI-based tests on a remote server. (I’ve been bitten before by assumptions about the graphics capabilities of VMs and containers.)

So my plan is to:

Create a fresh clone
Run apt update and apt upgrade
Install packages and test scripts
Run a script to log into a desktop session (how?)
Run the test scripts in a live desktop session
Record the results
Exit the desktop session (how?)
Destroy the clone

If the original snapshot is taken while in a desktop session, I can avoid steps 3 and 7, and just execute steps 2, 3, 5 and 6 in the session, but I’d prefer to have the option of a “first login” test.

What capabilities am I looking for in the hosting server and software? If I can use a local client to access a visual desktop session, is that sufficient?

(Concrete examples of viable hosts are welcome but not required. I’m trying to understand the principles rather than picking any particular tool.)