List

Python might be new to many of you, so there will certainly be many questions in your mind. So, going ahead with this post, I would like to introduce further things in Q/A form (Whats & Whys). You might add more of such questions as a part of comments.

What is Python?
Python is a powerful scripting language created by Guido Van Rossum in 1998, meant for RAD. It owes its name not to the python as depicted in the picture rather to the comic troupe Monty Python. Interestingly, though, certain Python installations show the Python script icon as a green python.

Why does a software tester need Python?
Another format of this question is – “What is a Python related post doing on Testing Perspective blog?”. A software tester needs Python (or any other scripting language of choice), to automate testing efforts. When I say automating testing efforts, it encompasses automated testing along with other activities that support the testing of an application,e.g. test environment set-up, test reporting etc. Using Python gives a software tester, a consistent language rather than switching from one tool-specific language to another. Using Python, many such tasks can be automated, for which you might not find an already existing tool. Remember that the above statements are just a glimpse of the possibilities. Your imagination and skill-set will definitely make you do much more than the mentioned stuff. Python is a language of choice of a large number of the security professionals. There is an ever-growing community supporting Python.


What are the key features of Python?
1. Easy coding – It’s meant for Rapid application development. Consistent style of coding and usage make your life easier than remembering some 100 shortcuts or tricks.
2. Excellent Readability and Maintainability – Proper Indentation of code is not a choice, rather the way of Python coding. If you pick Python code by different programmers, you can be sure to see similar looking code.
3. It is Object-oriented – OOP is not a patch work for Python, rather an in-built feature
4. It is free and open source.
5. No semi-intelligence – No ambiguous type-conversions or assumptions.
6. Exception Handling is built into the language
7. It is Cross Platform compatible

Where can I get Python?
You can get Python as a free download from Official Python website or as ActivePython from ActiveState website. There are other versions available, but the mentioned ones solve the purpose.

Why should I switch to Python?
This is a tricky question and is more relevant to those who already know some scripting language like Perl or Ruby.

I would like to say that when one uses a scripting language for a long time, it more or less becomes a religion for the person. You can find many debates (healthy as well as unhealthy) on the web or otherwise with the topic “abc versus net”, “Why abc is worse than net”….At your own discretion, you can Google or Yahoo! for such topics. I have gone through such threads of discussion on the web and even with my friends and team. Such discussions help me to see the stuff from a broad perspective and I end up appreciating as well criticizing certain aspects of languages being compared.

I advocate Python not as a substitute for any other scripting language, I advocate Python as Python. If you know any other language (that’s true for me), you can choose to learn Python to add another language to your toolbox. I strongly feel that no language is the best language for everything. So, take out Python from your toolbox after careful assessment and you will see how it makes your coding experience better.


For those, who want to learn it as their first scripting language, I can say from my experience that Python will not disappoint you. It’s an excellent asset for a tester’s toolbox and will teach you good coding principles and impact the way you code. It can help you to automate many day-today tasks.

Who Recommends Python?
Some of us tend to believe stuff when it comes from some big shot. An example is some simple quote, which is a known general truth, but when some big leader says it, it becomes news. Following are some quotes about Python, which I could find on the web. So let’s have a look at who are using Python and what do they feel about it.

Google“Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we’re looking for more people with skills in this language.” said Peter Norvig, director of search quality at Google, Inc.

 

NASA “NASA is using Python to implement a CAD/CAE/PDM repository and model management, integration, and transformation system which will be the core infrastructure for its next generation collaborative engineering environment. We chose Python because it provides maximum productivity, code that’s clear and easy to maintain, strong and extensive (and growing!) libraries, and excellent capabilities for integration with other applications on any platform. All of these characteristics are essential for building efficient, flexible, scalable, and well-integrated systems, which is exactly what we need. Python has met or exceeded every requirement we’ve had,” said Steve Waterbury, Software Group Leader, NASA STEP Testbed.

 


Industrial Light & Magic “Python plays a key role in our production pipeline. Without it a project the size of Star Wars: Episode II would have been very difficult to pull off. From crowd rendering to batch processing to compositing, Python binds all things together,” said Tommy Burnette, Senior Technical Director, Industrial Light & Magic.

 

Python is what I use the most to solve my own problems – Bruce Eckel Why I love Python

Visit the Testing Perspective website to read an online book on Python basics – How Would Pareto Learn(TM) Python Basics! as a part of How Would Pareto Learn project. This was originally posted in the form of blog posts, but now on it will be available only on the website for maintaining a single place of reference.

Rahul Verma

www.testingperspective.com

8 Responses to “Pythonize Your Testing Efforts!”

  1. Shrini Kulkarni

    >>>it encompasses automated testing along with other activities that support the testing of an application.

    Do you wanted to say “help in automate some aspects of testing – mainly execution” or to aid in “computer assisted testing”

    In reality there is nothing that exists called “Automated Testing”.

    Testing is too complex (a highly intellectual and investigative activity) to be deligated to machines.

    What people call as automated testing is “automated test execution” of some part of their test cases …

    I wrote about this “confusing” and “oversimplified” term “Automated testing”

    http://shrinik.blogspot.com/2007/07/mystery-called-automated-testing.html

    Rest of the post is good — As a tester, you would use plenty of tools to help to extend your “human” reach in testing …

    PERL, Python, Ruby and automation frameworks like WATIR, FIT/FITNESSE are “good friends” of a skilled tester ….

    good stuff … keep coming

    Shrini

  2. Corey Goldberg

    Great post.
    I’ve been a huge proponent of python for testing for several years now.

    > What people call as automated
    > testing is “automated test
    > execution” of some part of their
    > test cases …

    everyone seems afraid to use the term “automation” lately. some high profile testers have denounced this term. The fact is, “automation” is and always has been a style of execution.. so please.. use the word freely and often.

  3. Rahul Verma

    Hi Shrini,

    Thanks for visiting and sharing your thoughts.

    I had read your post and shared my thoughts as well. I would like to put what I had commented on your blog once again here —

    “How I think about automation in testing is – automating certain areas of my testing activities to help in overall testing process.”

    When I hear the term Automated testing, I interpret – “Automation aided testing” – because that’s what the person who is using this term is practically doing.

    “Do you wanted to say “help in automate some aspects of testing – mainly execution” or to aid in “computer assisted testing”

    Infact I had mentioned there that you are good at coming up with improved terminology. I am still at waiting end. As of now if I have to refer to automating certain areas, I would like to use some name – Afterall everything needs a name!. The name as of now which is widely accepted is “Automated Testing”. I feel comfortable using this instead of using a long phrase (especially when what I think about automation is no way different from what you think or what the other experts think). I am sure, in the times to come, you will come up with some better name for this. Depending on how it is received in general and by me, I will revisit all my posts that day to edit the term.

    PERL, Python, Ruby and automation frameworks like WATIR, FIT/FITNESSE are “good friends” of a skilled tester ….

    good stuff … keep coming

    Good to hear that you liked rest of the post. I feel encouraged.

    Keep visiting and sharing your thoughts.

    Regards,
    Rahul Verma.

  4. Rahul Verma

    Hi Corey,

    Thanks for visiting and sharing your views.

    I read your blog often and see a plenty of posts on Python, which touch advanced usage. You have also developed open-source tools in the language as can be seen on your site.

    I am new to Python, but I am amazed by its power and simplicity. I am using the language for building a fuzzing framework. I am planning to share what I am learning in Python, right from base language.

    everyone seems afraid to use the term “automation” lately. some high profile testers have denounced this term. The fact is, “automation” is and always has been a style of execution.. so please.. use the word freely and often.

    I share the same observation. I somehow feel that coming up with new terminology to replace ambiguous one is good. But the things on which I concentrate are different from analysis of such aspects. I use the terminology which is generally accepted to avoid communication gaps, although new names often find their ways to come into my language. Let’s us see what better name Shrini comes up with. The way he writes on test automation topics, I am expecting a good name.

    Regards,
    Rahul Verma.

  5. Rajesh Kazhankodath

    Rahul,
    Really looking forward to this series of posts.
    I’ve been using python for past 3 years now and its a truly amazing language.
    There’s an GUI automation tool http://www.marathontesting.com my team has been using. We’ve been using this tool with in ways we never though possible initially, thanks to python which is being used as its scripting language. We’ve used this tool to measure performance improvements across product builds and this practice has been very effective. This is a tool I’d truly recommend to anyone planning to do GUI automation on Java/Swing applications.
    We’ve also been using python based API’s to measure network utilization that we’ve integrated with the marathon tool.
    We’ve also developed numerous utilities to make our work life simpler; ranging from a ftp client for downloading of weekly test builds to test data generation scripts.
    There’s so much material out on the web on python and an an active online community always ready to help.
    Regards
    Rajesh.

  6. Rahul Verma

    Hi Rajesh,

    Welcome to Testing Perspective.

    Thanks for introducing Marathon as a tool for testing Java/Swing applications. I checked the site and found that it is based on Jython, which enables Java and Python to work together.

    Good to hear about the kind of activities you have automated using Python. When I finish writing Python tutorial, I guess we can discuss about a collaborative effort for sharing such experiences with the readers of this blog in the form of small separate tutorials.

    I would like to request you to keep visiting and reviewing the contents of the posts to come. Your suggestions can help to improve the contents of the final tutorial.

    Regards,
    Rahul Verma.

  7. Shrini Kulkarni

    Corey —

    Good to see your perspective on my comments …

    Can you post your comments on my blog so that we can fight it out there ….

    >>everyone seems afraid to use the term “automation” lately.

    I am and several others in my community (context driven testing) are not the ones who are afraid of automation. Automation is a way of executing testing or an application of tool to part of tesitng.

    I am not sure how much you have studied about testing and how do you define testing …

    I use this definition from James Bach – questioning product in order to evaulate it. Tesitng is deep intellectually engaging activity. So I registired my views on why “automated testing” is a misnomer.

    >>>The fact is, “automation” is and always has been a style of execution..

    Not sure what you mean here? What is your definition of automation and execution. What you are executing and how?

    Shrini

  8. Shrini Kulkarni

    Rahul,

    >>When I hear the term Automated testing, I interpret – “Automation aided testing” – because that’s what the person who is using this term is practically doing.

    If you are looking for some terminology for test automation —
    You can use “Computer Aided/assisted Testing” (Cem Kaner)

    Shrini

Leave a Reply to Shrini KulkarniCancel reply