Showing posts with label automated testing. Show all posts
Showing posts with label automated testing. Show all posts

Friday, April 5, 2019

Resolve: Killing Zombie Processes created by Selenium

Problem

Here's my problem.

I'm working with Selenium 2.53 (an old version, I know) and Firefox 52.8. The Gecko (driver) version is whichever works with FF 52.8. Anyhow, I create a my test script, run the test script, and see the command invokes the call to run the test. However, my browser does not open. My terminal just sits at this command running the test. Eventually, my command ends and the test failed to run. I'm running this in a secure environment on a separate machine and can't copy/paste a screenshot here.

However, here's what the error looks like - if you're lucky enough to get one.

Results :
Tests in error:
my.test.script.TestPageAUT.enterMaxChars...
    Run 1:  .... >> WebDriver Unable to bind to locking port 70...


Solution

Here's my solution.

I knew from experience that a system process opened by the driver via Java is hanging. Since I'm running this on Linux, I had to make sure I used the right Linux commands to find the processes that are running (active). Throughout my research, I learned that Linux actually has processes that are zombies (not quite dead, but not live either) which are marked with "<defunct>" next to the process.

Once I found out the process ID (PID) of the zombie process, then I just needed to kill the parent process of the zombie (because I can't kill the zombie - which I think is weird). It would be nice to just kill the zombie and automatically the parents of the zombie also die. Anyhow, in this particular case I had to kill the most super parent of the zombie in order to completely make sure the zombie process for my selenium script is dead. Selenium runs via Java by triggering the gecko driver which controls a FF process. So, to kill the zombie FF process, need to kill the Java process controlling the zombie FF process which might have a grandparent Java process.

Double check the process is dead by showing the list of active processes and seeing that there is no zombie process in the list.


Steps/Commands

Here's how I did it.

Important Note: A "kill" command has no effect on a zombie process.

List all zombie processes (ID).
$ ps aux | grep -w Z

Find the parent PID.
$ ps -o ppid <defunct_PID>         

Kill the parent
$ kill -9 <parent_PID_of_defunct_PID>


Other Useful Commands

List all running processes.
$ ps

List the running processes with Firefox.
$ ps -A | grep firefox

For more details, list with these parameters.
$ ps aux | grep firefox

Find the parent process ID.
$ ps -o ppid= -p <defunct_PID>

You can try this (kill all firefox PIDs), but this didn't work for me.
$ kill $(pgrep firefox)


Reference


Wednesday, February 6, 2019

Review: Future of Quality Assurance

I agree with this author.
https://thenewstack.io/quality-engineering-the-future-of-qa/

Quality Engineering within each Development Life Cycle phase

Since 2005, I could see "software tester" being eliminated from teams. It's the reason why I shifted from "tester" to "developer" back in 2008. I didn't expect the need for a test automation team to emerge. However, I still think that even such teams will no longer be necessary as development teams grow with understanding on how every part of the development process impacts a product's quality.

In addition, the rise of artificial intelligence (AI) will create a new path for developing automated "testers" who can simulate the behavior of product users and provide instant feedback to developers. In manufacturing or other assembling facilities, robots will become more like droids.

Regarding quality engineering, the biggest challenge I see today is with the technical leadership having a slow adoption of implementing this "quality" mindset into development teams. This leadership issue is one of the reasons why excellent developers (who already have this mindset) tend to leave and start their own companies. "Quality" developers see an opportunity to create a product (or service) that is better than an existing one. So why wait for technical leadership to see these opportunities?

Test Teams to Test Companies

Some development teams are already leading the charge with implementing the quality engineering principles and leveraging test companies instead of employing testers (or creating their own test teams). An example of an organization to leverage is TestProject.

Here's an example of how they help developers get up to speed with testing their applications (particularly web applications).
https://blog.testproject.io/2018/12/18/net-core-test-automation-selenium-page-object-page-factory/

Here's another company to leverage: TestIM

Going with this development strategy (of leveraging test companies instead of creating own test teams) will save time and money, but with savvy technical leadership.

Expert Users - the new Quality Experts

In the near future, the "User" will be the Tester, Quality Assurance Engineer, or whatever title you want to give to a person who makes sures that a product is working as expected (or beyond expectations). Rightfully so, a product is only as valuable according to the measure given by its user. It's just logical to move towards lean-agile development methodology where it's basically the developer (innovator) and user (expert) creating and maturing the product.

Closing Thoughts on Our Future

Our world will shift from a "buy-sell" model to a "use-improve" model. Therefore, relationships will no longer have a clear line between "business" and "personal" types, but all relationships will carry both types. Every relationship will be "personal" and "business". All experts will need to specialize in developing something and all innovators will need to be experts in using something.

Friday, January 11, 2019

Journey into SET: No WebElement.isClicked()

In creating the Test Framework using Selenium for testing a specific web application, I am sort of shocked that the authors of Selenium would allow a WebElement to be "clicked" but not keep track whether this WebElement "isClicked" or even "isClickable".

https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#click--

So, anyhow, learned the hard way and had to really pay attention to reading the large paragraph in the API's method definition when it should the method should hanlde such cases or the Object should allow for handling such cases.

But, there's my issue too - why am I not contributing to this open source library set (tool)?

I need to get my game up and contribute, not complain.

I got around my problem and solved using the:
driver.navigate.refresh()

Well, at least I now know. :D

Monday, December 31, 2018

Review: Exploratory vs Manual Testing

@fwmoyer states the difference between Exploratory Testing and Manual Testing is a mindset. And I agree with him. Here's a quick article on explaining why.

https://www.softwaretestinghelp.com/exploratory-testing-vs-scripted-testing/

Overall, context is always valuable when driving something purposeful. In order to reach quality results (i.e. results that matter and add value), context is required especially to help to create productive roadmaps whether designing, developing, and/or testing.