Skip to content

Instantly share code, notes, and snippets.

View angelovstanton's full-sized avatar
💭
UPDATED STATUS

Anton Stanislavov Angelov angelovstanton

💭
UPDATED STATUS
View GitHub Profile
public class MSTestExecutionSubject : ITestExecutionSubject
{
private readonly List<ITestBehaviorObserver> testBehaviorObservers;
public MSTestExecutionSubject()
{
this.testBehaviorObservers = new List<ITestBehaviorObserver>();
}
public void Attach(ITestBehaviorObserver observer)
public class BaseTestBehaviorObserver : ITestBehaviorObserver
{
private readonly ITestExecutionSubject testExecutionSubject;
public BaseTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
{
this.testExecutionSubject = testExecutionSubject;
testExecutionSubject.Attach(this);
}
[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();
[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; }
}
public class BrowserLaunchTestBehaviorObserver : BaseTestBehaviorObserver
{
public BrowserLaunchTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
: base(testExecutionSubject)
{
}
public override void PreTestInit(TestContext context, MemberInfo memberInfo)
{
var browserType = this.GetExecutionBrowser(memberInfo);
var executionBrowserAttribute = memberInfo.GetCustomAttribute<ExecutionBrowserAttribute>(true);
public class OwnerTestBehaviorObserver : BaseTestBehaviorObserver
{
public OwnerTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
: base(testExecutionSubject)
{
}
public override void PreTestInit(TestContext context, MemberInfo memberInfo)
{
this.ThrowExceptionIfOwnerAttributeNotSet(memberInfo);
[TestClass]
public class BaseTest
{
private readonly ITestExecutionSubject currentTestExecutionSubject;
private TestContext testContextInstance;
public BaseTest()
{
this.currentTestExecutionSubject = new MSTestExecutionSubject();
this.InitializeTestExecutionBehaviorObservers(this.currentTestExecutionSubject);
var memberInfo = this.GetType().GetMethod(this.TestContext.TestName);
<?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>