gpt4 book ai didi

c# - System.IO.FileNotFoundException : Could not load file or assembly 'Silvernium, 版本=1.0.4254.29979

转载 作者:太空宇宙 更新时间:2023-11-03 10:50:37 25 4
gpt4 key购买 nike

我正在尝试使用 selenium Nuint 测试框架构建一个 selenium-silverlight UI 测试。这是我的代码

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using System.Text;
using OpenQA.Selenium.Interactions;
using System.Configuration;
using System.Threading;
using Selenium;
using ThoughtWorks.Selenium.Silvernium;
using DBServer.Selenium.Silvernium.Fixtures;
using NUnit.Framework;

namespace Rahul_Test
{
[TestFixture]
public class UnitTest1
{
protected static IWebDriver driver;
protected WebDriverWait wait;
protected StringBuilder verificationErrors;
private string baseURL;
protected static Actions builder;
protected Silvernium silvernium;
protected ISelenium selenium;
protected ICommandProcessor processor;

//initial setup
[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com");
selenium.Start();
selenium.Open("http://atlas/Dev/Axioma/");
silvernium = new Silvernium(selenium, "InteractiveElement"); //this line throws error at runtime/while running tests in debug mode...
//Note: Build does not throw any errors on compilation
}

//open browser test case
[Test]
public void Login()
{
NUnit.Framework.Assert.IsFalse(false);
}
}

项目/解决方案构建没有任何错误,但是当我从测试中调试/运行测试用例时,它失败并出现以下错误。

Test Name: Login

Test FullName: Rahul_Test.UnitTest1.Login

Test Source: c:\Users\rlodha\Documents\Visual Studio 2012\Projects\SampleUITest\SampleUITest\UnitTest1.cs : line 58

Test Outcome: Failed

Test Duration: 0:00:00.205

Result Message: SetUp : System.IO.FileNotFoundException : Could not load file or assembly 'Silvernium, Version=1.0.4254.29979, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

The system cannot find the file specified. Result StackTrace: at Rahul_Test.UnitTest1.SetupTest()

我不明白为什么它能够在添加 Silvernium 程序集引用的情况下进行编译,但无法在运行/调试时加载 Silvernium 程序集。

MSTest 代码

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
using System.Text;
using OpenQA.Selenium.Interactions;
using System.Configuration;
using System.Threading;
using Selenium;
using ThoughtWorks.Selenium.Silvernium;
//using NUnit.Framework;

namespace Rahul_Test
{
[TestClass]
public class UnitTest1
{
//copy this part for defining a class for IE and chrome
protected static IWebDriver driver;
protected WebDriverWait wait;
protected StringBuilder verificationErrors;
private string baseURL;
protected static Actions builder;
protected Silvernium silvernium;
protected ISelenium selenium;
//protected ICommandProcessor processor;
//initial setup
[TestInitialize]
public void SetupTest()
{
if (driver == null)
{
driver = new FirefoxDriver();
driver.Manage().Window.Maximize();
baseURL = "";
verificationErrors = new StringBuilder();
driver.Navigate().GoToUrl("http://atlas/Dev/Axioma/");
builder = new Actions(driver);
//processor=new
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.com");
//selenium.Start();
//selenium.Open("http://atlas/Dev/Axioma/");
silvernium = new Silvernium(selenium, "InteractiveElement");
//var silverlightapp = new SilverlightApplicationFixture("localhost", 4444, "*firefox", "http://www.google.com");
// }
//wait = new WebDriverWait(driver, TimeSpan.FromSeconds(35));
//wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Convert.ToInt16(ConfigurationManager.AppSettings["TimeOut"])));
}
}

//open browser test case
[TestMethod]
public void Login()
{
Assert.IsFalse(false);
}
}
}

和 MSTest 的错误日志

Test Name:Login
Test FullName:Rahul_Test.UnitTest1.Login
Test Source:c:\Users\rlodha\Documents\Visual Studio 2012\Projects\SampleUITest\SampleUITest\UnitTest1.cs : line 57
Test Outcome:Failed
Test Duration:3.36805555555556E-06

Result Message:
Initialization method Rahul_Test.UnitTest1.SetupTest threw exception. System.IO.FileNotFoundException: System.IO.FileNotFoundException: Could not load file or assembly
'Silvernium, Version=1.0.4254.29979, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.exe.config

=== Pre-bind state information ===
LOG: DisplayName = Silvernium, Version=1.0.4254.29979, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/rlodha/Documents/Visual Studio 2012/Projects/SampleUITest/SampleUITest/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : SampleUITest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
.
Result StackTrace:at Rahul_Test.UnitTest1.SetupTest()

最佳答案

我今天刚遇到同样的错误。尝试将 Silvernium dll 的名称从 Silvernium-version.number.dll 更改为 Silvernium.dll。

例如,我将我的 Silvernium-1.1.dll 更改为 Silvernium.dll,它可以正常工作。

关于c# - System.IO.FileNotFoundException : Could not load file or assembly 'Silvernium, 版本=1.0.4254.29979,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21539668/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com