Web Automated Test for SharePoint



Similar documents
STUDY AND ANALYSIS OF AUTOMATION TESTING TECHNIQUES

Continuous Integration

Cloud Services ADM. Agent Deployment Guide

Active Directory Management. Agent Deployment Guide

Visual Studio.NET Database Projects

Automation using Selenium

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

GUI Test Automation How-To Tips

Getting Started with MozyPro Online Backup Online Software from Time Warner Cable Business Class

Load testing with. WAPT Cloud. Quick Start Guide

Selenium Automation set up with TestNG and Eclipse- A Beginners Guide

Installation / Backup \ Restore of a Coffalyser.Net server database using SQL management studio

TestTrack Test Case Management Quick Start Guide

Human Computer Interaction Final Project Tutorial. Hardware Inventory Management System (HIMS) By M. Michael Nourai

How to Log in to LDRPS-Web v10 (L10)

Table of Contents. Search Results.21. Equipment Change Request...10 Equipment Removal Request...11 Disposed..12 Not found 12

GP REPORTS VIEWER USER GUIDE

ATTENTION: End users should take note that Main Line Health has not verified within a Citrix

How to install and use the File Sharing Outlook Plugin

SmartBar for MS CRM 2013

QEx Whitepaper. Automation Testing Pillar: Selenium. Naveen Saxena. AuthOr:

Weston Public Schools Virtual Desktop Access Instructions

Installing and Sending with DocuSign for NetSuite v2.2

NetWrix SQL Server Change Reporter. Quick Start Guide

Specify the location of an HTML control stored in the application repository. See Using the XPath search method, page 2.

Grandstream Networks, Inc.

To set up Egnyte so employees can log in using SSO, follow the steps below to configure VMware Horizon and Egnyte to work with each other.

Online Backup and Recovery Manager Setup for Microsoft Windows.

Server Installation: ServerTools

Cascade Server CMS Quick Start Guide

Getting Started - The Control Panel

How to Use Remote Access Using Internet Explorer

Automated tests on websites using Selenium-IDE.

NetWrix SQL Server Change Reporter

Creating a Hyperlink to a Tegrity Recording

Verizon Remote Access User Guide

Stellar Phoenix. SQL Database Repair 6.0. Installation Guide

Project management integrated into Outlook

Taleo Enterprise. Career Section Branding Definition. Version 7.5

Working with RD Web Access in Windows Server 2012

FPT UNIVERSITY. Capstone Project

Acunetix Web Vulnerability Scanner. Getting Started. By Acunetix Ltd.

MONAHRQ Installation Permissions Guide. Version 2.0.4

OpenClinica SSL VPN Access New User Setup Guide

Intranet Website Solution Based on Microsoft SharePoint Server Foundation 2010

Recommended Browser Setting for MySBU Portal

ResPAK Internet Module

NETWRIX CHANGE REPORTER SUITE

Attix5 Pro Server Edition

Active Interest Media File Transfer Server Initial Client Install Documentation

CA /BrightStor ARCserve9 Backup Software

SharePoint Online Quick Reference

Rational Quality Manager. Quick Start Tutorial

SPHOL207: Database Snapshots with SharePoint 2013

Egnyte Single Sign-On (SSO) Installation for OneLogin

603: Enhancing mobile device experience with NetScaler MobileStream Hands-on Lab Exercise Guide

SharePoint List Filter Favorites Installation Instruction

Cloudfinder for Office 365 User Guide. November 2013

USING MYWEBSQL FIGURE 1: FIRST AUTHENTICATION LAYER (ENTER YOUR REGULAR SIMMONS USERNAME AND PASSWORD)

Title: SharePoint Advanced Training

Appointment Scheduler

Connecting to LRDC Fileserver Remotely Using Windows Vista/7 & SRemote VPN

EzyScript User Manual

System Protection for Hyper-V Whitepaper

DiskPulse DISK CHANGE MONITOR

Desktop, Web and Mobile Testing Tutorials

Using Outlook Web Access (OWA) & Remote Web Workplace

Appendix A How to create a data-sharing lab

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Designing and Implementing Forms 34

Bitrix Site Manager ASP.NET. Installation Guide

Gigabyte Management Console User s Guide (For ASPEED AST 2400 Chipset)

Creating Personal Web Sites Using SharePoint Designer 2007

StorSimple Appliance Quick Start Guide

Quick Start Guide. User Manual. 1 March 2012

Gigabyte Content Management System Console User s Guide. Version: 0.1

INTRODUCTION 5 COLLABORATION RIBBON 5 SELECT THE UPDATING METHOD 6 MAKE YOUR PROJECT COLLABORATIVE 8 PROCESSING RECEIVED TASK UPDATES 9

How To Backup In Cisco Uk Central And Cisco Cusd (Cisco) Cusm (Custodian) (Cusd) (Uk) (Usd).Com) (Ucs) (Cyse

XEN Web Portal Instructions

Customising Your Mobile Payment Pages

2. PMP New Computer Installation. & Networking Instructions

SINGLE NUMBER SERVICE - MY SERVICES MANAGEMENT

Manual. CollabNet Subversion Connector to HP Quality Center. Version 1.2

iglobe CRM SharePoint App Documentation Version Thursday, January 30, 2014 Support contact iglobe:

Guarantee Trust Life Insurance Company. Agent Portal Agent Portal Guide

Team Foundation Server 2013 Installation Guide

Using Adobe Dreamweaver CS4 (10.0)

DarwiNet Client Level

SelectSurvey.NET Developers Manual

IBM Business Monitor V8.0 Global monitoring context lab

Quick Instructions Installing on a VPS (Virtual Private Server)

ScrumDesk Quick Start

Tutorial: Creating a form that s the results to you.

TeamViewer 9 Manual Management Console

2X ApplicationServer & LoadBalancer Manual

Agile Web Application Testing

Microsoft Expression Web

Hermes.Net Web Campaign Page 2 26

Transcription:

Pôles Universitaires Français, Ho Chi Minh City Internship Report Master of Software Engineering (2008-2010) Web Automated Test for SharePoint Author: Pham Hoang Bich Tram Supervisors: Le Do Anh Phong Nguyen Huu Hung December 7, 2010

Abstract Testing is a repeated task in software development. Every time source code are changed or before each release, testing should be repeated to make sure no error. To manually test costs man power, time and money. In addition, repeating tests might cause boredom for testers and human errors are unavoided so automated test is indeed necessary. Also, GUI 1 automated test is difficult because it breaks easily especial in the first stage of project. I am tasked to provide an automated test for SharePoint web. It is challenging to automate this kind of web because the way JavaScripts are used. Maintain test script that works with changing UI 2 will mostly depending on a chosen automated testing tool. If selecting a tool that locate object by its identify, the work is simpler because it is independent from GUI. Moreover, this web is made from SharePoint 2007 so it just works well on Internet Explorer. In ELCA Company, the developer has to do the tests and time for tests is limited so the language of test script should be same with them. So the chosen web automated test tool must meet that requirements. I use WatiN to automate the tests. It is a free tool but has many good features: automates all major HTML elements, find elements by multiple attributes, supports AJAX, frames and iframes, popup dialogs, etc. In addition, it is easy to use WatiN to create test script with C# language without learning new language. I have completed my assignments using WatiN and found a bigger challenge in this project on how to automate SharePoint context menus and the solution is left to my future work. 1 Graphical User Interface 2 User Interface

Contents Abstract 1 Acknowledgement 5 1 Introduction 6 1.1 Context........................................ 6 1.2 ELCA Company................................... 6 1.3 Microsoft SharePoint................................. 6 1.4 My tasks........................................ 7 2 Automated test 8 2.1 Term in testing.................................... 8 2.2 Automated test overview............................... 8 2.2.1 Definition of automated test......................... 8 2.2.2 Pros and cons of automated test....................... 8 2.3 What test case should be automated?........................ 9 2.4 How to create automated tests which are independent of UI changes....... 9 2.5 Web automated test tool selection.......................... 10 3 Implementation 12 3.1 Class diagram of test scenarios............................ 12 3.2 The tools....................................... 13 3.3 How to create and run test scripts.......................... 13 3.4 Problems and solutions during automated test................... 14 3.4.1 Ensure the same starting point for every run................ 14 3.4.2 How to create easy maintenance test data to automatically fill in create/edit forms................................. 15 3.4.3 Can t add a web part into web page..................... 15 3.4.4 Can t select item in select column in grid view............... 16 3.4.5 Can t record dynamic element........................ 17 4 Results and future works 19 4.1 Results......................................... 19 4.2 Future works..................................... 19 1

Bibliography 20

List of Figures 2.1 Login Screen...................................... 11 3.1 Class diagram of test scenarios............................ 12 3.2 Add reference..................................... 13 3.3 Results of running test suite successfully...................... 14 3.4 Test data for registering users............................ 15 3.5 Web part dialog.................................... 16 3.6 Grid view of contacts list before and after executing JavaScript.......... 17 3.7 SharePoint context menus.............................. 18 3

List of Tables 2.1 Tool comparison.................................... 11 4

Acknowledgements I would like to thank Jean-Paul Tschumi - General Director of ELCA Information Technology Limited Company in Vietnam for giving me a chance to do my internship at ELCA. I would like to thank my supervisors, Le Do Anh Phong - project leader of the project that I am tasked to provide automated test and Nguyen Huu Hung - group leader for all their guidance and support. 5

Chapter 1 Introduction 1.1 Context My internship at ELCA Company is a requirement for completing my Master degree of Software Engineering at the Pôles Universitaires Français 1, Ho Chi Minh City. My internship lasted 4 months from the beginning of July 2010. Software verification is one of the challenging and interesting topics that I have chosen to do with ELCA. And I was tasked to provide automated test for the web. 1.2 ELCA Company ELCA 2 is an IT Services Company of Switzerland. It is established in 1968 and present in Vietnam since 1998. It supplies services in software development, system integration and business consulting. ELCA Vietnam is the group s first offshore software development center. Its main mission is to support the mother company (the Contractor) serving clients throughout Europe and the world. Every year, ELCA has more than 200 projects in many domains such as Banking, Insurance, Healthcare, Government, Transportation and Ticketing. It has achieved CMMI 3 standards. 1.3 Microsoft SharePoint SharePoint 4 is a family of software products developed by Microsoft for collaboration, file sharing and web publishing. Microsoft SharePoint is a powerful software package that help people to work together. Using SharePoint, people can set up Web sites to share information with others, manage documents, publish reports and eventually helps everyone makes better decisions. 1 http://www.puf.edu.vn 2 http://elca.ch 3 http://www.sas.sei.cmu.edu/pars/pars_detail.aspx?a=14657 4 http://sharepoint.microsoft.com 6

1.4 My tasks ELCA Company is building an extranet for an international organization to allow controlled access to its remote clients from outside under a collaborative platform. ELCA is responsible for delivering softwares and also build new services, functions and add-ons to released products per clients request while maintaining current system, making updates and corrective releases to previous versions. Every time new services are developed, regression test must be done to detect errors and ensure the web still works with the new development. I m tasked to provide automated tests for the web focusing on regression tests and functional tests. The task is broken down as followed: Study automated test Study the business of project Select an appropriate tool to use for automated test Create a test suite including all test requirements Maintain an dynamic test suite which reacts to source code changes Detect and solve problems generated when automated test is applied to SharePoint web

Chapter 2 Automated test 2.1 Term in testing Manual testing: is a part of software testing that testers run the test and input parameters manually. Regression testing: is the testing of a previously tested programs to ensure original functions of the program are not compromised when producing new modifications. Functional testing: is a test to make sure software is meeting requirements and error free. 2.2 Automated test overview 2.2.1 Definition of automated test Test automation 1 is the process of using certain software for the purpose of controlling the implementation and execution of tests, comparing the results or outcomes of the same to those which were predicted or foreseen. 2.2.2 Pros and cons of automated test Automated test has many advantages and disadvantages 2. Pros: Reusability: Test suite can be used on different software versions or on different support environments 1 http://en.wikipedia.org/wiki/test_automation 2 http://www.softwaretestinggenius.com/articaldetails.php?qry=88 8

Repeatability: Repeat tests every time source code changes to detect regression errors more quickly without human errors Cons: Better quality: High cost: Increase the test frequency to ensure quality Improve test coverage with minimum resources Save time for manual testers to do other tests Improve reliability and consistency of the testing process as well as increase confidence in software quality Select an appropriate tool and learning curve time Hard to write an easily maintainable test suite which is suitable to all source code changes Maintain test script is costly if you just record and playback the test because it easily breaks when UI changes 2.3 What test case should be automated? It is important to choose what test cases should be automated [1]. Test cases for automation are: Tests that run frequently: Tests run on many different environments - all support operating systems and hardware configurations. Functions are used frequently. Tests that consume a lot of time when do manually and require a lot of input data. 2.4 How to create automated tests which are independent of UI changes Create automated tests which are resistant to UI changes [1] are the most important thing to cut down the maintenance cost. To do this, it depends on your chosen tool and the way you write your code. There are a lot of ways to locate an object on the screen by relying on all its attributes but the best way is to rely on its identity. With that way, when the UI changes, the tests are still resistant.

Create a unique name for each control when you develop the project Choose an automated testing tool which relies on that unique name to find the control 2.5 Web automated test tool selection I am tasked to select one of the 4 following tools that the project leader suggested: Canoo Web Test 3 Selenium 4 Squish 5 WatiN 6 This project is made from SharePoint 2007 so it just works best on Windows Server and Internet Explorer 7 and 8. Base on its support environment, the web automated test tool must have the following criteria (see table 2.1). I selected WatiN for the following reasons: Meet all requirements of tool selection It is free C# is the test script language that the ELCA developers are using. In ELCA, developer does the test so it is easy for them to write test script without learning new language. In SharePoint, identify of control is a sequence of character that is automatically generated. It has two parts: the head of the sequence is not the same in every run. The end of the sequence is the name of the control so it is difficult to find the control with whole sequence of identify. We just find the control by using the end of the sequence. And WatiN has method EndW iths(string) that is suitable to locate the control in this case (see example in the next page). 3 http://www.webtest.canoo.com 4 http://www.seleniumhq.org 5 http://frologic.com 6 http://watin.sourceforge.net

Example: ID of text field User name: Figure 2.1: Login Screen Find that control by simple way: m_ie. TextField ( Find. ById ( item => item. EndWith (" UserName "))). TypeText (" loginname "); WatiN Squish Selenium Canoo Web Test Browser: IE 7 Yes Yes Yes No and 8 Language of C# JavaScript, Selenese(its XML test script Python, Perl, Tcl own scripting language) Frame/Iframe Yes Yes Yes Don t know support Ajax support Yes Yes Yes (but restricted) Don t know JavaScript Yes Yes Yes Yes Recorder Yes (use external Yes Yes (just record Yes (use external tool WatiN Test Recorder) on FireFox) tool, just record on FireFox) Wait for page Yes Yes Yes (but not Support only fully loads completed) HTML standard Price Free Commercial Free Free Table 2.1: Tool comparison

Chapter 3 Implementation 3.1 Class diagram of test scenarios In this project, I am tasked to provide automated test for a part of project which is NocNetTest. Because of confidentiality, ELCA requires me not to talk about their customers so all pictures or screens in this report are not same with the real project. And the following picture is a part of class diagram of test. Figure 3.1: Class diagram of test scenarios BaseTest class: Contents methods SetU p(), T eardown() and all methods are used commonly for all test parts. SetUp() is used to instantiate objects needed to run test and 12

T eardown() is used to clean up and dispose of objects after running test. Each test scenarios begins with SetU p() and finishes with T eardown(). NocNetTest class: Contents all test scenarios of my part. 3.2 The tools These are tools that I used to provide automated test for the web: Microsoft Visual Studio 2008 Standard Edition 1 WatiN 2.0 WatiN Test Recorder 1.3 2 NUnit 2.5.2 3 Microsoft Visual Studio and WatiN were used to create test suite. If you are new in WatiN, you should have WatiN Test Recorder to help create test script easily by its record function. Then, use NUnit to execute the test suite. 3.3 How to create and run test scripts To create test scripts, the following steps must be followed: 1. Create a project in Microsoft Visual Studio and in Reference of the project, add nunit.framework of NUnit and WatiN.Core, WatiN.Core.UnitTests of WatiN (see figure 3.2). Then, create test script normally. 2. Build project into an.dll file or.exe file. 3. Launch NUnit and open above.dll/.exe file. Click Run button to execute tests, if results of all tests are same with the expected results, the progress bar is colored green, and red if there are any failures (see figure 3.3). 1 http://www.microsoft.com/visualstudio/en-us/products/2008-editions 2 http://watintestrecord.sourceforge.net/ 3 http://www.nunit.org/ Figure 3.2: Add reference

Figure 3.3: Results of running test suite successfully 3.4 Problems and solutions during automated test 3.4.1 Ensure the same starting point for every run We must prepare all predefined test data and use same predefined test data to begin the tests. After running the tests, we must come back to initial state of the web to run the tests again. Solution 1: Backup and restore database before and after running tests: require the testers know how to backup and restore database. Solution 2: easier than solution 2 Use snapshot function of VMware 4 application. - Prepare test environment and then take a snapshot of VMware. - Run tests. - Revert to snapshot which has just been taken to have same starting point for next test. 4 http://www.vmware.com

3.4.2 How to create easy maintenance test data to automatically fill in create/edit forms I used hard coded test data with a sequence number as suffixes. Each time a test is executed, that sequence number is automatically increased one unit. For example, when I test register user function, I use login name as usersquencenumber. When the test is first run, login name will be user1, and user2 for the second run, etc. Doing this way, I don t need to back up and restore database before and after running tests because the test data are always unique. Problem, it is difficult to check data that are existed in the web after creating new or editing an object. In particular, we can t determine which page that object is in when the data are growing and are contained in many pages. Solution: I use a free test data generator tool at web site http://www.generatedata.com to generate test data in an Excel sheet. All input data for each specific group of test cases is organized like a table. We can read data from Excel sheet like reading a table in database and it is easy to edit or modify data in Excel sheet. For example: test data for registering users: Figure 3.4: Test data for registering users 3.4.3 Can t add a web part into web page Web part 5 is an integrated set of controls that end users can add into a web page.it enable end users to modify the content, appearance, and behavior of Web pages directly in a browser. Solution: Consider Web part dialog as an HtmlDialog, add a AlertAndConfirmDialogHandler into browser m_iexplorer to control that Web part dialog. This is code for adding a web part into web page: // add web part into page AlertAndConfirmDialogHandler webparthandler = new AlertAndConfirmDialogHandler (); HtmlDialog webpartdialog ; // add a AlertAndConfirmDialogHandler to browser before opening web part dialog m_ iexplorer. AddDialogHandler ( webparthandler ); 5 http://msdn.microsoft.com/en-us/library/e0s9t4ck.aspx

Figure 3.5: Web part dialog // open web part dialog m_iexplorer. Link ( Find. ByTitle (" Add a Web Part ( opens in new window )")). ClickNoWait (); webpartdialog = m_ iexplorer. HtmlDialog ( Find. ByTitle (" Add Web Parts ")); // select a web part that you want to add into web page webpartdialog. CheckBox ( Find. ByTitle ( item => item. Contains ( pageinformation [" WebPart "]. ToString ()))). Checked = true ; webpartdialog. Button ( Find. ById ( item => item. EndsWith (" btnok "))). Click (); // close web part dialog webpartdialog. Close (); 3.4.4 Can t select item in select column in grid view In grid view, can t select item that we want because it has only one same text attribute for all items in column that has select link. So we can t distinguish items. Solution: Execute JavaScript on the page to replace "Select" by corresponding name in Name column and now it is easy to select whatever contact name that you need.

Figure 3.6: Grid view of contacts list before and after executing JavaScript This is the JavaScript code: // run script to replace " Select " by the name in next column m_iexplorer. RunScript (@" var table = $( table.ms - listviewtable ) [0]; for ( var i = 1; i < table. rows. length ;i ++) { var select = table. rows [i]. cells [0]. firstchild ; if ( select!= null ){ var text = table. rows [i]. cells [1]. firstchild. innerhtml ; select. innerhtml = text ; } }") ; // select contact name that you want m_iexplorer. Link ( Find. ByText ( contactname )). Click (); 3.4.5 Can t record dynamic element SharePoint web has a lot of context menus that are made from JavaScript and automatically generated with tag < ie : menuitem... >< /ie : menuitem >. It is not the standard HTML tag so the tool doesn t understand these tags. Example: Source code of Create Page menu item <ie: menuitem id =" ctl00_placeholdermainnavigation_siteactionsmenumain_ctl00_wsacreatepage " type =" option " iconsrc ="/ images / crtpage. gif " onmenuclick =" window. location = / CreatePage. aspx ;" text =" Create Page " description =" Create a page in this site." menugroupid ="100" > </ie: menuitem >

Figure 3.7: SharePoint context menus Solution: There is no good solution for this challenge till now. I try to find many ways to automate the menus but they almost don t work. With the following code, WatiN tool finds the Create Page menu item and clicks on it but the browser doesn t go to URL of that menu item: // open context menu Site Actions m_iexplorer. Link ( Find. ById ( item => item. EndsWith (" SiteActionsMenu "))). Click (); // find Create Page menu item and click on it m_iexplorer. TableCell ( Find. ById ( item => item. EndsWith (" CreatePage "))). Click (); In order to continue my works, I temporarily work around by going directly to URL of corresponding menu item. // go directly to URL of Create Page menu item m_ iexplorer. GoTo (" replace by url of Create Page ");

Chapter 4 Results and future works 4.1 Results I have finished all my tasks. This internship gives me a lot of knowledge about testing. Create test suite includes all requirement test cases. Project manager uses test suite weekly for regression test and functional test before each delivery. 4.2 Future works There is a challenge in section 3.4.5 that has not had good solution yet. In the future, find the appropriate solution for this challenge. 19

Bibliography [1] SmartBear Software. 6 tips to get started with automated testing. White paper. Available online (7 pages). 20