Friday, November 26, 2010

Implementing IF..ELSE.. condition in Selenium IDE using Flow Control Add-On

Here I am going to discuss about on how to implement if else condition in selenium IDE.We can't implement the IF ELSE condition using core selenium IDE. To implement IF ELSE logic, you have to install Firefox "Flow Control" Add On. So, please install the "Flow Control" Add On using below URL.

https://addons.mozilla.org/en-US/firefox/addon/85794/

After installed, restart the firefox browser. Now, Flow Control commands available in the selenium IDE.

Here are the commands:

COMMAND| TARGET |VALUE
======================================================
gotoif| CONDITION |LABELNAME
label | LABELNAME|
gotolabel | LABELNAME

Here is the example that i have used:



From the above screenshot, first i am checking whether text("Please select") present in the page using "storeTextPresent" and assign the result to variable "POPUP_EXISTS". Then i am checking whether result is "false" or not. if the result is "false", then skip the next statement and move the execution to "target1"(label). Otherwise, continue the execution to next statement.

Monday, August 30, 2010

Clearing ASP.Net FileUpload Control using jQuery

Here i am going to discuss about on how to clear the file upload control using jQuery. To clear file upload control, you have to place file upload control within the DIV tag like below.

HTML CODE:


<div id="div_fileupload">
<asp:FileUpload ID="fileUpload" runat="server" onkeypress="return false;" />
</div>


jQuery Custom Function:


// Clearing text of file upload control by means of replacing with HTML content.
// you can place this code in your JS file.
$.ClearFileUpload = function (fileUploadControlId) {
try {
document.getElementById(fileUploadControlId).innerHTML = document.getElementById(fileUploadControlId).innerHTML;
$(fileUploadControlId).focus();
} catch (e) {
//alert(e.Description);
}
}


Calling jQuery Custom Function from ASP.Net Design View:



function Checkfiles() {
var value = $('#fileUpload').val().toLowerCase();
if (value.length != 0) {
if (/.*\.(gif)|(jpeg)|(jpg)|(png)$/.test(value))
return true;

$.ClearFileUpload('div_fileupload');
alert('Please Upload Gif or Jpg Images, or Png Files Only.');
return false;
}
else {
return true;
}
}

You can call the above function in your ASP.Net Submit button OnClientClick event with checking the file extensions.

Monday, January 11, 2010

Software Testing Best Practices

Here is the list of best practice tips:

1. Analyze the requirement and problem thoroughly. If not clear, please ask development team lead or Project Manger.

2. Test the application by breaking application into smaller modules.

3. Write the test cases with all possible test data.

4. Always try to finding the bugs in the application. Don’t assume that it will work.

5. Test cases should be available to developer before development starts on that item. So that time consumption will reduce.

6. Prioritize the test cases for all the modules. So that, whenever testing the application you can have checklist.

7. Programmers won’t do the testing completely because they will think that their code is always right. But its tester responsibility to find the loop holes.

8. Don’t stick to requirement on testing and go beyond that.

9. Regression testing is more important. Please have history of bugs related to those modules. So, you can find the bugs easily.

10. Sometimes we will change the application environment for testing. Tester should have knowledge on where we are doing the changes for testing. So, tester should verify those areas after moved to production.

11. Tester should be kept away from developer environment. So that, tester wont gets distracted.

12. Testers should have regular meeting everyday on sharing the latest knowledge and their experience.

13. Have more communication with development lead or developer to avoid misunderstandings and making the application without bugs.

14. Always try to communicate through email.

15. Bug description should be clear, informative. Always, suggest your solution.

16. Testers should be involved right from the requirement phase of the application.

17. Update your testing knowledge daily by reading articles and discussion with others.

18. Performance testing needs to be done if more users using the web application.

19. Monitor your testing knowledge daily or weekly. So that, you came to know what you learned from today, what you have improved on your testing and what needs to be done to achieve to more.

20. Make sure that you are following above practices and other good practices.