Thursday, March 20, 2008

software testing issues and solutions

-----------
WatiJ vs. HttpUnit vs. Selenium
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=68&t=001476
- post said use HtmlUnit instead of HttpInput as first is latest project
-----------------------------------------
High level software testing automation components
1. Test data beds
2. capture html pages at server end point before returning to browser
3. capture what user entered ( data or clicks )
4. save .htm files in step 2 and step 3 to server so that 'tester/bug fix developer' can see 'total flow ' as set of html screens saved on a server. just click on links like pag1 , page2 it shows each page in the flow . It should be that simple .
5. server logging of all method flow along with ( values passed ) is also saved .
6. all web pages will have hidden field like <input type="hidden" name="flowStatus" value ="fromflow:REIInput;toflow=ERR_REQIRED_FIRSTNAME;desination=RegSuccess">. WatiJ java code will process this hidden filed after every web GET/POST and compare with expecgted codes and mark the test case as either faiure or success. In WatiJ we write this code
read whole data input into java object
document.firstName = inputObj.getFristName(); // then assingn to watiJ values ..
document.lastName = inputObj.getLastName() ;
document.firstName = hash1.get("firstName"); // use hash instead of above class no burden of creating class .. read data into hashmap
String input_error = read error conditon from the data inptut file . // ERR_REQIRED_FIRSTNAME
flowstat = new FlowStatus(flowstatStr); // read from hidden filed
// FlowStatus class will parse differnet part of the flowStatus string
if ( flowstat.errorEquals(input_error) { test case success}
else { test case failure }


1. Test data beds: this can be in simple form of text file ( may be like FIT , FITNESS test data study )
- each field level exhastive tests are performed with auto generated 'field domain' xml defintions given in the post just below this post .
- the following is simple functional test. The actual strings 'firstName' 'phoneNum' are taken from field definitions file , these should match exact names to what HTTP POST/GET expects . WatiJ scirpt will use this file/names to auto enter the these test values in browser test
errorType | firstName | LastName | phoneNum | Address1 | Address2
ERR_REQIRED_FIRSTNAME |
ERR_REQUIRED_lastName | joe |
ERR_REQUIRED_phoneNum | Joe | hopper
ERR_REQUIRED_address1 | joe | hopper | 4083349890

you see above , the error condition ( that returns in web pages ) is coded in the test case itself .
---------------------------------------------------
When you ask a software engineer 'on Avarge how long does it take to fix a production bug in your software application ?' .
you get many answers, it depends on bug complexity , experience of programmer etc.. Here is the key , even though many of above are true we should have a avarge number . For most of the buisness applications my guess is it is like 1/2 to 1 day depnding on how complex/ easy is the aplication.
Developers spend most of the time in pinponting what exactly caused the bug, often is is hard to re-produce ( bug logged by QA engineer with some screen shots ).
Here is a set of Next genration development tools and practices to cut down software deveopoment time (same goes for bug fixing) by 50% over the current practices .

post 2: how to pinpoint what code change caused this bug
1. The idea is to log each method a use case is traversed in the code and log all those methods.
2. when you see a bug compare the 'code travese' between current version and bug-free base version (prior version).

how to log 'code traverse' methods: on a browser front end provide a key combinagton like CTRL+ALT+L a java script popus a text box enter 'tracking key' like 'UserRegigartionConfirm' a hidden filed is populated with this value and is added to each form submit on the page.
On the server 'key' value is captured and used by aspects to log 'entey' of each method. Use Aspects of Spring to log each method name entry .
3.You repetat same for the bug-free version on a different pool
4. At the end a toll do the Differene of these 2 runs and log only methods that have a difference in code.
5. Using a UI tool go over each method and see what is the diff of the methods , you can easily figure out which method caused this change.

Free File Comparison Utilities - Win Merge
-------------------------------------------
Post 1:
1. All cases business use cases are not captured in one place along with all error codes/conditions
2. incremental data progression is required

let us take REI page with fileds first name, last name , city, state, zip, phoneNumber

we define domains similar to domain names in Database desgin tools ( ERWin ..)


define domains:

nameThing
10
30
[a-z][A-Z][0-9]_-



phone
7
10
[0-9]


now we define fields with requied overridding default values of domain.

nameThing



nameThing


now the test suite will genereate test cases for these automatically like this below. Notice all cases below by default they are negaive test


*(
$(
1$(
$1(
$1a(
a$*(
a
ab
ab345678 // only 8
ab34567890ab34567890ab3456789011 // more than 30
ab3456789 // just 9 , success case for this field , there should NOT be ERRFirstName in output
getTestSuite.get("FirstName") // to read from a DB or flat flie of valid values


Functional testing: for Business applications
- as TestNG creator pointed out in his blog below functional testing is must. so for REI page he is functional test cases

REI-highrisk-user
by annonymous email
Supply Date here ..



REI-highrisk-user
by userid with _5620
Supply Date here ..



REI-lowrisk-user
by non-annonymous email
Supply Date here ..



REI-lowrisk-user
by userid normal
Supply Date here ..

No comments: