Subscribe by Email

Tuesday, November 6, 2012

What is Python Testing? What are system requirements for python testing?

Framework for Python Testing

- A special frame work is used for python testing frame work which is commonly known as the “py unit”. 
- This frame work is nothing but a language version of the Junit which was developed earlier by Erich gamma and Kent Beck. 
- Kent previously had developed a small talk testing frame work. 
- The Junit is a version of this frame work only. 
- Each one of them can be considered to be a standard unit testing frame work representing their own respective language. 
- Test automation is much supported by the unit test. 
- Other things supported by the unit test are:
1.   Sharing of set up
2.   Shut down code for tests
3.   Aggregations of tests in to collections
4.   Keep the tests independent of the reporting frame work
- In addition to all these classes that support qualities for a set of test cases are also provided by the unit test module. 
- But to provide all these, it is necessary that the unit test module should support the following concepts:
1. Test case: Being the smallest unit of testing, it is designed to check the specific response to a certain input. New test cases are created from a base class called “test case” which is again provided by the unit test module.
2. Test fixture: The purpose is to be the representation of the preparation that is very much required for performing one or more than one as well as clean up actions. Some examples are:
a)   Creating temporary data bases
b)   Creating proxy data bases
c)   Creating directories
d)   Starting a server process
3.Test suite: It is a collection of either test cases or test suites or in some cases a mixture of both. Serves as an aggregating tool which collects the tests to be executed in one place.
4.Test runner:This component facilitates the orchestration of the execution periods of the tests and accordingly provides results to the user. Either a graphical interface or a textual interface can be used by the test runner.
The following two concepts are supported by the function test case and test case classes:
1.   Test case and
2.   Test fixture
- The frame work for python testing has been designed in such a way that it will work with any standard python but on versions higher than 1.5.2. 
- Pyunit has been tested on various versions of Linux with python 2.0, 2.1 and so on. 
- Also, the python has been known to work on platforms other than this example mac and windows.  
- The unit test module is actually a content of the standard python library of python 2.1 and above. 
- If in case you are working with an old version of python, you need to obtain this module from a separate distribution of the pyunit. 
- To ensure that the unit test module is being used in your code, you need to ensure that the directory which holds the file is included in your code. 
- There are two ways to do this as stated below:
1.   Including the ‘$PYTHONPATH’ environment variable
2. Placing the directory in the current search path of python on linux machines.
- Exceptions are part of every test run. 
- So, in python testing whenever exceptions are raised, in order to format the failure details the resulting trace back objects are saved. 
- The failure details are printed at the end of the test run.
- However, memory usage poses a problem whenever test suites are run with very high failure rates.

No comments:

Facebook activity