пятница, 15 ноября 2013 г.

3.0.5 Code duplication


JS:  +2783 lines -175 dup lines (-6.29%), 19.74% overall (-0.79%)
CS: +82 lines -12 dup lines (-14.63%), 5.09% overal (-0.01%)



The most significant added JS duplication:

Found 22 duplicate lines in the following files:
 Between lines 128 and 152 in D:\src\trunk\Utilities\..\Code\Main\Tp.Web\JavaScript\tau\scripts\tau\ui\templates\list_\grid.entity\ui.template.list.grid.entity.row.js
 Between lines 65 and 90 in D:\src\trunk\Utilities\..\Code\Main\Tp.Web\JavaScript\tau\scripts\tau\ui\templates\list_\grid.entity\testplanrun\ui.template.list.grid.entity.row.testcaserun.js
 Between lines 90 and 114 in D:\src\trunk\Utilities\..\Code\Main\Tp.Web\JavaScript\tau\scripts\tau\ui\templates\list_\grid.entity\testplan\ui.template.list.grid.entity.row.testplanrun.js




https://docs.google.com/spreadsheet/ccc?key=0ArF9ExjGEio4dENPWXVpTUdNTTc4RGRHWVBQOG9mZHc&usp=sharing

пятница, 23 августа 2013 г.

Git Extensions + Hub flow + Git

Here is some tips how to somehow integrate GitHub and Hubflow to Git Extensions:

Git Extensions supports scripting, that could be integrated either in UI or autostart before/after some actions.

I've created the following scripts for Git Extension, hope they will be useful:

Flow feature start, create pull request and prune remote branches:

To add these scripts go to Settings->Settings->Scripts:

  1. Prune remote - git / remote prune origin
  2. HF Feature start - git / hf feature start {UserInput} - it will ask for feature name
  3. Create pull requests - git / hub pull-request -b TargetProcess:develop -h TargetProcess:{cLocalBranch}

For pull requests you need to download a hub extension for git from here and put in your Git\Bin folder. It just nothing than a https://github.com/github/hub script. As far as git bash we are using could not start the hub script directly, I've just renamed it to git-hub to allow run it as standard git command, i.e. git hub pull-request.

пятница, 7 октября 2011 г.

Freedom of Functional Tests

Looking at our functional tests (FTs) we can highlight several problems:

  • Synchronization code here like WaitFor is everywhere.
[When("opened Find Duplicate popup")]
public void OpenFindDuplicatePopup()
{
	Context.SeleniumInstance.Click("//a[.='Find Duplicate']");
	Synchronizer.WaitForAjax();
}

[When("wait for page to load")]
public void WaitForPageToLoad()
{
	Context.SeleniumInstance.WaitForPageToLoad(Config.WaitForPageToLoad);
	Synchronizer.WaitForAjax();
}
[When("clicked on Mark as Duplicate button")]
public void ClickMarkAsDuplicate()
{
	Context.SeleniumInstance.Click("//button[.='Mark as Duplicate']");
	Synchronizer.WaitForAjax();
}

  • xpaths everywhere, and not many of them shared.
  • We also depend on page structure while looking for web element heavily
  • Dependency on TP database.
    As our FTs depends on direct connection to database it prevents us to run them against any instance of TP and share tests with plugin developers from other companies.
  • Contexts (AKA testing environment like 'create a project for a process, put user stories and assign a user then proceed') are not defined and not shared across all FTs
For now agreed on following decisions:

Synchronization code here like WaitFor is everywhere
&&
xpaths everywhere, and not many of them shared.

The solution is simple: heavily use PageObject pattern.
The rule regarding xpath:

Don't use xpath.
We should rather use css selectors as they are much more stable to page structure changes. Css selectors used for testing should start with _ prefix

public IWebElement FirstNameInput
{
	get { return _browser.FindElement(By.CssSelector("input._firstName")); }
}

Page Objects design rules:
  • Page Object should be always created via DI container (structure map in our case). This will make our code more flexible in the matter of changes

The you can revise the following articles regarding best practices DI usage:


Poor-Man DI Antipattern Description

Dependency on TP database

Use REST to perform quick manipulation of Target Process site.


Contexts

Different tests may use the same contexts in the matter of system under test (SUT) test.

Some of tests may use slightly different contexts.



It is necessary to provide a possibility to reuse contexts or their parts across the FTs.




Context Architecture





Whole Picture for new-style FTs