Subscribe by Email


Showing posts with label Loops. Show all posts
Showing posts with label Loops. Show all posts

Thursday, August 22, 2013

What is a spanning tree?

Spanning tree is an important field in both mathematics and computer science. Mathematically, we define a spanning tree T of an un-directed and connected graph G as a tree consisting of all the vertices and all or some edges of the graph G.
- Spanning tree is defined as a selection of some edges from G forming a tree such that every vertex is spanned by it. 
- This means that every vertex of graph G is present in the spanning tree but there are no loops or cycles. 
- Also, every bridge of the given graph must be present in its spanning tree. 
We can even say that a maximal set of the graph G’s edges containing no cycle or a minimal set of the graph G’s vertices forms a spanning tree. 
- In the field of graph theory, it is common finding the MST or the minimum spanning tree for some weighted graph. 
- There are a number of other optimization problems that require using the minimum spanning trees and other types of spanning trees. 

The other types of spanning trees include the following:
Ø  Maximum spanning tree
Ø  An MST spanning at least k number of vertices.
Ø  An MST having at the most k number of edges per vertex i.e., the degree constrained spanning tree.
Ø  Spanning tree having the largest no. of leaves (this type of spanning tree bears a close relation with the “smallest connected dominating set”).
Ø  Spanning tree with the fewest number of leaves (this spanning tree bears a close relation with the “Hamiltonian path problem”).
Ø  Minimum diameter spanning tree.
Ø  Minimum dilation spanning tree.

- One characteristic property of the spanning trees is that they do not have any cycles. 
- This also means that if you add just an edge to the tree, a cycle will be created. 
- We call this cycle as the fundamental cycle. 
- For each edge in the spanning there exists a distinct fundamental cycle and therefore there arises a one – to – one correspondence among the edges that are not present and the fundamental cycles. 
- For a graph G that is connected and has V vertices, there are V-1 edges in its spanning tree. 
- Therefore, for a general graph composed of E edges, its spanning tree will have E-V+1 number of fundamental cycles.
- For the cycle space of a given spanning tree these fundamental cycles are used. 
- The notion of the fundamental cut set as well as of the fundamental cycle forms a dual.  
- If we delete even one edge from the spanning tree, two disjoint sets will be formed of the vertices. 
- The set of the edges that if taken out from the graph G partitioning the vertices in to same disjoint sets is defined as the fundamental cut set. 
- For a given graph G there are V-1 fundamental cut sets i.e., one corresponding to each spanning tree edge. 
- The fact that the edges of the cycles that do not appear in the spanning tree but only in the cut sets of the edges can be used to establish the relationship between the cycles and the cut sets.

What is Spanning Forest?

- The sub-graph generalizing the spanning tree concept is called the spanning forest. 
- A spanning forest can be defined as a sub-graph consisting in each of the connected component a spanning tree of the graph G or we can call it a maximal cycle free sub graph.
- For counting the number of spanning trees for a complete graph the formula used is known as the cayley’s formula.



Sunday, March 24, 2013

What are types of artificial neural networks?


In this article we discuss the types of artificial neural networks. These models simulate the real life biological system of nervous system.
1. Feed forward neural network: 
- This is the simplest type of neural network that has been ever devised. 
- In these networks the information flow is unidirectional; therefore the data moves only in forward direction. 
- From input nodes data flows to the output nodes via hidden nodes (if there are any). 
- In this model there are no loops or cycles. 
- Different types of units can be used for constructing feed forward networks for example, McCulloch – pitts neurons.
- Continuous neurons are used in error back propagation along with the sigmoidal activation.
2. Radial basis function network: 
- For interpolating in a multi – dimensional space radial basis functions are the most powerful tools. 
- These functions can be built in to criterion of distance with respect to some center.
- These functions can be applied in the neural networks. 
- In these networks, sigmoidal hidden layer transfer characteristic can be replaced by these functions.
3. Kohonen self–organization network: 
- Un–supervised learning is performed with the help of self – organizing map or SOM. 
- This map was an invention of Teuvo Kohonen.
- Few neurons learn mapping points in the input space that could not coordinate in the output space. 
- The dimensions and topology of the input space can be different from those of the output space. SOM makes an attempt for preserving these.
4. Learning vector quantization or LVQ: 
- This can also be considered as neural network architecture. 
- This one also was a suggestion of Teuvo Kohonen.  
- In these prototypical representatives are parameterized along with two important things namely, a classification scheme based - up on distance and a distance measure.
5. Recurrent neural network: 
- These networks are somewhat contrary to the feed forward networks. 
- They offer a bi–directional flow of data.
- On a feed forward network data is propagated linearly from input to output. 
- Data from later stages of processing is also transferred to its earlier stages by this network. 
- Sometimes these also double up as the general sequence processors. 
- Recurrent neural networks have a number of types as mentioned below:
Ø  Fully recurrent network
Ø  Hopfield network
Ø  Boltzmann machine
Ø  Simple recurrent networks
Ø  Echo state network
Ø  Long short term memory network
Ø  Bi – directional RNN
Ø  Hierarchical RNN
Ø  Stochastic neural networks
6. Modular neural networks: 
- As per the studies have shown that human brain works actually as a collection of several small networks rather than as just one huge network, this ultimately helped in realizing the modular neural networks where smaller networks cooperate in solving a problem. 
- Modular networks are also of many types such as:
Ø  Committee of machines: Different networks that work together on a given problem are collectively termed as the committee of machines. The result achieved through this kind of networking is quite better than what is achieved with the others. The result is highly stabilized.
Ø  Associative neural network or ASNN: This is an extension of the previous one. And extends a little beyond the weighted average of various models. This one is a combined form of the k- nearest neighbor technique (kNN) and the feed forward neural networks. Its memory is coincident with that of the training set.
7. Physical neural network: 
- It consists of some resistance material that is electrically adjustable and capable of simulating the artificial synapses.
There are other types of ANNs that do not fall in any of the above categories:
Ø  Holographic associative memory
Ø  Instantaneously trained networks
Ø  Spiking neural networks
Ø  Dynamic neural networks
Ø  Cascading neural networks
Ø  Neuro – fuzzy networks
Ø  Compositional pattern producing networks
Ø  One – shot associative memory


Monday, October 8, 2012

How many ways we can parameterize data in QTP?


Parameterization is one of the important provisions we have in quick test professional which has enabled the passing of the values to the tests very simple. This parameterization feature enables one to pass multiple values at a time to a test.
And what more? 
The process of parameterization has proven to be a great helping hand while carrying out the data driven testing. Data driven testing is the kind of testing that involves working with multiple sets of data on the same tests. 
The quick test professional comes with various ways for carrying out the process of parameterization:
  1. Parameterization via loop statements
  2. Parameterization via data table
  3. Dynamic test data submission
  4. Obtaining test data via front end objects
  5. Getting test data directly from the spread sheets, flat files or we can say external files.
  6. Getting test data directly from the oracle, MSaccess or we can say data bases.
Now we shall discuss the above 6 different ways of parameterizing the tests in detail.
1. Parameterization via loop statements
In this method the sequential numbers or logical numbers can be passed via the loop statements however you cannot pass strings to the tests.

2. Parameterization via data table: 
One data table or spread sheet is provided along every test in quick test professional. The provided data table along with the test can be used very well for the data driven testing. Furthermore the following 3 purposes are served by the data table:
a)   To import the test data from external spread sheets: for doing this open the data table and place the pointer. Then right click and select the import from file option. Then you need to enter the path of the spread sheet to be imported from and hit ok. Later connect to the test.
b)   To import the test data from the external flat files: for doing this open the data table and place the pointer. Then right click and select the import from file option. Then you need to browse the path of the file to imported and press ok. Later connect to the test.
c)   To import the test data from the data bases: for doing this the user needs to first create a DSN of the data base i.e., the data source name by making use of the SQL commands. This can be done by creating a test data base and saving the created data base with .mdb extension in msaccess. Next step involves creation of a data table and filling it up with data. The last step is to create a DSN and you can start importing the data.

    3. Dynamic test data submission: 
   This also involves the use of the loop statements however the data has to be entered again and again by the user.

    4. Obtaining test data via front end objects

   5. Getting test data directly from the spread sheets, flat files or we can say external files.

   6. Getting test data directly from the oracle, MSaccess or we can say data bases.

There is one more method for parameterizing the data apart from those mentioned above and is also less followed. The method makes use of the dictionary object for the purpose of parameterization. There are several types of parameterization namely:
  1. Data table
  2. Environment variable
  3. Random number
  4. Test and action
The data table consists of the following parameters:
  1. Input parameter
  2. Out put parameter
  3. Random number
  4. Environment variable. 


Sunday, September 2, 2012

What are data driven tests and how they are created in WinRunner?


When you go for testing of your software system or application, it serves good if you check the performance of your software system or application with multiple sets of different data for some set of same operations. 
For doing so you can go for creating a data driven test! Let us see in detail what actually the data driven tests are and how you can create one in the winrunner. 

What are Data Driven Tests?

- Data driven tests cuts down on the difficulty of manually executing the same test over and over again. 
- The data driven test is created with a loop that iterates exactly the same number of times as there are sets of data to be implemented. 
- Say the loop executes 20 times, so in all these 20 iterations the loop executes with a different set of data and drives the test with it. 
- Since every time the test is driven by a different set of data, the test has been termed as the data driven test. 
- However, in order to make the winrunner run a data driven wizard, use parametrization which involves the linking of the data to the test script which it is to drive. 
- After parameterization, the data is stored in a table called data table. 
- It is up to you that whether you carry out this whole process on your own manually or you take the assistance of the data driver wizard. 
- Usually a non driven test consists of the following three steps:
  1. Creation of a test
  2. Execution of the test
  3. Analyzation of the test results.
- In data driven testing there are two additional steps are there in addition to the above mentioned 3 steps. 
- These two extra steps lie between the creation of the tests and execution of the tests. 
- These two extra steps are as mentioned below:
  1. Conversion of the test in to a data driven test and
  2. Creation of a corresponding data table.

Stages involved in creation of data driven test

The below stated are all the stages that are involved in the process of data driven test creation:
  1. Creation of a test
  2. Conversion of a data driven test
  3. Preparation of data table
  4. Running the test
  5. Analyzation of the test results.
- You cannot directly convert a test in to a data driven test. 
- For doing so, first it is required that you should create a basic test and then convert it in to a data driven test. 
- This basic test can be created by recording a test with only a single set of data. 
- Now this test is recorded by going to the insert menu, then selecting GUI check point, then “for single property” command.
- This is to ensure that the correct order is open. 
- This order can be later modified and updated. 
- There is an alternative to this, which is that you can create bitmap check points, bitmap synchronization points and data driven GUI check points. 
- Firstly, the values contained in the check point statements and recorded statements with parameters are replaced and a data table is created which stores the values that are to be assigned to the parameters. 
- This is the parameterization process. 
- The functions and statements are added to the test scripts so that they can be read from the data table. 


Sunday, August 26, 2012

Can you test database using WinRunner? What are all the different DB that WinRunner can support?


- The testing of the databases has been made possible using the winrunner with the help of the data base record check points. 
- These runtime data base record check points can be added to the test scripts and data being processed in to information in the application software during the execution of the test can be compared with the corresponding record present in the data base that you want to test. 
- With the help of these check points, it is possible to compare the contents of the data bases of the different versions of the application software.
- Whenever a data base check point is created, a query is defined in the data base of the application and the values contained in the result set are tested by the data base check point. 
- The query can be defined in any one of the following ways:
  1. By using Microsoft query (it can installed from Microsoft office’s custom installation).
  2. Manually by defining an ODBC query i.e., by creating an equivalent SQL statement.
  3. By using data junction for creating a conversion file.
- The data base check point is said to fail when no match is found between the comparison and success criteria that has been specified for that particular check point. 
- A successful run-time data base record check point can be defined as the one where one or more than one matches were found. 
- One major characteristic of these check points is that they can be used in loop as well. 
- Results for all the iterations of the loop are recorded as separate entities. 
- The run time data base record checkpoints can be added to the test in order to make comparisons between the current values in the data base and the information that is being displayed in the application software while a test is in the process of execution.
- The run time record checkpoint wizard can be used for the following purposes:
  1. Defining the query.
  2. Identification of the application controls containing relevant information.
  3. Defining the success criteria of the individual check points.
- While testing your data base you may land in some situations where you may require comparing the data files of different formats. 
- Following the below stated steps for creating a run time data base record check point manually:
  1. Record the application up till where you want the data to be verified on the screen.
  2. Calculate the expected values of the corresponding records in the data base.
  3. Add the expected values to an edit field.
  4. Using GUI map editor teach the winrunner about the controls of the application and the edit fields of the calculated values.
  5. Add TSL statements to the test script in order to calculate the expected data base values extract the values and write the extracted values to the corresponding edit fields.
- Before you run your tests do make sure that all the applications with the edit fields containing the calculated values are open. 
- Earlier we mentioned the term “ODBC” in the article, it is actually a technology which enables the computer to connect to a data base so that the information can be retrieved by the winrunner easily. 
- Those who developed winrunner did not knew what kind of data base the AUT uses so it becomes impossible for the winrunner to know the way to connect to the data base of your application. 
- To overcome this problem, the ODBC was developed which can be taught how to connect to the data base. 
- Thus, it is because of ODBC that almost all the data bases are supportable by the winrunner.


Saturday, August 25, 2012

Explain data parameterization in WinRunner?


Whenever you subject your software system or application to testing, it is obvious for you to think of checking how your software system or application performs with some other multiple sets of data. 
For this what do you do? 
You create some data driven tests with some loops that runs a certain number of times or we can say which runs for how many different sets of data you want the application to be tested with. Each time the iteration of loop takes place, it leads to the testing of the software system or application with a different set of data.
But the winrunner will not simply execute such loops! 
- To make the winrunner use that data for driving the tests it is necessary that you link the data with the particular test script which you want it to drive. 
- This process of linking the data with the test script that it’s going to drive is called parameterizing of the tests.
- The data sets are recorded in the form of a data table. 
- The process of parameterizing the tests can be either carried out manually or you can take the aid of the data driver wizard. 
- The data driver wizard will not only help you in parameterization of your tests but will also help you in storing the data in the data table.
- The conversion of a test in to a data driven test is composed of four major steps and out of which the first important step is the parameterization of the test itself. 
- The process involves the replacement of the fixed values in the following statements:
  1. check point statements
  2. in recorded statements with parameters
- In the next step in this process you have to deal with the setting up of a data table which is suppose to store the values that are to be fed as the arguments to the test. 
- This marks the completion of the parameterization process. 
- Later, the statements and functions are added to the test so that they can be read from the data table and can execute in a loop during each iteration of the loop. 
- Statements are added to that script which is responsible for the opening and closing of the data table. 
- This whole process becomes less head ache when carried out with the help of the data driver wizard. 
- With its aid you can either convert just a part of your script or whole of your script in to a data driven test. 
- In some cases, it happens that even though your test scripts consists of check points, recorded operations, statements etc there is no need to parameterize them, you just want to parameterize the rest of the part of the test script that will be run with multiple sets of data in a loop. 
- In data driver wizard the fixed values in recorded statements and selected check points are replaced by the function “ddt_val”. 
- This function also adds the columns containing variable values to be assigned as parameters. 
- A test script may consist of several statements containing the fixed values entered by the user. 
- There is a dialog box named as “parameterize data dialog box” that can be used for the effective and quick parameterization of the statements and replacement of the data with parameters. 
- For doing this, you need to select the particular instance which consists of the data that is to be parameterized. 
- Then, go for the parameterize data option in table menu and the box opens.
Select the data table and enter the name for the table. 
- Then hit the “add the data to the table box” option. 
- Later, the data in this table can be modified. 


Saturday, May 19, 2012

Explain simple loops in detail?


Loops are such an important programming constructs for various object oriented languages that they cannot be neglected. All of us are aware of the looping constructs that we have in programming languages like C and C++. We have three basic loops:
  1. For loop
  2. While loop
  3. Do while loop

Why Loops are Important?


- Loops find extensive use in programming and they are a means to tell the program to keep executing a set of statements until some break condition is encountered.
- Loops come to be a very handy tool when it comes to the repetition of the whole block of code. 
- It can be done to reduce the length of the code and the task of the programmer or developer of writing the same code again and again innumerable times. 
- In some cases it also happens that the number of times for which the loop is to be executed is obtained from the user, in such cases looping of the particular block of code becomes extremely important. 
-There are many software programs or applications that perform very complex tasks or calculations all by the virtue of the looping constructs. 

Before taking on the loops in to your software program you should be well versed with the true and false concept of the programming language that you are using. Let us discuss all the above mentioned three loops one by one:

                1.  For Loop: 
               Here’s the syntax of the for loop:

For (initialization of the variable; test condition; increment condition)
{
Statement 1;
Statement 2; (code to be executed)
.
.
.
Statement n;
}
In the expression for the initialization of the variable one can declare the variable for the loop and initialize it with the required value. Secondly the test condition is responsible for checking the whether the loop should be executed or not on the basis of the true or false value. The increment condition lastly helps the loop to increment the value of the initialized variable. All of these 3 expressions are separated from each other by semicolon. An empty condition is evaluated to false value.

2. While Loop: 
Here’s the syntax for the while loop:

While( test condition)
{
Statement 1;
.
.
Statement n;
}
According to some programmers the while loops are perhaps the easiest to operate. While loops are supposed to be entry controlled loop since the condition is checked up on the entry itself and based on its true value it is executed. While loops are somewhat like the for loops except that they contain the initialization expression and the update expression inside their body. But the drawback with this loop is that it is quite length. This loop won’t allow the execution of the statements even once if the test condition is evaluated to be false.
      
          3. Do while loop
          Here’s the syntax for the do – while loop:
Do
{
Statement 1;
Statement 2;
.
.
.
Statement n;
} while (test condition)
This loop holds good for the programs in which the execution of a particular block of statements is required at least once irrespective of whether the test condition is true or false. The test condition is encountered in the last and is evaluated. If it is found to be false, then the loop won’t be eligible for a second iteration. Because of this factor the do while loop is commonly known as the exit controlled lop. 


Facebook activity