本文整理汇总了C#中ITestContext类的典型用法代码示例。如果您正苦于以下问题:C# ITestContext类的具体用法?C# ITestContext怎么用?C# ITestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITestContext类属于命名空间,在下文中一共展示了ITestContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FullyQualifiedApplicationPath
public string FullyQualifiedApplicationPath(ITestContext testContext)
{
//Return variable declaration
var appPath = string.Empty;
//Getting the current context of HTTP request
var context = testContext.HttpContext;
//Checking the current context content
if (context != null)
{
//Formatting the fully qualified website url/name
appPath = string.Format("{0}://{1}{2}{3}",
context.Request.Url.Scheme,
context.Request.Url.Host,
context.Request.Url.Port == 80
? string.Empty
: ":" + context.Request.Url.Port,
context.Request.ApplicationPath);
}
if (!appPath.EndsWith("/"))
appPath += "/";
return appPath;
}
开发者ID:ChrisBriggsy,项目名称:SSW.HealthCheck,代码行数:27,代码来源:WebApiTest.cs
示例2: Test
public void Test(ITestContext context)
{
if (this.url.IsNullOrEmpty() || this.url == "/" || this.url == "~" || this.url == "~/")
{
this.url = this.FullyQualifiedApplicationPath(context);
}
if (this.action.IsNullOrEmpty())
{
throw new ApplicationException(Errors.UrlAndActionCannotBeEmpty);
}
this.service = new WebApiService { Timeout = this.timeout };
try
{
var result = this.arguments == null
? this.service.Get<object>(this.url, this.action)
: this.service.Get<object>(this.url, this.action, this.arguments);
}
catch (WebApiException ex)
{
Assert.Fails(Errors.FailedToAccessService, ex.Message);
}
}
开发者ID:ChrisBriggsy,项目名称:SSW.HealthCheck,代码行数:25,代码来源:WebApiTest.cs
示例3: IterationSetup
public void IterationSetup(ITestContext testContext)
{
//Debug.WriteLine("IterationSetup is executed before each ExecuteScenario call");
if (Random.Next(100) % 50 == 0)
throw new Exception("2% error chance for testing");
}
开发者ID:Vycka,项目名称:LoadRunner,代码行数:7,代码来源:DemoTestScenario.cs
示例4: Scan
public IEnumerable<Step> Scan(ITestContext testContext, MethodInfo method, Example example)
{
var executableAttribute = (ExecutableAttribute)method.GetCustomAttributes(typeof(ExecutableAttribute), false).FirstOrDefault();
if (executableAttribute == null)
yield break;
string stepTitle = executableAttribute.StepTitle;
if (string.IsNullOrEmpty(stepTitle))
stepTitle = Configurator.Scanners.Humanize(method.Name);
var stepAsserts = IsAssertingByAttribute(method);
var methodParameters = method.GetParameters();
var inputs = new List<object>();
var inputPlaceholders = Regex.Matches(stepTitle, " <(\\w+)> ");
for (int i = 0; i < inputPlaceholders.Count; i++)
{
var placeholder = inputPlaceholders[i].Groups[1].Value;
for (int j = 0; j < example.Headers.Length; j++)
{
if (example.Values.ElementAt(j).MatchesName(placeholder))
{
inputs.Add(example.GetValueOf(j, methodParameters[inputs.Count].ParameterType));
break;
}
}
}
var stepAction = StepActionFactory.GetStepAction(method, inputs.ToArray());
yield return new Step(stepAction, new StepTitle(stepTitle), stepAsserts, executableAttribute.ExecutionOrder, true, new List<StepArgument>());
}
开发者ID:jason-roberts,项目名称:TestStack.BDDfy,代码行数:33,代码来源:ExecutableAttributeStepScanner.cs
示例5: SetUp
public override void SetUp(ITestContext context)
{
RunningNode.Subscriptions.ClearAll();
MessageHistory.ClearAll();
InMemoryQueueManager.ClearAll();
FubuTransport.ApplyMessageHistoryWatching = true;
}
开发者ID:JackGilliam1,项目名称:FubuTransportation,代码行数:7,代码来源:SubscriptionsFixture.cs
示例6: ReadExpected
public void ReadExpected(ITestContext context, IStep step, SetRow row)
{
Cell.ReadArgument(context, step, x =>
{
row.Values[Cell.Key] = x;
});
}
开发者ID:wbinford,项目名称:storyteller,代码行数:7,代码来源:PropertyMatch.cs
示例7: execute
protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context)
{
// TODO -- StoryTeller needs to pull this all inside the Cell
if (!cellValues.ContainsKey(_cell.Key))
{
// already caught as a syntax error
return;
}
var handler = ElementHandlers.FindHandler(element);
var expectedValue = cellValues[_cell.Key];
var matchingHandler = handler as IMatchingHandler ?? new BasicMatchingHandler(handler, context);
if (matchingHandler.MatchesData(element, expectedValue))
{
context.IncrementRights();
}
else
{
context.ResultsFor(step).MarkFailure(_cell.Key);
context.IncrementWrongs();
}
context.ResultsFor(step).SetActual(_cell.Key, handler.GetData(CurrentContext, element));
}
开发者ID:jemacom,项目名称:fubumvc,代码行数:26,代码来源:CheckValueGrammar.cs
示例8: WriteResults
public void WriteResults(StepResults results, ITestContext context)
{
if (!_cell.IsResult)
{
WritePreview(context);
return;
}
var actual = results.HasActual(_cell.Key) ? results.GetActual(_cell.Key) : "MISSING";
if (results.IsInException(_cell.Key))
{
Text("Error!");
AddClass(HtmlClasses.EXCEPTION);
return;
}
if (results.IsFailure(_cell.Key))
{
var expected = _step.Get(_cell.Key);
string text = "{0}, but was '{1}'".ToFormat(expected, actual);
Text(text);
AddClass(HtmlClasses.FAIL);
}
else
{
Text(context.GetDisplay(actual));
AddClass(HtmlClasses.PASS);
}
}
开发者ID:wbinford,项目名称:storyteller,代码行数:31,代码来源:CellTag.cs
示例9: SetUp
public override void SetUp(ITestContext context)
{
_settings = new DeploymentSettings("storyteller");
context.Store(_settings);
_writer = new DeploymentWriter("storyteller");
}
开发者ID:jericsmith,项目名称:bottles,代码行数:7,代码来源:DeploymentFixture.cs
示例10: ResultsWriter
public ResultsWriter(HtmlDocument document, ITestContext context)
{
_document = document;
_context = context;
_document.AddStyle(HtmlClasses.CSS());
}
开发者ID:kharlamov,项目名称:StoryTeller2,代码行数:7,代码来源:ResultsWriter.cs
示例11: ScenarioSetup
public void ScenarioSetup(ITestContext testContext)
{
//Debug.WriteLine("ScenarioSetup Executes on thread creation");
//Debug.WriteLine("Exceptions here are not handled!");
Console.WriteLine($"Created Thread {testContext.ThreadId}");
}
开发者ID:Vycka,项目名称:LoadRunner,代码行数:7,代码来源:DemoTestScenario.cs
示例12: SetUp
public override sealed void SetUp(ITestContext context)
{
// TODO -- later, make this thing be able to swap up the application under test
_application = context.Retrieve<IApplicationUnderTest>();
beforeRunning();
}
开发者ID:KevM,项目名称:fubumvc,代码行数:7,代码来源:ScreenFixture.cs
示例13: Scan
public virtual IEnumerable<Scenario> Scan(ITestContext testContext)
{
Type scenarioType;
string scenarioTitle;
if (testContext.Examples == null)
{
var steps = ScanScenarioForSteps(testContext);
scenarioType = testContext.TestObject.GetType();
scenarioTitle = _scenarioTitle ?? GetScenarioText(scenarioType);
var orderedSteps = steps.OrderBy(o => o.ExecutionOrder).ThenBy(o => o.ExecutionSubOrder).ToList();
yield return new Scenario(testContext.TestObject, orderedSteps, scenarioTitle, testContext.Tags);
yield break;
}
scenarioType = testContext.TestObject.GetType();
scenarioTitle = _scenarioTitle ?? GetScenarioText(scenarioType);
var scenarioId = Configurator.IdGenerator.GetScenarioId();
foreach (var example in testContext.Examples)
{
var steps = ScanScenarioForSteps(testContext, example);
var orderedSteps = steps.OrderBy(o => o.ExecutionOrder).ThenBy(o => o.ExecutionSubOrder).ToList();
yield return new Scenario(scenarioId, testContext.TestObject, orderedSteps, scenarioTitle, example, testContext.Tags);
}
}
开发者ID:jrenken1,项目名称:TestStack.BDDfy,代码行数:28,代码来源:ReflectiveScenarioScanner.cs
示例14: execute
protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context)
{
assertCondition(element.Enabled, DisabledElementMessage);
assertCondition(element.Displayed, HiddenElementMessage);
element.Click();
}
开发者ID:jemacom,项目名称:fubumvc,代码行数:7,代码来源:ClickGrammar.cs
示例15: IterationTearDown
public void IterationTearDown(ITestContext testContext)
{
//Debug.WriteLine("IterationTearDown is executed each time after ExecuteScenario iteration is finished.");
//Debug.WriteLine("It is also executed even when IterationSetup or ExecuteScenario fails");
if (Random.Next(100) % 25 == 0)
throw new Exception("4% error chance for testing");
}
开发者ID:Vycka,项目名称:LoadRunner,代码行数:8,代码来源:DemoTestScenario.cs
示例16: Build
public FixtureLibrary Build(ITestContext context)
{
_library = new FixtureLibrary();
context.VisitFixtures(this);
return _library;
}
开发者ID:wbinford,项目名称:storyteller,代码行数:8,代码来源:LibraryBuilder.cs
示例17: SetUp
public override void SetUp(ITestContext context)
{
_system.Do<Window>(x =>
{
_window = x;
_window.Show();
});
}
开发者ID:wbinford,项目名称:storyteller,代码行数:8,代码来源:StoryTellerUIFixture.cs
示例18: setUp
protected override void setUp(ITestContext context)
{
// Do any necessary bootstrapping just before a test run
// ITestContext is effectively an IoC container, so you
// might be registering your application services here
_system = new SystemUnderTest();
context.Store(_system);
}
开发者ID:wbinford,项目名称:storyteller,代码行数:8,代码来源:GalleryTestRunner.cs
示例19: Execute
public ITestContext Execute(ITestContext context)
{
var nunitContext = (NUnitTestFixtureDescriptor.Context)context;
nunitContext.TestSetup();
myMethod.Invoke(nunitContext.Value, new object[0]);
nunitContext.TestTeardown();
return null;
}
开发者ID:hhariri,项目名称:scurry,代码行数:8,代码来源:NUnitTestDescriptor.cs
示例20: GetTestAdapter
/// <summary>
/// IBaseAdapter method: called to execute a test.
/// </summary>
/// <param name="testElement">The test object to run</param>
/// <param name="testContext">The Test conext for this test invocation</param>
void IBaseAdapter.Run(ITestElement testElement, ITestContext testContext)
{
Trace.TraceInformation("Called DynamicHostAdapter.Run");
ITestAdapter realAdapter = GetTestAdapter(testElement);
realAdapter.Run(testElement, testContext);
}
开发者ID:lioaphy,项目名称:nodejstools,代码行数:13,代码来源:DynamicHostAdapter.cs
注:本文中的ITestContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论