Skip to main content

Combinatorial Testing

Combinatorial testing is a testing technique which is applied by combining the meaningful input as test cases. This method aims to reduce the number of test cases depends on the studies, which show that combinations of one value (one-pair) test cases can detect 20% to 68% of the defects; and combinations of two values (two-pair) test cases cover 65% to 97% of defects; and the combinations of more input values have higher defect-detection-ratio. If you remember the 7-testing-princible, I will mention two of them as “Testing shows presence of defects” and “Exhaustive testing is impossible”. These items explains that when we test an application we can only say that we have found these incidents which may be defect or not, but we cannot conclude that there is no defect remains in the system since you cannot find a %100 defect free application in the real world. What is more, testing the whole system including all part of the features and every line in the code base with every integration points in the system is a dream of daydreamers. Since, the aim of test engineering is to increase the efficiency of the testing process, combinatorial testing is very helpful on reducing the time spent for ineffective test inputs. The combinatorial testing can be divided into following applicable testing techniques: 
  • Category-Partition Testing
  • Pairwise Testing

Category-Partition Testing

This technique enables testers to create test cases by depending on the functional specification of a program. To create test cases, testers should understand the parameters of the functions which the program generates different result. Since the input values (as parameters of the function) can be classified (or taken into categories) test cases can be generated. Generally test cases can be generated by tools, so that program is tested by a systematic approach. This method can be applied with following steps:
  1. Separate the requirements of the function so that test cases can be isolated
  2. Discover the functional units by the help of requirement or specification for testing in isolation
  3. Find input values (as parameters of the function) and specifications of test environments
  4. Identify the categories by the help of the parameters and environments
  5. Define the inhibition between the categories
  6. Prepare the test specification by depending on the categories, inhibition, and parameters. Using Test Specification Language can be more helpful.
  7. Create test frame. Test case generator can be used. The important point each categories should have one test frame.
  8. Create test case for every options in each test frames 
More information can be found at this document which will take you to 1988. 

Pairwise Testing


Pairwise testing is combining the input variables with systematical way as for creating test cases which covers the defined number-of-pairs. The meaning of “pair” shows the degree of combination of parameters, as an example 2-pair or pairwise means that there should be at least one combination for every combination of each two-parameters. As I explained, since testing all combinations of takes a long time pairwise testing is very effective for finding defects.

Pairwise testing is based on “Othogonal Array” in mathematics. Orthogonal array or matrix is a matrix which has number of t ordered coloums in which every coloums and the other coloums composed of the variables of ordered coloums, total number of each variables occur the same number of time. The called t is the strenght of the orthogonal array. For example, if the t is 2 and the coloums can have values as 1, 2, 3 then the following matrix is an othogonal array: First and the second coloums has ordered numbers of 1, 2, 3 so the other variables should be composed of these numbers. Total number of occurance of each variables is set to 9.



1
1
1
 1
2
2
1
3
3
2
1
2
2
2
1
2
3
1
3
1
3
3
2
3
 
After the orthogonal array is clarified explanations of the pairwise testing become easier, because it is the application of orthogonal array on testing. The differences are about in testing there are different number of parameters but orthogonal array it is fixed to the variables of ordered columns and in testing the parameters can be different that numbers. In pairwise testing the following parameters should be known:

Level: Number of parameter as input values

Index: If every parameter has the same number of options then the index is the number of option. Index is a must for Orthogonal Array but for testing, there is no assumption about this. If there is no index the array is called as Mixed-Alphabet Orthogonal Array.

Strength: number of pairs

The following examples are conculed the method; in this example we have three parameters which can have following values as A, B, C; 1, 2; X, Y which means that the number of combinations 3 x 2 x 2 = 12. If we want to test just 2-pairs or pairwise testing which covers every possible combination of two parameters, there should be 6 combinations. The highlighted test cases TC2, TC3, TC5, TC8, TC10, TC11 are not neccessary. 



 
There are some tools for test case production, this make it easier and faster. You can find more information about the subject and tools for test case creation on the following links:

Popular posts for software testing and automation

Selenium Error "Element is not currently interactable and may not be manipulated"

Selenium webdriver can drive different browsers like as Firefox, Chrome or Internet Explorer. These browsers actually cover the majority of internet users, so testing these browsers possibly covers the 90% of the internet users. However, there is no guaranty that the same automation scripts can work without a failure on these three browsers. For this reason, automation code should be error-prone for the browsers you want to cover. The following error is caught when the test script run for Chrome and Internet Explorer, but surprisingly there is no error for the Firefox. Selenium gives an error like below: Traceback (most recent call last):   File "D:\workspace\sample_project\sample_run.py", line 10, in <module>     m.login()   File "D:\workspace\ sample_project \test_case_imps.py", line 335, in login     driver.find_element_by_id("id_username").clear()   File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\r

Change Default Timeout and Wait Time of Capybara

One of the biggest challenge for automation is handling timeout problem. Most of the time, timeout is 60 seconds but it may sometimes not enough if you have badly designed asynchronous calls or the third party ajax calls. This makes handling timeout more complex. set large enough to tolerate network related problems. For Selenium based automation frameworks, like Capybara, default Webdriver timeout is set to Net::ReadTimeout (Net::ReadTimeout) Changing ReadTimeout If you have timeout problem for Capybara, it gives an error like above. This means that the page is not fully loaded in given timeout period. Even you can see that page is loaded correctly but webdriver wait until the Ajax calls finish. class BufferedIO #:nodoc: internal use only def initialize (io) @io = io @read_timeout = 60 @continue_timeout = nil @debug_output = nil @rbuf = '' end . . . . . def rbuf_fill beg

Page-Object Pattern for Selenium Test Automation with Python

Page-object model is a pattern that you can apply it to develop efficient automation framework. With the page-model, it is possible to minimize maintenance cost. Basically page-object means that your every page is inherited from a base class which includes basic functionalities for every page. If you have some new functionalities that every page should have, you can simple add it to the base class. Base class is like the following: In this part we are creating pages which are inherited from base page. Every page has its own functionalities written as python functions. Some functions return to a new page, it means that these functions leave the current page and produce a new page. You should write as much as functions you need in the assertion part because this is the only part you can use the webdriver functions to interact with web pages . This part can be evaluate as providing data to assertion part.   The last part is related to asserting your test cases against to the

Create an Alias for Interactive Console Work: Selenium and Capybara

If you are working on shell most of the time Aliases are very helpfull and time saving. For testing purposes you can use Alias for getting ready your test suites. In this post, I want to explain both running Selenium and Capybara on console and creating aliases for each.  This post is for Windows machines, if you are using Unix-like see   this post . Creating Scripts for Selenium and Capybara First of all, it is assumed that you have installed Selenium and Capybara correctly and they work on your machines. If you haven't installed, you can see my previous posts. I am using the Selenium with Python and the Capybara with Ruby. You can use several different language for Selenium but Capybara works only with Ruby.  Create scripts in a directory called scripts (in your home folder, like as  ~/scripts ) for your automation tool as following, save them as capybara.rb, sel.py :  Creating Aliases Depends on your favourite shell, you need to add the alias to .bashrc bash

Performance Testing on CI: Locust is running on Jenkins

For a successful Continuous Integration pipeline, there should be jobs for testing the performance of the application. It is necessary if the application is still performing well. Generally performance testing is thought as kinds of activities performed one step before going to live. In general approach it is true but don't forget to test your application's performance as soon as there is an testable software, such as an api end point, functions, and etc. For CI it is a good approach to testing performance after functional testing and just before the deployment of next stage. In this post, I want to share some info about Jenkins and Locust. In my previous post you can find some information about Locust and Jenkins. Jenkins operates the CI environment and Locust is a tool for performance testing. To run the Locust on Jenkins you need command line arguments which control the number of clients ,   hatch rate,  running locust without web interface and there should be so