Friday, March 31, 2017

Product owner in scrum team | David Tzemach


The product owner (PO) role was established once the scrum framework was created to address issues that engineering teams faced during a product development, the main and most important activity that is expected from the PO, is to provide a single point of information that can remove obstacles during the development process.

תוצאת תמונה עבור ‪Product owner in scrum funny‬‏

In addition, the traditional role of the product owner(PO) in scrum contains some additional responsibilities and activities that are involved in different phases of the scrum process, based on the theoretical approach we can divide them into tree main categories:

Product owner (PO) & Scrum backlogs

  • Splitting user stories which are too big for a single iteration (Epics).
  • Determine the stories DoD and approve it in the review meeting.
  • Determine the stories acceptance criteria.
  • Prioritize user stories based on ROI.
  • Maintain the product backlog
  • Writing user stories.


Product owner (PO) & Scrum Team

  • Provide the user stories and targets for the next iteration (Planning meeting).
  • Help the team to remove any obstacles that any affect their performance.
  • Help the team to improve by taking real actions (Retrospective meeting).
  • Measuring the team progress based on commitment and velocity.
  • Communicate the product vision to the team.
  • Provide feedback to the team and determine the quality of the iteration deliverables (Sprint review).
  • Participating in daily scrum meetings to be able to adapt and inspect the current progress.


Product owner (PO) & Core Activities  

  • Make real business decisions that can affect the entire project.
  • Communicate the project status to external resources.
  • Provide the vision and goals for the project.
  • Have the final authority when needed.
  • Determine the project release dates.

Product owner Vs Task Manager

Take a few minutes and think about the list above, can you see the problem? There is no way that a single resource can actually perform all of those activities and to be honest it will most likely never happen, a “single point of information” has all the chances to become a “Single Point of Failure” and therefore we must understand that the Scrum theory is truly great on paper but does not relevant once you need to implement it.

Know this, the PO can be the resource that can determine the project vision and maintain the backlog stories, but it will most likely be a different person that actually owns the product and communicate with the stakeholders (Senior management, Clients, Budgets Etc.).

The Characteristics of a true product owner

Leadership - A good PO will provide a clear and informative vision for the team, it’s his responsibility to make sure that the scrum team will understand the project goals and what is expected from them.

Availability and communication - The product owner should be available for the scrum team, simple has that, a good communication is the key to every project and especially in scrum process.

Aim for continues improvement - The PO should aim to improve the process per iteration, it’s one of his major responsibilities to make sure that the scrum team will improve through time.

Experienced -  The PO role possesses many activities such as determine the goals, vision, and ROI of the project, to be able to determine each one of them, the PO should have the experience needed to deal with these challenges in a way that does not affect the project goals.

Adaptable to changes - As you know, in scrum we embrace changes that can raise during the SDLC, a good PO is not afraid to confront these changes and resolve them in a way that does not affect the project goals and vision.

Trust the Scrum team – A good PO, will trust the team once they determine their sprint commitments, a good PO will provide the freedom needed for the team to grow and manage their tasks throughout the iterations. 

Saturday, March 25, 2017

Selenium WebDriver – Using the Text Field and Button elements (C#)

תמונה קשורהI think that you can agree with me that these two elements are a mandatory part of any software that you will need to test; the next code examples will demonstrate how to use them.

Definitions:

Text box /Field:  is a web element that enables the user to insert/Remove text.
Button: is a controller that allows the user to trigger a new event.


List of available commands 


Algorithm:

  1. Log in to Yahoo.
  2. Validate both the Title and URL (using the Assert function).
  3. Enter Text to the search field and remove it (SendKeys () and Clear ()).
  4. Enter text www.machtested.com and use the "Submit" function.
  5. Select the first link and click on it using the click ().
  6. Quit.

Code:

[TestMethod]
public void TextFieldAndButtonExample ()
{
IWebElement TempElement;
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("https://www.yahoo.com/");
Assert.AreEqual("Yahoo", Firefox.Title);
Assert.AreEqual("https://www.yahoo.com/", Firefox.Url);
TempElement = Firefox.FindElement(By.Id("uh-search-box"));
TempElement.SendKeys("Clear text example");
TempElement.Clear();
TempElement.SendKeys("http://www.machtested.com/");
TempElement.Submit();
Firefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
Firefox.FindElement(By.XPath("//a[contains(@href,'RU=http%3a%2f%2fwww.machtested.com%2f/RK')]")).Click();
Firefox.Quit();
}




Wednesday, March 22, 2017

Selenium WebDriver - Locating Web elements using CSS selectors

Overview

Cascading Style Sheets (CSS) is a language used for describing the semantics of the elements related to a document written in an HTML or XML syntax (The style of the element and how it represented on the screen).

When using CSS, we can review the pattern –matching (Known as “Selectors”) rules that were defined for different elements in the DOM.

For more information about CSS:

Selenium WebDriver can use the structure and identifiers of the CSS syntax to locate elements in DOM, this strategy is superior compared to XPath (More reliable and will work faster...).

תוצאת תמונה עבור ‪CSS‬‏

Finding Elements with absolute path

We will use the complete path of the element referring to its hierarchy in the DOM (Same as XPath, any changes that are made in the structure hierarchy of the element will cause failure to locate it using the CSS locator).

Code Example

[TestMethod]
public void CSSAbsolutePath()
{
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("http://www.machtested.com/");
Assert.AreEqual("David Tzemach's Blog", Firefox.FindElement(By.CssSelector("html.v2 body.variant………………………div#header.header.section div#Header1.widget.Header div#header-inner div.titlewrapper h1.title")).Text);
}


Finding Elements with relative path

The locator goes directly to the element instead of parsing from the root element. So if the absolute path is defined as: "HTML.v2 body.variant………………………div#header.header.section…div#header-inner div.titlewrapper h1.title"; the relative path will be  "h1.title"

Code Example
[TestMethod]
public void CSSRelativePath()
{
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("http://www.machtested.com/");
Assert.AreEqual("David Tzemach's Blog", Firefox.FindElement(By.CssSelector("h1.title")).Text);
}

Finding Elements using ID selector

We can locate elements using the ID that was assigned to them, the information that we need is the 
HTML tag and the element ID (# should set in the middle), Example:

 = <button>HTML Tag
 = ApprovalElement ID
Result (Full): (By. cssSelector (“button#Approval”));

Code Example

[TestMethod]
public void CSSIDFull()
{
IWebElement ButtonID;
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("http://www.machtested.com/");
ButtonID = Firefox.FindElement(By.CssSelector("input#gsc-i-id1"));
ButtonID.SendKeys("David");}

Result (Shortcut): 
(By. cssSelector (“#Approval”));

Note!
When using the shortcut strategy, you ignore the HTML tag, therefore there may some additional elements that corresponding to the element ID which resolves the retrieval of an incorrect element.


Finding Elements using the CSS class selector
The CSS selector allows us to search for elements using their class attribute, all we need to do is to specify the HTML tag, insert a dot and add the class attribute.

Code Example
[TestMethod]
public void CSSClassSelector()
{
IWebElement Title;
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("http://www.machtested.com/");
Title = Firefox.FindElement(By.CssSelector("h1.title"));
}

Shortcut: 



Finding Elements using the attribute value

CSS enable us to locate elements using the value of a specific attribute.

Examples:

HTML:

<input type="text" name="email" style="width:140px">

[TestMethod]
public void CSSattribute()
{
IWebElement Search;
IWebDriver Firefox = new FirefoxDriver();
Firefox.Navigate().GoToUrl("http://www.machtested.com/");

//Using Single Attribute
Firefox.FindElement(By.CssSelector("input[name='email']")).SendKeys("Text");

//Using Multiple Attributes
Firefox.FindElement(By.CssSelector("input[name='email'][type='text']")).Clear();
}

Finding elements based on partial attribute value

This previous strategy is great but it will not allow us to use it on dynamic elements that changed continually, to overcome this issue CSS provides another strategy to locate elements bases on matching only partial attribute value

HTML
<input type="text" placeholder="Email address..." name="email" class="follow-by-email-address">

Code
//Partial matching based on CONTAINS value
Firefox.FindElements(By.CssSelector("input[class*='by-email']"));

//Partial matching based on the START of the attribute value
Firefox.FindElements(By.CssSelector("input[class^='follow']"));

//Partial matching based on the END of the attribute value
Firefox.FindElements(By.CssSelector("input[class$='address']"));

Finding Elements using the attributes name/type

Similar to the Attribute value strategy, we can perform the same search on the attribute name (ignoring the attribute value). This strategy is useful if we need to locate multiple elements that have the same attribute name.

Code
//Locate all elements from type input containing the 'type 'attribute
Firefox.FindElements(By.CssSelector("input[type]"));

//Locate all elements from type input that does not containing the 'type 'attribute
Firefox.FindElements(By.CssSelector("input:not([type])"));


Locating elements using text (CSS)

Same as XPath, CSS provide the same strategy where we can find elements using their text;

Example:
WebElement = Firefox.FindElement(By.CssSelector("//a:contains('Quality Assurance')"));

For Firefox:
WebElement = Firefox.FindElement(By.CssSelector("//a[textContent='Quality Assurance']"));

Tuesday, March 21, 2017

Selenium WebDriver – Taking screenshot for a specific element (C#)

This code will demonstrate how to take a screenshot of a specific element while ignoring the rest of the browser elements.

תוצאת תמונה עבור ‪selenium webdriver screenshot‬‏

Code:
[TestMethod]
public void PrinSpecificElement ()
{
IWebElement ElementToCapture;
IWebDriver FirefoxInstance = new FirefoxDriver ();
FirefoxInstance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(60));
FirefoxInstance.Navigate().GoToUrl("http://www.machtested.com");
FirefoxInstance.Manage().Window.Maximize();

//Select a specific element from my Blog (The Main Title in this case)
ElementToCapture = FirefoxInstance.FindElement(By.ClassName("titlewrapper"));

//Get the element Size
int The_Element_Width = ElementToCapture.Size.Width;
int The_Element_Height = ElementToCapture.Size.Height;

//Get the Element location Via X/Y coordinates
int The_Element_Location_X = ElementToCapture.Location.X;
int The_Element_Location_Y = ElementToCapture.Location.Y;

//Creating the Rectangle that we going to use to extract the element
Rectangle Test = new Rectangle (The_Element_Location_X, The_Element_Location_Y, The_Element_Width, The_Element_Height);

//Take Screenshot and save it on TMP file
((ITakesScreenshot)FirefoxInstance).GetScreenshot().SaveAsFile(@"c:\TMP.jpeg", ImageFormat.Jpeg);

//import The File that we save earlier
Bitmap ImportFile = new Bitmap(@"c:\TMP.jpeg");

//Clone and extract the requested Element (Based on our Rectangle)
Bitmap CloneFile = (Bitmap)ImportFile.Clone(Test, ImportFile.PixelFormat);

//Save The Extract Element
CloneFile.Save(@"c:\SpecificElementAfter.jpeg");

//Dispose the TMP file that we don't need anymore
ImportFile.Dispose();

//Delete the TMP file
File.Delete(@"c:\TMP.jpeg");

}

Saturday, March 18, 2017

Selenium WebDriver – Working with windows services and processes (C#)

Overview

Sometimes, we will need to validate the current state of a system service/process, prior during and after a test execution. the following paragraphs will provide the basic set of tools to accomplish these tasks.

Note!
To use the system services, you first need to add the "System.ServiceProcess" as a reference and the "System.Diagnostics" namespace.

תוצאת תמונה עבור ‪selenium webdriver‬‏


Getting the basic information about a service

static void Main(string[] args)
{
//Define the service that we want to use
ServiceController sc = new ServiceController("Spooler");

//Getting the service status
string servicestatus = sc.Status.ToString();

//Getting the service name
string servicename = sc.ServiceName;

//Getting the service Display Name
string servicedisplayname = sc.DisplayName;
}

Getting the basic information about a process

//Selecting the process by ID
Process Process = Process.GetProcessById(94204);

//Get the process name
string processname = Process.ProcessName;

How to change the service status

In the following code snippet, I will demonstrate how to "Start" and "Stop" a specific service

static void Main(string[] args)
//Define the service that we want to use
ServiceController Service = new ServiceController("Spooler");

//Define a Time Span that we will use to validate the service status
TimeSpan Timer = TimeSpan.FromMilliseconds(30);


//Start a Service
Service.Start();
Service.WaitForStatus(ServiceControllerStatus.Running,Timer);


//Stop a Service
Service.Stop();
Service.WaitForStatus(ServiceControllerStatus.Stopped, Timer);
}

How to kill a process execution

For this purposes, we will use the "Kill" command.

//Selecting the process by ID
Process Process = Process.GetProcessById(94204);

//Kill the process
Process.Kill();

Friday, March 17, 2017

Selenium WebDriver - How to Identify Web Elements Using Selenium XPath (Contains Method)

The XML path language (XPath) is a language that we can use for investigating specific nodes of an XML document based on specific search criteria.

Selenium WebDriver supports the XML path language as a strategy to locate elements using flexible XPath queries, this fact is very important, because all the major browsers (Firefox, IE and chrome) support it.
תוצאת תמונה עבור ‪selenium webdriver xpath contains‬‏

Partial match on element attribute values

Sometimes, you will work with different web applications that creating the element attribute values dynamically, therefore you cannot use a static attribute values that may change on every test execution, to overcome this issue XPath provides another effective way to locate elements based on a partial part of the attribute value.

The Contains method

The contains method, determines if the attribute value contains the search string that we searched for, in the locator.

Example: 







HTML Code
<input type="text" value="" size="30" name="name" id="ContactForm1_contact-form-name" class="contact-form-name">

In the following code, we will query the element with only partial part of its id:

Full ID: "ContactForm1_contact-form-name":

WebElement = Firefox.FindElement(By. XPath("//input[contains(@id,'-name')]"));

Starts-With
Following the previous example, we can do the same thing with the "Starts with" function, but currently we will examine the beginning of the attribute value.

WebElement = Firefox.FindElement(By.XPath("//input[starts-with(@id,'ContactForm1)]"));

Ends-With
Following the previous example, we can do the same thing with the "Ends With" function, but a currently we will examine the End of the attribute value.

WebElement = Firefox.FindElement(By.XPath("//input[ends-with(@id,'form-name)]"));


Tuesday, March 14, 2017

How to capture Screenshot in Selenium Webdriver (C#)

Overview

Selenium WebDriver provides the capability to capture screenshots during a test execution. This ability is really important when you need to investigate different failures that occurred during the execution or in some cases to track the different stages of the run.

The capability to take a screenshot with selenium is extracted from the "ITakesScreenshot" interface that allowing us to take a screenshot of the current page displayed in the driver instance.

תוצאת תמונה עבור ‪selenium webdriver‬‏

Preparations

Remember that each screenshot that you take is translated into physical file needs to be saved in the file system, in C# we need to add a specific class that allows us to perform few basic operations in our File System (Reading and Writing), to do so, please add this code:

using System.IO;
using System.Text;
using System.Drawing;

Taking screenshot of the entire screen (All Elements)

In the following test, we will log into a webpage and take screenshot of the entire page in .JPEG format.

Note! 
If you want to skip the long code example, you just can use the following code: 

((ITakesScreenshot)FirefoxInstance).GetScreenshot().SaveAsFile("File Location",System.Drawing.Imaging.ImageFormat.Jpeg);

((ITakesScreenshot)FirefoxInstance)
Connecting the ITakesScreenshot with the Driver instance.
GetScreenshot ()
This method will take the screenshot
SaveAsFile ()
The method receives two parameters:

File location
Determines where do we going to save the screenshot

ImageFormat.Jpeg
Determine the format of the picture

If you decide to increase your knowledge, please review the following code:

static int ScreenCounter = 0; //Will be update per screenshot that we took

[TestMethod]
public void Screenshots()
{
IWebDriver FirefoxInstance = new FirefoxDriver();
FirefoxInstance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(60));
FirefoxInstance.Navigate().GoToUrl("http://www.machtested.com");
TakesScreenshotWithDate(FirefoxInstance, @"C:\FileLocation\","File_Name_", System.Drawing.Imaging.ImageFormat.Jpeg);

The Method Arguments:

FirefoxInstance
IWebDriver object

@"C:\Path\"    
The path that we are going to use to save the screenshots
"Test_Date_"   
The File name that we going to use

System.Drawing.Imaging.ImageFormat.Jpeg
Specify the File Format that we are going to use

private void TakesScreenshotWithDate(IWebDriver BrowserInstance ,string Path,string FileName,System.Drawing.Imaging.ImageFormat Format)
{
ScreenCounter++; //Updates the number of screenshots that we took during the execution

StringBuilder TimeAndDate = new StringBuilder(DateTime.Now.ToString());
TimeAndDate.Replace("/","_");
TimeAndDate.Replace(":", "_");

Remember that we cannot save a file with '/' Or ':', but we still need a unique identifier, Therefore, we will make this simple replace.

Before: 12/06/2015 14:54:55
After: 12_06_2015 14_54_55

DirectoryInfo Validation = new DirectoryInfo(Path); //System IO object

if (Validation.Exists == true) //Capture screen if the path is available
{
((ITakesScreenshot)BrowserInstance).GetScreenshot().SaveAsFile(Path + ScreenCounter.ToString() + "." + Filename + TimeAndDate.ToString() + "." + Format, Format);
}
else //Create the folder and then Capture the screen
{
Validation.Create();
((ITakesScreenshot)BrowserInstance).GetScreenshot().SaveAsFile(Path + ScreenCounter.ToString() + "." + FileName + TimeAndDate.ToString() + "." + Format, Format);
}
}}

My Presentations