Sunday, December 22, 2019

Python tutorial 15 | Exception handling part 1 | Try except statement

Let us go to an important tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains exceptions in Python and how to handle them. Please view the Python video tutorial 15 or read on...First, what are exceptions? Exceptions are the errors that are thrown during script execution. Exceptions are different from syntax errors, which are thrown before script execution. If we do not handle an exception, our script execution stops with an error message. Let us see some Python exception examples.

# Python code
print (i * 2)   # throws NameError exception because variable 'i' is not defined
int ('Hi')   # throws ValueError exception because 'Hi' is an invalid argument to the int function
print (1 / 0)   # throws ZeroDivisionError because division by zero is not allowed in Python programming

We can handle exceptions in Python using the Python try except statement. This means that we can protect our Python script from stopping abruptly. The Python try statement syntax is:
try:
    try clause
except named exception:
    except clause

In the above try statement format, the try clause is a code block with one or more statements in it. Same for the except clause. When Python runs the try clause, there are three possibilities 1), 2a) or 2b):
1) If there is no exception, the try clause is completed and the except clause is skipped.
2) If an exception is thrown in the try clause, the remaining statements in the try clause are skipped. Python matches the thrown exception with the named exception(s) after except:
2a) If the exception matches, the except clause  is run.
2b) If the exception does not match, the Python script execution stops with an error message.

Now, let us see the Python try except statement example.

# Python code example
try:
    i = 10 # comment this line to generate an exception
    print (i*2)
except NameError:
    print ('Please define the variable first.')

The Python try statement syntax can also have multiple excepts:
try:
    try clause
except named exception 1:
    except clause 1
except named exception 2:
    except clause 2
.
.
.
except named exception n:
    except clause n

In the above try statement format, there are multiple except clauses within the try statement. When Python runs the try clause there are three possibilities 1), 2a) or 2b):
1) If there is no exception, the try clause is completed and all the except clauses are skipped.
2) If an exception thrown in the try clause, the remaining statements in the try clause are skipped. Python matches the thrown exception with the named exception(s) after each except:
2a) If the exception matches any named exception, only that except clause  is run (and all the other except clauses are skipped).
2b) If the exception does not match any named exception in any except, the Python script execution stops with an error message. In order to catch any unnamed exception, we can have the last except without any named exceptions (as in the Python code examples below).

Sunday, December 15, 2019

Tue, Dec 17 | Test Automation Frameworks with AI and ML | Advanced Live Webinar

Here is the last session in 2019 on Test Automation frameworks, useful for professionals who are seriously interested in test automation and automated testing. This live webinar will be hosted by Testim's software developer, Benjamin Gruenbaum and is titled, Is AI Taking Over Front-End Testing? What’s visible on the screen is the only thing that matters to end users. To ensure an impeccable graphical user interface (GUI), front end testing is a must. The contents of the session include What is browser testing and why it’s hard to automate, Evolution of Test Automation Frameworks, Fundamentals of AI and ML and How ML can be applied to test automation.

Tue, Dec 17, 2019 (1-hour duration) 
9 am PST/ 12 pm EST / 5 pm UTC / 10:30 pm IST
* If you register but cannot attend the live event due to some reason, you will be still able to see it's recording later.

Wednesday, December 11, 2019

Python tutorial 14 | File handling | Working with files

Moving on to the next tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains how to work with files. Please view the Python video tutorial 14 or read on...Let us learn how to work with text files in Python programming. The syntax for opening a file with the open function is: file = open (file_name, mode)

In the above syntax, the mode is optional. If the mode is not specified or specified as 'r', the file will open in the read mode. If the mode is specified as 'a', the file will open in the append mode (meaning we can add text after existing text in the file). If the mode is specified as 'r+', the file will open in the read-write mode (meaning that we can read from the file and write to it). If the mode is specified as 'w', the file will open in the write mode (meaning that the existing text will be erased, so we have to backup the text and be careful).

Now, let us see the file functions' syntax.
file_name.read (n bytes) - read n bytes from the file into the memory
file_name.read() - read the whole file into the memory
file_name.readline() - read one line from the file
file_name.readlines() - read all lines from the file into a list
file_name.write (string) - write a string to the file (and return the number of characters written)
file.close - close the file (end the system connection to the file)

Now, let us see Python examples of file functions.

Monday, December 2, 2019

Live Webinar | Why Test Automation Fails | Learn Test Design and Implementation Tips

Here is an opportunity to join an advanced live webinar on Test Automation. Learn about the reasons that may lead to test automation failure. And learn test design and implementation tips towards successful test automation. This webinar will be a deep dive into common test automation failures with actionable tips on how to design end-to-end tests aiming at test automation project success.

Register Now (only limited seats are left) at https://tinyurl.com/TestAutomationWebinar
Tuesday, Dec 10, 2019 (1-hour duration)
9 am PST / 12 pm EST / 5 pm UTC / 10:30 pm IST

Test Automation Webinar

Sunday, December 1, 2019

Python tutorial 13 | List functions

Moving on to the next tutorial in Python Tutorials for Beginners. This Python beginner tutorial is the next part of the Python tutorial 12 | Lists. This tutorial explains many Python list functions with examples. Please view the Python video tutorial 12 and Python video tutorial 13. Or read on...

Let us learn about list functions in Python programming with code examples. The Python list functions are explained as comments (starting with the # symbol in the Python code below). These list functions work on Python lists with different data types (integers, floats or strings), as appropriate.

# Python code examples
# create a list of strings
vowels = ['a', 'e', 'i', 'o', 'u']

# len function returns the number of items in a Python list
# print 5, which is the number of items in the vowels list
print (len(vowels))

# min function returns the smallest item in a Python list
# print 'a', which is the smallest item in the list
print (min(vowels))

# max function returns the largest item in a Python list
# print 'u', which is the largest item in the list
print (max(vowels))

# index list function returns the index of a specific item in a list; indexes start from 0
# print 1, which is the index of item, 'e' in the list
print (vowels.index('e'))

# count list function returns the number of occurrences of a specific item in a list
# print 1, which is the number of times 'i' appears in the list
print (vowels.count('i'))


Sunday, November 24, 2019

Python tutorial 12 | Lists

Let us move to the next tutorial in the Python Tutorials for Beginners. This Python beginner tutorial explains lists in Python. The tutorial also shows a variety of operations that we can do on Python lists.

What are lists? In Python programming, a list is a group of values. These values are called items. The items are commonly of the same data type like all integers or all floats. But, it is possible for the items to be of different list data types like strings, integers or floats. Lists are mutable, meaning that we can change a list. A list may have another list as an item. The lists which are items of another list are called nested lists. The list syntax is:

[item0, item1, item2,..., itemn]

In the above list format, note that the list is put between square brackets [ and ]. Within the list, the items are separated by commas. The item indexes start from 0. Now, let us see Python list examples and list operations with Python examples.

Sunday, November 17, 2019

Testim Dev Kit Beta Program Invitation

As you may know, Testim is an automated functional testing tool. Testim uses Artificial Intelligence (AI) for the authoring, execution and maintenance of automated tests. Earlier, we could record automated tests in Testim. But now, we can also write, debug and run test automation in Testim IDE using JavaScript programming. Additionally, we can record automated tests and export to code for automated testing. The Testim Development Kit (TDK) provides APIs and example code to write automated tests using JavaScript quickly. You can see more information about the TDK and join the beta program here now.

Now, Testim’s end-to-end software test automation delivers the speed and stability of AI-based codeless tests, with the power of code. We get the flexibility to record or code tests, run on 3rd-party grids, fit our workflow and tools including CI, Git and more. If you are interested, you can join Dev Kit beta now. Thank you.

Sunday, November 10, 2019

Python tutorial 11 | user defined functions

Moving on with Python Tutorials for Beginners. This Python beginner tutorial explains how to write user-defined functions in Python programming with examples. Please view the Python video tutorial 11 or read on...

Functions allow us to avoid code repetition. We already know about string functions like lower, upper and capitalize and math functions like ceil, floor and trunc. We can define our own functions (called user-defined functions) in Python programming language.

A Python user defined function may have one or more parameters. The function parameters provide data to the function code. The function may produce different outputs based on the parameter values it receives in the function call. A Python user-defined functions may have documentation that explains it. The function definition syntax is:

def function_name (parameters):
    doc string
    code block
    return return_value

Note the def keyword that we use to define the function. The parameters are optional. The function body has the documentation string (the doc string), code block and the return statement. Now, let us see Python function examples.

Sunday, November 3, 2019

Python tutorial 10 | numeric operations and functions

Moving on with Python Tutorials for Beginners. This Python beginner tutorial explains the useful Python numeric operations and functions with examples. It also explains how to import modules in our code. Please view the Python video tutorial 10 or read on...

First, let us see Python examples of numeric operations in Python programming.

# Python code example
i = -10
# print absolute value of i, which is 10
print (abs(i))

# use max numeric operation
# print the maximum value from a number of values, which is 100
print (max(-1, 100, 2.3, 4, 90))

# use min numeric operation
# print the minimum value from a number of values, which is -1
print (min(-1, 100, 2.3, 4, 90))

# use round numeric operation
a = 1.234
# print the float value rounded off to the nearest integer value
print (round(a))
# print the float value rounded off to 2 decimal places
print (round(a, 2))

Monday, 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())

Sunday, October 20, 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.


Sunday, 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')

Sunday, October 6, 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)

Sunday, September 29, 2019

Python tutorial 6 | if statement

This is the sixth of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains the if statement in Python with multiple examples. You can use the if statement to run a block of code depending on a condition. You can write a Python condition using Python comparison operators or Python logical operators. Please view the Python video tutorial 6 or read on...

In Python programming language, the block of code is formed by indenting it by a few spaces, typically 4 spaces. The if statements in Python programming have three formats, the if statement, the if else statement and the if elif else statement. Now let us see these formats with Python examples.

Note : the formats are followed by Python samples

In the first format, the condition is evaluated. If the condition is True, then the code block is run by Python. If the condition is False, nothing happens.

if condition:
    code block

# Python code example
# input function request a string from the user
name = input('Enter a name : ')
# len function returns the length of the string, name
if len(name) > 5:
    print(name, ' has the length', len(name))

Sunday, September 22, 2019

Python tutorial 5 | Logical Operators

This is the fifth of Python Tutorials for Beginners. You can see the other Python tutorials in this blog here. This Python beginner tutorial explains logical operations in Python with examples. It also shows operator precedence within logical operators and between Python comparison operators and Python logical operators. Please view the Python video tutorial 5 or read on...

Python programming language has three logical operators. The logical operators in Python are not operator, and operator and or operator. Now, there are two Boolean values, which are True and False.

The not operator results in the other Boolean value. If a condition is True, the not operator converts it to False. If the condition is False, the not operator converts it to True. The and operator needs two conditions. If both the conditions are True, the and operator gives the result as True. Else, the and operator gives the result as False. The or operator also needs two conditions. If both the conditions are False, the or operator gives the result as False. Else, the or operator gives the result as True. If a logical expression has multiple operators, the Python logical operators have different operator precedence. The not operator has the highest priority, then the and operator and finally, the or operator.

Now, let us see these logical operators with examples.

Sunday, September 15, 2019

Python tutorial 4 | Comparison Operators

This is the fourth of Python Tutorials for Beginners. You can see all the Python tutorials in this blog here. This Python beginner tutorial explains comparison operations in Python programming with multiple examples. Please view my Python video tutorial 4 or read on...

You can use Python comparison operators when you write conditions in Python if statement or Python while loop statement. In Python programming language, the comparison operators include equal to, not equal to, less than, less than or equal to, greater than and greater than or equal to. The result of any Python comparison operation is a True or False value.

A single Python condition may contain different comparison operators but all comparison operators in Python have the same priority. This means that there is no operator precedence.
Now, let us see these comparison operators with examples.

Sunday, September 8, 2019

Python tutorial 3 | Arithmetic Operators

This is the third of Python Tutorials for Beginners. In order to get started, you can see Python Tutorial 1 | Introduction and Python tutorial 2 | Handling Strings. Let us learn about arithmetic operators in Python programming language. This tutorial explains the arithmetic operators in Python programming. Please view my Python video tutorial 3 or read on...

What is an operator? It is a construct for processing one or more data values. In Python programming language, an operator is shown by a special character or a keyword.

There are several arithmetic operators in Python. These are + for addition, - for subtraction, * for multiplication, / for division, // for floor division or integer division, % for remainder of integer division and ** for power. Now, let us see examples of integer add, float add, integer subtract, float subtract, integer multiply, float multiply, division, floor division, remainder and power arithmetic operations in Python.

Sunday, September 1, 2019

Python tutorial 2 | Handling Strings

This is the second of Python Tutorials for Beginners. In order to get started, please first see the Python Tutorial 1 | Introduction. Let us learn how to handle strings in Python programming language. Please view my Python video tutorial 2 or read on...

A string is a sequence of characters. A string is enclosed by single quotes or double quotes. A multi-line string is enclosed by triple quotes (either both single quotes or both double quotes). You can see your string by using the print function. The print function omits enclosing quotes. The + Python string operator concatenates (combines) strings. The * Python string operator repeats a string a number of times. You can assign multiple variables in a single Python statement. Using indexing, you can extract a single character from a string. Using slicing, you can extract any part of a string. Strings in Python programming language are immutable. This means that once you define a string, you cannot change it. Now, let us see examples of these concepts.

Sunday, August 25, 2019

Python Tutorial 1 | Introduction

This is the first of Python Tutorials for Beginners. Let us learn about the Python programming language, how to download and install Python, using the Python interpreter, variables in Python and how to write a program in Python and run it. Please view my Python video tutorial 1 or read on...

Python is an open source programming language. It is easy to use. In many cases, Python needs fewer lines of code than other programming languages to accomplish the same task. Python is understandable because it uses English keywords. Python is an interpreted programming language. This means that there is no need to compile a Python program before running it.

Let us see how to download and install Python. You can get Python 3 from the Python official website. I have shown the steps in the Python Setup in my Python 1 tutorial video.
Next, you should add the path to the Path system variable. This ensures that you can run Python from any drive or any folder on your computer.
You can launch Python from the Python IDLE, which is the interactive Python interpreter. For this, click Start > All Programs > Python 3.x > IDLE. Alternately, you can launch Python from the command prompt. Either way, you should get the Python prompt, which is >>>

Next, you can type Python functions in the Python interpreter. Note that comments begin with # in Python.
>>> help(print) #see the documentation of any Python command
>>> quit()         #quit the Python interpreter

You can create variables in Python to store your data. A variable is a name or reference to your data. Now, Python is a case-sensitive programming language. This means that  v and V are two different variable names. You can continue with Python commands. You can view the Python video tutorial 1 to see such commands in action.
>>> 10 + 20    #this statement computes the expression and displays it 
>>> i = 1         #i is a variable. It is assigned the value 1.
>>> i               #this statement prints the value of i
>>>I                #NameError because variable I is not defined (Python is case-sensitive)
>>>type(i)      #this statement displays the type of data in the variable
>>>i + 5         #this statement computes the expression with the value of i and displays the expression value
>>>del i         #this statement deletes the variable

Next, let us see a small Python program based on the programming logic shown in the following flowchart:


>>> x = 1
>>> y = 2
>>> z = x + y
>>> print(z)

You can type in this Python code directly in the Python interpreter or save it in a Python file (Python scripts have .py file extension). You can see these details in my Python video tutorial 1. Thank you.



Wednesday, July 31, 2019

SoapUI Plugins

This is the last of my SoapUI testing tutorials. This SoapUI tutorial for beginners is on SoapUI Plugins in SoapUI tool. There is SoapUI Eclipse plugin. It gives you the SoapUI features in the Eclipse IDE (Integrated Development Environment). The Soap UI Eclipse plugin supports inspection, invoking, mocking, development and functional and other types of software testing of SOAP web services and REST web services over HTTP. It is useful for software testers who do SoapUI testing of web services. View my tutorial on SoapUI plugins to see SoapUI Eclipse plugin download, install and SoapUI Eclipse plug in working. Or read on...

Sunday, July 28, 2019

SoapUI Data Driven Testing Groovy

Let us continue with SoapUI testing tutorials. This SoapUI tutorial for beginners is on SoapUI data driven testing with Groovy script. What is data driven testing? It means that you store the test data in some format e.g. in an XML file, an Excel sheet or a database and then use that test data in your tests. The advantage of data driven testing using SoapUI is that you can run your tests with multiple test data values. First view this SoapUI Data Driven Testing Groovy tutorial. Then continue reading.

SoapUI free version does not give the  user interface to create data driven tests. However, SoapUI Pro provides a DataSource test step to get test data from sources like XML files, Excel sheets, files, directories and databases. This test data can be put into SoapUI properties and used in test steps. Also, a DataSource Loop test step is available to loop the previous test steps for each row of test data in the data source.

Note: You can see how to do data driven testing in SoapUI free version in my tutorial on SoapUI Data Driven Testing Groovy.

We can write a Groovy script in Soap UI tool to get the test data and run our test steps. This is how I implemented data-driven testing using Groovy.
  1. There is a library to handle Excel files using Java code, called JExcelApi. I downloaded it from SourceForge. Then I unzipped it. After unzip, the jxl.jar should be copied to the SoapUI lib folder (alternately, it can be copied to the SoapUI bin/ext folder). Then, I re-started Soap UI.
  2. Next, I put my test data in an Excel file. In my case, there were two columns, one for Numbers and the other for the same number in words. I used each Number as a parameter of my test request. SoapUI load test data from file in Excel.
  3. Then, I added a Properties test step. I clicked on the + icon to add properties. There were 5 properties. Number stored the parameter value. Word tested the assertion. Counter, Total and End properties were used in the Groovy script logic. Counter has to have an initial value of 0. End has to have an initial value of False.
  4. Next, I added a Groovy script test step because we have to do data driven testing in SoapUI using groovy script.
    import jxl.* // import Java Excel API library
    def TestCase = context.testCase
    def FilePath = "E:\\Training\\SoapUI\\Files\\NumbersWords.xls"
    def count

    Workbook WorkBook1 = Workbook.getWorkbook(new File(FilePath))
    Sheet Sheet1 = WorkBook1.getSheet(0)
    PropertiesTestStep = TestCase.getTestStepByName("Properties")
    count = PropertiesTestStep.getPropertyValue("Counter").toInteger()

    //If Total records is unknown (at start), get the rowcount from Excel
    if (PropertiesTestStep.getPropertyValue("Total").toString() == "")
        PropertiesTestStep.setPropertyValue("Total", Sheet1.getRows().toString())
    count++

    //Read the Excel test data
    Cell Field1 = Sheet1.getCell(0, count)
    Cell Field2 = Sheet1.getCell(1, count)
    log.info ("Count is " + count.toString() + " Number : " + Field1.getContents() + " Word : " + Field2.getContents())
    WorkBook1.close()

    //Copy the Excel test data to properties in Properties test step
    PropertiesTestStep.setPropertyValue("Number", Field1.getContents())
    PropertiesTestStep.setPropertyValue("Word", Field2.getContents())
    PropertiesTestStep.setPropertyValue("Counter", count.toString())
    if (count == PropertiesTestStep.getPropertyValue("Total").toInteger() - 1)
        PropertiesTestStep.setPropertyValue("End", "True")

  5. Also, I added a Groovy script test step to implement the data loop.
    def TestCase = context.testCase
    PropertiesTestStep = TestCase.getTestStepByName("Properties")
    Stop = PropertiesTestStep.getPropertyValue("End").toString()
    if (Stop=="True")
        log.info("Exit Groovy Script - DataLoop")
    else
        testRunner.gotoStepByName("Groovy Script")
  6. One thing to keep in mind is that the test steps in the test case should have the Groovy script as the first step and Groovy script with data loop as the last step. 
  7. In the request, I put a property expansion as the parameter value. This means that the request read the Number parameter value from the property, Number. In order to test the response, I put an assertion. This assertion also used a property expansion The assertion wa tested against the property, Word.
  8. Ensured that the properties are initialized correctly. Then, I ran the test case. 
  9. After the test case is run, in the Properties test step, Number and Word should have the last row data. Also, in the script log, each Number and Word should have been used.
  10. I also had a cleanup step (disabled in the Step 6 image above) to reset the property values after each run of the test case.
    def TestCase = context.testCase
    PropertiesTestStep = TestCase.getTestStepByName("Properties")
    PropertiesTestStep.setPropertyValue("Number","")
    PropertiesTestStep.setPropertyValue("Word", "")
    PropertiesTestStep.setPropertyValue("Counter", "0")
    PropertiesTestStep.setPropertyValue("Total", "")
    PropertiesTestStep.setPropertyValue("End", "False")
This is how you can also do SoapUI data driven testing with Groovy script. If you want to see this complete Soap UI data driven testing example, it is available in my SoapUI data driven testing tutorial.


Reference : https://www.anilvij.com/how-to-read-data-from-excel-using-groovy-soapui/

Sunday, July 21, 2019

Web service mocking SoapUI

This next SoapUI tutorial for beginners is on web service mocking in Soap UI tool. Web service mocking is a useful feature in SoapUI automation testing. 

What is web service mocking? When a web service is being developed, you have to wait for it to be complete before you can test its' clients. In SoapUI tool, you can start software testing even before the web service is live. How? You can simulate a web service using a mock service. This mock service can be run by SoapUI. You can send requests and get predefined responses from the web service. If you want to see examples of mocking service SoapUI, view my tutorial on Web service mocking Soap UI or read on...

Sunday, July 14, 2019

SoapUI properties

Let us continue with SoapUI testing tutorials. A property in Soap UI tool is a setting of an item. The item can be a SoapUI workspace, a SoapUI project, a SoapUI testsuite, a SoapUI test case, a SoapUI test step or a SoapUI request. The property holds a text value. You can use properties in SoapUI to specify your item. This way, the existing item can work with the settings that you specify. View my SoapUI beginner tutorial on SoapUI properties to see many examples or read on...

Sunday, July 7, 2019

SoapUI workspace

Let us continue with SoapUI testing tutorials. Before you can do SoapUI automation testing, you need to create a project in SoapUI. In SoapUI tool, a project needs to exist within a workspace. Soap UI saves a workspace as an XML file on the computer. The workspace's File property value tells Soap UI tool the location of the workspace directory. View my SoapUI beginner tutorial on Soap UI workspace or read on...

Let us learn how workspace works in SoapUI. By design, you can open only one workspace at a time. SoapUI can only see the projects in your open workspace (also called current workspace or active workspace). A single soapui work space can have multiple projects in it. Figure 1 has WORKSPACE1 open and WORKSPACE2 closed. This means that SoapUI can only see Project1, Project2 and Project3. SoapUI tool cannot see Project4 or Project5. Figure 2 has the reverse situation.
Figure 1 SoapUI Workspaces
Figure 2 SoapUI Workspaces
You may want to have multiple soap ui workspaces e.g. one workspace for each system under test or one workspace for each client. SoapUI workspaces help you to organize your Soap UI automation.

SoapUI provides the following workspace commands:
  • File > New Workspace
  • File > Rename workspace
  • SoapUI change workspace : File > Switch Workspace or  File > Recent > Workspaces
Want to learn more? You can see workspaces demonstrated in SoapUI tool in my Soap UI Beginner Tutorial on SoapUI workspaces.



Sunday, June 30, 2019

SoapUI Tutorial for Beginners (free version)

SoapUI is a a free open source tool to test web services. It can test both SOAP web services and RESTful web services. You can use SoapUI for both functional testing and performance testing of web services. Since SoapUI is written in Java, SoapUI is cross-platform meaning that it can run on multiple operating systems like Windows, Mac OS and Linux.

How to install SoapUI? The steps to install SoapUI free version are very simple. In order to install Soap ui tool, download the SoapUI installer from SoapUI official website. Double-click to run the installer. Select the destination folder, components, tutorials location, Start Menu folder and desktop icon and click Finish. You can see the actual installation of SoapUI on Windows and much more in my SoapUI tutorial for beginners. or read on...

Sunday, June 23, 2019

What is JSON

Every now and then, you must have heard the term, JSON. Let us learn JSON. The JSON full form is JavaScript Object Notation. It is a format for data exchange. Other data interchange formats are CSV and XML. There are several JSON data value types like String, Number, Object etc. View my 10-minute JSON tutorial or read more on JSON data examples...

Sunday, June 16, 2019

Web Services Tutorial

Let us start with an introduction to web services. What is web service? A web service is a software service provided by one device to another device using the web. Web services provide useful information like weather, stock market information, forex rates and many more. The web service runs as a software application on the web service provider. The technologies in which the web service provider and its' clients are written may be different. It does not matter because the communication between the web service provider and its' clients uses standard data formats like XML or JSON. Keep in mind that web services do not have a user interface.

What is Web Service


In the above example, a web server running on Linux provides a web service to a web server running on Windows, which then uses the response data in it's end-user interface. For this to happen, the web service client sends a request to the web service provider and the web service provider sends a response back to the web service client.

Want to learn more? View my 7-minute Web Services Tutorial or read on...

Sunday, June 9, 2019

Cause and Effect Analysis

Cause Effect diagram is a popular technique to establish the root cause(s) of a problem. A cause-and-effect diagram is a visual representation to find out one or more causes of a specific problem. It allows exploration of possible causes. People use it to correct defects in their products or services. Other names for the cause and effect diagram are cause effect graph, herringbone diagram, ishikawa diagram and fishikawa (because it looks like the bones of a fish).

Cause Effect Diagram Template
 

If you want to learn more, please see my cause effect video in my Software and Testing Training channel or read on...

Sunday, June 2, 2019

State Transition Testing Technique with Examples

State Transition Testing is a test design technique, which you can use to design test cases. Now, what is a state in state transition? A state is a particular condition in which the system under test can exist. A state A state has certain attributes or properties and it has a certain behavior. What is transition? A transition is movement from one valid (allowed) state to another valid state. These transitions are tested in state transition testing. View the detailed State Transition Testing tutorial or read on...

Light switch example State Diagram




Let us assume that a lighting system has a switch, an electric circuit and a light. As you can see in the state transition diagram above, there are only two valid states in which this system can exist - OFF and ON. In the OFF state, you can provide an input (turn switch on) to cause a transition to the ON state with the output that the light becomes on. In the ON state, you can provide an input (turn switch off) to cause a transition to OFF state with the output that the light becomes off. In state transition testing, you would test both these transitions i.e. OFF state to ON state and ON state to OFF state.

Car State Diagram example


Let us see another state transition example. The above diagram is also called the the State Graph or the State Chart or State Transition Chart or State Transition Graph. This diagram shows the four possible states of a car - Stopped, Accelerating, Constant Speed and Braking. From the Stopped state, the system can only change to the Accelerating state. From the Accelerating state, it is possible to change to the Constant Speed state and vice versa. From the Constant Speed state, it is possible to change the car to the Braking state and vice versa. From the Braking state, it is possible to change to the Accelerating state and vice versa. Also, from the Braking state, it is possible to change to the Stopped state. Therefore, there are 8 valid transitions (represented by 8 arrows) that you should test.

State Table and State Diagram are related. The same information is shown in the form of a state table or state transition table. The first 8 rows after the header are the valid transitions. The next 4 rows are the invalid transitions. You should also test the invalid transitions to ensure that they are impossible.

StateInputNext State
StoppedPress gas pedal Accelerating
AcceleratingKeep gas pedal constantConstant Speed
AcceleratingSwitch to brake pedalBraking
Constant SpeedPress gas pedal moreAccelerating
Constant SpeedSwitch to brake pedalBraking
BrakingSwitch to gas pedal; press gas pedal moreAccelerating
BrakingSwitch to gas pedalConstant Speed
BrakingKeep brakingStopped
Stopped?Constant Speed
Stopped?Braking
Accelerating?Stopped
Constant Speed?Stopped

You can design state transition testing test cases based on the state transition table. For example, you can write test cases based on the workflows as follows. Ensure that you cover each valid transition and each invalid transition.
Test case 1– Stopped | Accelerating | Constant Speed | Braking | Stopped
Test case 2– Stopped | Accelerating | Braking | Accelerating | Braking | Stopped
Test case 3 – Stopped | Accelerating | Constant Speed | Accelerating | Constant Speed | Braking | Constant Speed | Braking | Stopped
and so on.

I hope that you found the above state diagram examples useful.to understand state transition testing. If you want to learn more, you can view my State Transition Testing tutorial below. I have explained the above concepts in greater detail in it.

Sunday, May 26, 2019

Requirements Analysis in Software Testing Example

What is software requirement? Software requirements are functional or nonfunctional needs that must be provided by the system. They are expressed as statements, typically with examples. Now, what is requirement analysis? Requirements analysis in software testing means careful review of the software requirements with respect to each requirement quality (first column in table below) to find out requirement bugs and fix them. Software requirements analysis is needed for both functional and nonfunctional requirements. Let us understand requirements analysis techniques with examples. The bad requirements have bugs in red. Then I have converted them to good requirements :

Requirement qualityExample of bad requirementExample of good requirement
Atomic Students will be able to enrol to undergraduate courses and post-graduate courses. Students will be able to enrol to undergraduate courses.
Students will be able to enrol to post-graduate courses.
Uniquely identified 1 - Students will be able to enrol to undergraduate courses.
1 - Students will be able to enrol to post-graduate courses.
1 Course enrolment
1.1 - Students will be able to enrol to undergraduate courses.
1 .2 - Students will be able to enrol to post-graduate courses.
Complete A professor user will log into the system by providing his username, password and other relevant information. A professor user will log into the system by providing his username, password and department code.
Consistent and unambiguous A student will have either under-graduate courses or post-graduate courses but not both.
Some courses will be open to both under-graduate and post-graduate students.
A student will have either under-graduate courses or post-graduate courses but not both.
Traceable Maintain student information --- mapped to BRD req. ID ? Maintain student information --- mapped to BRD req. ID 4.1
Prioritized Register Student - Priority 1
Maintain User Information - Priority 1
Enrol courses - Priority 1
View Report Card - Priority 1
Register Student - Priority 1
Maintain User Information - Priority 2
Enrol courses - Priority 1
View Report Card - Priority 3
Testable Each page of the system will load in an acceptable time-frame. Register Student and Enrol Courses pages of the system will load within 5 seconds.


If you want to learn more, I have explained the above requirement analysis examples in detail in the tutorial on my YouTube channel, Software and Testing Training