October 28, 2019

Python tutorial 9 | string methods

Let us continue with Python Tutorials for Beginners. If you are new to Python strings, please see my Python tutorial 2 | Handling Strings first. This Python beginner tutorial explains many useful Python string functions with examples. Please view the Python video tutorial 9 or read on...

Now let us see Python examples of string methods in Python programming.

# Python code example
greeting = "Hello"

# print in lower case
print (greeting.lower())

# print in upper case
print (greeting.upper())

name = 'john doe'
# print only the first character in capitals with capitalize
print (name.capitalize())

# print the first character capitalized in every word with title
print (name.title())

# Python code example
some_string = "   this is some text   "
# strip the left hand side spaces with lstrip
print (some_string.lstrip())
# strip the given left hand side characters i.e. spaces, t and h with lstrip
print (some_string.lstrip(' th'))
# strip the right hand side spaces with rstrip
print (some_string.rstrip())
# strip the given right hand side characters i.e. t and spaces with rstrip
print (some_string.rstrip('t '))
# strip spaces on both ends with strip
print (some_string.strip())

October 21, 2019

Self-Healing Functional Test Autmation Tool

As you know, manual software testing takes too much effort. Therefore, Agile teams use software test automation to execute more tests on a regular basis. However, automated testing has a problem. Many times, test automation requires maintenance when the System Under Test (SUT) changes. 

Testim is an automated functional testing tool.  Testim uses Artificial Intelligence (AI), specifically Machine Learning for the authoring, execution and maintenance of automated tests. The element locators are dynamic. The benefit of using Testim is quick authoring and stable tests because there is no longer the need to update the automated tests with every code change in the SUT. Testim executes tests on different web browsers and platforms like Chrome, Firefox, Edge, Internet Explorer, Safari and Android.

Testim is available in two plans - BASIC, which is free and PRO, which you can customize according to your project needs. If you want to check out Testim, you can try Testim for free here. Please let me know your feedback or any questions. Thank you.


October 13, 2019

Python tutorial 8 | for loop statement

This is the next of Python Tutorials for Beginners. Please view all the Python tutorials in this blog here. This Python beginner tutorial explains the for statement in Python with multiple examples. The Python for statement loops over items of any sequence like an integer series or a list. Please view the Python video tutorial 8 or read on...

In Python programming, it is simple to create the sequence of integers that you need by using the range function. You can use the continue statement or break statement in the for loop. As in the while loop, the continue statement skips the current iteration of the for loop. The break statement ends the for loop immediately.

The for statements in Python programming have the Python for loop syntax below. The variable is assigned the first value in the sequence and the code block1 (for block) is run. Then the variable is assigned the second value in the sequence and the code block1 is run again. This goes on until the sequence is complete. Then the code block2 (else block) is run once and the entire for loop statement ends. Note that the else part of the for statement is optional.

for variable(s) in sequence:
    code block1
else:
    code block2

Now, let us see Python examples of Python for loop programs.

# Python code example
# print integers from range(6) i.e. 0 through 5
# i is the Python for loop index
for i in range (6):
    print (i)
else:
    print ('End of Python for statement')

# Python code example
# print integers from the range(6) but exclude 3 i.e. 0, 1, 2, 4, 5
for i in range (6):
    if i == 3:
        continue # skip current iteration of the loop
    print (i)
else:
    print ('End of for statement')

# Python code example
# print integers from the range(6) but up to 2 i.e. 0, 1, 2
for i in range (6):
    if i == 3:
        # terminate the for loop immediately
        # even the else block (code block2) is not run
        break
    print (i)
else:
    print ('End of for statement')

October 06, 2019

Python tutorial 7 | while statement

This is the next of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains the while statement in Python with multiple examples. The while statement repeats execution of a code block for as long as a condition is True. Please view the Python video tutorial 7 or read on...

The while statements in Python programming have two formats, the while statement and the while else statement. Now, let us see these formats with Python examples. Note : the formats are followed by Python samples

In the first format of Python while statement, the condition is evaluated. If the condition is True, the code block is run. Again, the condition is evaluated. If the condition is still True, the code block is run again. This goes on until the condition becomes False (by some code in the code block). The while statement ends when the condition becomes False.

while condition:
    code block

# Python code example
# print integers from 1 to 5
i = 1
while i <= 5:
    print (i)
    i = i + 1 # add 1 to the value of i and assign it back to i (in other words, increase i's value by 1)