Saturday, 23 November 2013

Count occurence of character in a string

String = syzygy
I am interested in how many times letter "y" occurs in the string.

Just write this in Python Shell:

>>> str.count('syzygy', 'y')
3

or

>>> 'syzygy'.count('y')
3

Testing Automatically using Doctest

Follow the procedure below:

1) Create function in IDE (e.g. convert_to_celsius)

def convert_to_celsius(fahrenheit):
    '''(number) -> float

    Return the number of Celsius degrees equivalent to fahrenheit degrees

    >>> convert_to_celsius(32)
    0.0
    >>> convert_to_celsius(212)
    100.0
    '''
    return (fahrenheit - 32) * 5 / 9

def colder_temperature(temp1, temp2):
    '''(number, number) -> number
    Return the colder of the two temperatures, temp1 (degrees Celsius)
    and temp2 (degrees Fahrenheit), in degrees Celsius.
    '''
    return

2) Save the module and run it in IDE (press F5)
3) Go to Python Shell
4) Do following:

>>> import doctest
>>> doctest.testmod()
TestResults(failed=0, attempted=2)
>>>
>>>#--> If falied=0, then the function is correct

Sunday, 11 August 2013

Test Management Tools

ReQtest

  • Easy to learn, no need to pay for training
  • No need to install the software, login and password is enough
  • Watch the video below to see more
  • Click here to see company website

Monday, 1 July 2013