This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MSTestExecutionSubject : ITestExecutionSubject | |
{ | |
private readonly List<ITestBehaviorObserver> testBehaviorObservers; | |
public MSTestExecutionSubject() | |
{ | |
this.testBehaviorObservers = new List<ITestBehaviorObserver>(); | |
} | |
public void Attach(ITestBehaviorObserver observer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseTestBehaviorObserver : ITestBehaviorObserver | |
{ | |
private readonly ITestExecutionSubject testExecutionSubject; | |
public BaseTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
{ | |
this.testExecutionSubject = testExecutionSubject; | |
testExecutionSubject.Attach(this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
[ExecutionBrowser(BrowserType = BrowserTypes.Firefox)] | |
public class SearchEngineTestsClassicObserver : BaseTest | |
{ | |
[TestMethod] | |
[ExecutionBrowser(BrowserType = BrowserTypes.Chrome)] | |
public void SearchTextInSearchEngine_First_Observer() | |
{ | |
B.SearchEngineMainPage searchEngineMainPage = new B.SearchEngineMainPage(Driver.Browser); | |
searchEngineMainPage.Navigate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)] | |
public class ExecutionBrowserAttribute : Attribute | |
{ | |
public ExecutionBrowserAttribute(BrowserTypes browser) | |
{ | |
this.BrowserType = browser; | |
} | |
public BrowserTypes BrowserType { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserLaunchTestBehaviorObserver : BaseTestBehaviorObserver | |
{ | |
public BrowserLaunchTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
: base(testExecutionSubject) | |
{ | |
} | |
public override void PreTestInit(TestContext context, MemberInfo memberInfo) | |
{ | |
var browserType = this.GetExecutionBrowser(memberInfo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var executionBrowserAttribute = memberInfo.GetCustomAttribute<ExecutionBrowserAttribute>(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OwnerTestBehaviorObserver : BaseTestBehaviorObserver | |
{ | |
public OwnerTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
: base(testExecutionSubject) | |
{ | |
} | |
public override void PreTestInit(TestContext context, MemberInfo memberInfo) | |
{ | |
this.ThrowExceptionIfOwnerAttributeNotSet(memberInfo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class BaseTest | |
{ | |
private readonly ITestExecutionSubject currentTestExecutionSubject; | |
private TestContext testContextInstance; | |
public BaseTest() | |
{ | |
this.currentTestExecutionSubject = new MSTestExecutionSubject(); | |
this.InitializeTestExecutionBehaviorObservers(this.currentTestExecutionSubject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var memberInfo = this.GetType().GetMethod(this.TestContext.TestName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<sites> | |
<site url="http://automatetheplanet.com/" name="AutomateThePlanet"> | |
<redirects> | |
<redirect from="http://automatetheplanet.com/singleton-design-pattern-design-patterns-in-automation-testing/" to="/singleton-design-pattern/" /> | |
<redirect from="/advanced-strategy-design-pattern-design-patterns-in-automation-testing/" to="/advanced-strategy-design-pattern/" /> | |
</redirects> | |
</site> | |
</sites> |