[英]How to write nunit test case for below code in c#? How ro write nunit test cases for methods with no arguments?
[英]How to adjust speed of nunit test cases in C# or in nunit interface?
我已經使用了Selenium IDE並創建了測試用例。 我已經用C#將它們轉換為Nunit,然后開始運行測試用例。 如何使用nunit接口或C#代碼調整運行測試用例的速度。 (在Selenium ide界面中,我可以調整速度以便緩慢運行測試用例。)
您可以將TestFixtureSetup
添加到每個TestFixture
。 下面的示例應在每次測試之前運行,並導致5秒鍾的等待:
[TestFixture]
public MyTests()
{
[TestFixtureSetUp]
public void Init()
{
System.Thread.Sleep(5000);
}
...
}
這些鏈接之一應該起作用:
類似的問題:
硒的論壇結果( http://seleniumforum.forumotion.net/t376-to-control-of-speed-execute-in-selenium-rc ):
[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", URL");
selenium.Start();
selenium.SetSpeed("1000");
}
在過去幾天中,我一直在研究很多內容。 到目前為止,解決此問題的最簡單方法是創建驅動程序屬性,而不是變量,並在get中添加等待時間。
private IWebDriver _driver;
public IWebDriver driver
{
get{ Thread.Sleep(500);
return _driver;
}
set
{ _driver = value; }
}
這意味着,無論何時請求驅動程序,也就是您在瀏覽器中進行任何操作,都會使其速度降低指定的數量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.