Showing posts with label set. Show all posts
Showing posts with label set. 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


Tuesday, October 16, 2018

Journey into SET: Part 1

So, I'm getting back into the game of software testing and especially with the new test automation tools and techniques. I'm going to log my journey of catching back up in this field after being in software development (away from testing to purely coding without testing - and I know this is bad). So, let's just add that I'm restoring the best practices of a software engineer.

Nowadays, it seems the new title for software testers is either Software Development/Design Engineer in Test (SDET) or Software Engineer in Test (SET) or similar. The emphasis is on the evolving skills of a tester having the capabilities to develop (or code) meanwhile advancing their techniques of applying best practices in test automation. This makes sense when we consider how the multitude of frameworks for development web application and software tools has also evolved.

Here are some articles to read.

Evolution of the Software Testing role:


One can also gain an understanding of what a test engineer (or SDET or SET) does today by looking up the job qualifications on major tech company career websites including Google (specifically "Test Engineer"), Amazon (spec. "Software Development Engineer in Test"), Microsoft (spec. "Software Design Engineer in Test").

A Quick Recap from Microsoft's Personal Experience
Here's a nice recap from Microsoft on the transition of eliminating the Software Test Engineer (STEs) and creating a "combined engineering" team.


Software Test Design
Similarly to developing any software, developing scripts to test software also should go through the design phase in order to create test structure. This helps with organizing tests to correspond to the software design, finding bugs early in the design process of software development, creating a testing framework for easier ramp-up of new Test Engineers and for easier review of the software development team, and more.

Software Test Design - Problems
First problem I'm interested in is what to name the appendages of the class files especially for the automated test scripts via the browser.
Unit Tests use the appendage "Test" like "HelloWorldTest".
Integration Tests use the appendage "IT" like "HelloWorldIT".

I've seen throughout the Selenium docs the term "AUT" (or application under test) and wonder if I should use this as the appendage for my test scripts via browser like "HelloWorldAUT". But is this sufficient?

Software Test Design - Research
https://dzone.com/articles/design-patterns-in-automation-testing

What is SOLID (Principles)?

  • Single responsibility
  • Open-Closed priniciple: open for extension and closed for modification
  • Liskov substitution
  • Interface segregation
  • Dependency injection

https://msdn.microsoft.com/en-us/magazine/dn683797.aspx (dated: May 2014)
*There are a number of terms explained in this article that I really like. For instance, the author says "when I say principle, I'm referring to a feature of the computer code that helps maintain the value of that code."


Software Testing Conferences
Here are some conferences to be aware of with respect to software test automation and the future of testing software.



Software Test Tools
There are a lot of tools from the many articles online that I've read. Not to overwhelm one with reading through all the articles and also knowing that the software tool depends on the software developed, here's a short list of tools that I'm learning and applying.

Leading the list is Selenium as the best, open source tool for testing web applications.


I should really keep track of my progress here. This is getting way too long. So I need to split this step into smaller steps and start publishing.