Problem with loading assembly when running NUnit (FileNotFoundException)
Recently, I've been using Selenium to record a few simple tests. Although Selenium tests are initially stored as html files, the program allows you to export the test cases in a variety of languages (in this case, I'm using C#).
I downlo开发者_运维技巧aded NUnit to use as my testing framework -- I can then load a particular exported C# file into NUnit as a project.
I also created a simple web app where I can click a button to launch NUnit and run a few tests. The problem is, I keep getting this error message:
System.IO.FileNotFoundException : File or assembly name nunit.core, or one of its dependencies, was not found.
Once I exit out of this popup, NUnit opens as desired, however, the tests don't load. The source code behind the web app looks like this:
public void ButtonClick1(object sender, System.EventArgs e)
{
ProcessStartInfo proc1 = new ProcessStartInfo("C:\\selenium-remote-control
1.0.3\\selenium-dotnet-client-driver-1.0.1\\source\\tools\\nunit\\nunit-gui", "TestProject14.dll");
System.Diagnostics.Process.Start(proc1);
}
Basically I'm just trying to create a new process which launches the NUnit gui and runs the test. I'm not sure if it can't find the .dll or if it's some other issue.
Any help would be appreciated -- this is my first post, so if I'm missing something completely obvious, I apologize in advance. Thanks!
Do you have
using nunit.framework;
at the top of your code?
Secondly, have you included an actual reference to the nunit.core dll in your References list? If not, right click "References" and click add reference. Find nunit.core.dll and attach it
You need to set the WorkingDirectory
of the process to be the NUnit directory. If you do not do that, the working directory will be the one where the application is executing from.
I suggest building up a ProcessInfo
object with all the details of the process and pass that to the Process
constructor.
精彩评论