Search Results

Search found 458 results on 19 pages for 'nunit'.

Page 7/19 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Unable to load <mytest> Because it is not located under Appbase

    - by Sam
    I have created a nunit project(NunitLoginTest.nunit) by selcting my test project in the nunit\bin directory and now I am trying to load that project but it is giving me the following error. Unable to load Because it is not located under Appbase, could not load file or assembly "nunitLogintest" or one of its dependencies. The system cannot find the specified path Can any one have any idea what is it related to. I also have checked my config file.

    Read the article

  • Regular Expressions. Remember it, write it, test it.

    - by outcoldman
    I should say that I’m fan of regular expressions. Whenever I see the problem, which I can solve with Regex, I felt a burning desire to do it and going to write new test for new regex. Previously I had installed SharpDevelop Studio just for good regular expression tool in it (Why VS doesn’t have one?). But now I’m a little wiser, and for each Regex I write a separate test. I find it difficult to remember the syntax of regular expressions (I don’t write them very often); I always forget which character is responsible for the beginning of the line, etc. So I use external small and easy articles like this “Regular expressions - An introduction”. Now I want to show you little samples of regular expressions and want to show you how to test these samples. Read more... (redirect to http://outcoldman.ru)

    Read the article

  • The art of Unit Testing with Examples in .NET

    - by outcoldman
    First time when I familiarized with unit testing was 5 or 6 years ago. It was start of my developing career. I remember that somebody told me about code coverage. At that time I didn’t write any Unit tests. Guy, who was my team lead, told me “Do you see operator if with three conditions? You should check all of these conditions”. So, after that I had written some code, I should go to interface and try to invoke all code which I wrote from user interface. Nice? At current time I know little more about tests and unit testing. I have not participated in projects, designed by Test Driven Development (TDD). Basics of my knowledge are a spying code of my colleagues, some articles and screencasts. I had decide that I should know much more, and became a real professional of unit testing, this is why I had start to read book The art of Unit Testing with Examples in .NET. More than, in my current job place looks like I’m just one who writing unit tests for my code. I should show good examples of my tests. ,a href="http://outcoldman.ru/en/blog/show/267"Read more...

    Read the article

  • Making Separate Assemblies For Different Types Of Tests For The Same Component?

    - by sooprise
    I was told by a few members here that splitting up my unit tests into different assemblies for different components is the best way to structure unit tests. Now, I have a few questions about that idea. What are the advantages of this? Organization, and isolation of errors? Let's say I have a component named "calculator", and I create an assembly for the unit tests on "calculator". Would I create a separate assembly for the integration tests I want to run on "calculator"? Or is the definition of an integration test a test across multiple components, like "calculator" and whatever else, which would require a separate assembly to test both of them together? In that case, would I have one assembly to do all of the integration testing for every component combination?

    Read the article

  • CruiseControl.NET merge nunit and nant output

    - by JK
    I've just started using ccnet so I'm having trouble understanding why the merging of nant and nunit outputs are not working. I've setup my ccnet.config with typical values as found on google: <merge> <files> <file>D:\ccnet\path1\nant-results.xml</file> <file>D:\ccnet\path2\TestResult.xml</file> </files> </merge> <xmllogger /> Nant and ccnet are half working: if I deliberately put in a code error, then ccnet will say build failed. The same happens if I deliberately put in a failing test, ccnet will say build failed. But the ViewBuildReport.aspx page does not show any of the output from nant or nunit. Obviously I must be missing something, but I don't know what, any ideas? Thanks, JK

    Read the article

  • Selenium tests not building due to NUnit error (Mono+OS X)

    - by Jem
    I'm running Selenium RC on my Mac and driving my tests using NUnit in C#. My problem is that when I try and build a simple test in Mono I get the following error. Error CS0433: The imported type `NUnit.Framework.Assert' is defined multiple times (CS0433) (TestProject) When I comment out the Assert's it runs fine. The code I'm using currently is just a dump from the openqa site using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using Selenium; namespace SeleniumTests { [TestFixture] public class AllTests { private ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest () { selenium = new DefaultSelenium ("localhost", 4444, "*safari", "http://www.google.co.uk"); selenium.Start (); verificationErrors = new StringBuilder (); } [TearDown] public void TeardownTest () { try { selenium.Stop (); } catch (Exception) { // Ignore errors if unable to close the browser } Assert.AreEqual ("", verificationErrors.ToString ()); } [Test] public void GoogleHomepageTests () { // Open Google search engine. selenium.Open ("http://www.google.com/"); // Assert Title of page. Assert.AreEqual ("Google", selenium.GetTitle ()); // Provide search term as "Selenium OpenQA" selenium.Type ("q", "Selenium OpenQA"); // Read the keyed search term and assert it. Assert.AreEqual ("Selenium OpenQA", selenium.GetValue ("q")); // Click on Search button. selenium.Click ("btnG"); // Wait for page to load. selenium.WaitForPageToLoad ("5000"); // Assert that "www.openqa.org" is available in search results. Assert.IsTrue (selenium.IsTextPresent ("www.openqa.org")); // Assert that page title is - "Selenium OpenQA - Google Search" Assert.AreEqual ("Selenium OpenQA - Google Search", selenium.GetTitle ()); } } } Any ideas? Is it a OSX/Mono thing?

    Read the article

  • Unit Test Organization

    - by cam
    I'm using Nunit for unit testing, and added another project called "Unit Testing" to my current solution. I referenced Nunit, and changed the Namespace to the same namespace used in the main project. I can't seem to figure out how to get access to all the classes, files, etc in the main project. Is there something I have to do to link two projects?

    Read the article

  • Accessing Custom Configurations in NUnit class

    - by Martin Ongtangco
    I'm really banging my head onto this one. I can't make the Custom Configuration to work with NUnit. It kept on failing to read the configuration file. I followed carefully this article: http://devlicio.us/blogs/derik_whittaker/archive/2006/11/13/app-config-and-custom-configuration-sections.aspx placed the references in the Unit test class App.Config, still everything failed. Is there some sort of a magic setting to do here?

    Read the article

  • How Best to Replace PL/SQL with C#?

    - by Mike
    Hi, I write a lot of one-off Oracle SQL queries/reports (in Toad), and sometimes they can get complex, involving lots of unions, joins, and subqueries, and/or requiring dynamic SQL, and/or procedural logic. PL/SQL is custom made for handling these situations, but as a language it does not compare to C#, and even if it did, it's tooling does not, and if even that did, forcing yet another language on the team is something to be avoided whenever possible. Experience has shown me that using SQL for the set based processing, coupled with C# for the procedural processing, is a powerful combination indeed, and far more readable, maintainable and enhanceable than PL/SQL. So, we end up with a number of small C# programs which typically would construct a SQL query string piece by piece and/or run several queries and process them as needed. This kind of code could easily be a disaster, but a good developer can make this work out quite well, and end up with very readable code. So, I don't think it's a bad way to code for smaller DB focused projects. My main question is, how best to create and package all these little C# programs that run ad hoc queries and reports against the database? Right now I create little report objects in a DLL, developed and tested with NUnit, but then I continue to use NUnit as the GUI to select and run them. NUnit just happens to provide a nice GUI for this kind of thing, even after testing has been completed. I'm also interested in suggestions for reporting apps generally. I feel like there is a missing piece or product. The perfect tool would allow writing and running C# inside of Toad, or SQL inside of Visual Studio, along with simple reporting facilities. All ideas will be appreciated, but let's make the assumption that PL/SQL is not the solution.

    Read the article

  • NUnit Test Case Code Generator Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information

    - by user1732969
    im trying to load an assembly nunit created in Monodevelop Im using the software NUnit Test Case Code Generator for create unit testing http://www.codeproject.com/Articles/28461/NUnit-Test-Case-Code-Generator After compiling the project in MonoDevelop, loading file .dll of the proyect in Nunit Test case generator the following error appears: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. Can you help me?

    Read the article

  • Is there CI server software that can do all of this?

    - by SnOrfus
    I'm trying to put together a Continuous Integration server that will do the following: Work with subversion Use NUnit tests (fail build on failed tests) Use partcover (fail build on < X% coverage) Run code against FxCop (fail build on FxCop warnings, given settings) Run code against StyleCop (fail build on StyleCop warnings, given settings) Not as important: Be able to run from a sln file Be able to publish the application (ClickOnce is setup for the project already) I'm using TeamCity right now and it doesn't seem to do 3 or 5, and it doesn't have a runner for the newest NUnit. From the list of plugins that hudson has, it looks like it can do all of these except 3 (and the not as important requests). I've considered writing a plugin for hudons to use partcover, but that's adding more time to setting up a build server.

    Read the article

  • nunit2 Nant task always returns exit code 0 (TeamCity 5.0)

    - by Jonathan
    Hello, I just cannot for the life of me get my nant build file to terminate upon a test failure and return (thus preventing the packaging and artifact step from running) This is the unit part of the nant file: <target name="unittest" depends="build"> <nunit2 verbose="true" haltonfailure="false" failonerror="true" failonfailureatend="true"> <formatter type="Xml" /> <test assemblyname="Code\AppMonApiTests\bin\Release\AppMonApiTests.dll" /> </nunit2> </target> And regardless what combination of true/false i set the haltonfailure, failonerror, failonfailureatend properties to, the result is always this: [11:15:09]: Some tests has failed in C:\Build\TeamCity\buildAgent\work\ba5b94566a814a34\Code\AppMonApiTests\bin\Release\AppMonApiTests.dll, tests run terminated. [11:15:09]: NUnit Launcher exited with code: 1 [11:15:09]: Exit code 0 will be returned.1 Please help as i don't want to be publishing binarys where the unit tests have failed!!! TeamCity 5.0 build 10669 AppMonApiTests.dll references nunit.framework.dll v2.5.3.9345 unit isn't installed on the build server or GAC'd Using Nant-0.85 and Nantcontrib-0.85 Thanks, Jonathan

    Read the article

  • Unit Test to Run .sql script to SQL Create Database

    - by Lee Englestone
    Can anyone point me in the direction of how I could get a NUnit test to run a .sql file to Create / Setup a database. I know about the the TestFixtureSetUp and TestFixtureTearDown attributes / methods in NUnit. So I KNOW how to call methods before and after all or each unit tests. I'm just unsure of how to load and execute the contents of a .sql file agains a SQL Server 2005 database programatically. Any examples? This is part of our TDD / CI. We are wanting to create the database before and tear down the database after executing unit tests. Cheers, -- Lee

    Read the article

  • How can I create a MethodInfo from an Action delegate

    - by Michael Meadows
    I am trying to develop an NUnit addin that dynamically adds test methods to a suite from an object that contains a list of Action delegates. The problem is that NUnit appears to be leaning heavily on reflection to get the job done. Consequently, it looks like there's no simple way to add my Actions directly to the suite. I must, instead, add MethodInfo objects. This would normally work, but the Action delegates are anonymous, so I would have to build the types and methods to accomplish this. I need to find an easier way to do this, without resorting to using Emit. Does anyone know how to easily create MethodInfo instances from Action delegates?

    Read the article

  • MS Test : How do I enforce exception message with ExpectedException attribute

    - by CRice
    I thought these two tests should behave identically, in fact I have written the test in my project using MS Test only to find out now that it does not respect the expected message in the same way that nunit does. nunit (fails): [Test, ExpectedException(typeof(System.FormatException), ExpectedMessage = "blah")] public void Validate() { int.Parse("dfd"); } ms test (passes): [TestMethod, ExpectedException(typeof(System.FormatException), "blah")] public void Validate() { int.Parse("dfd"); } No matter what message I give the ms test, it will pass. Is there any way to get the ms test to fail if the message is not right? Can I even create my own exception attribute? I would rather not have to write a try catch block for every test where this occurs.

    Read the article

  • Unit tests logged (or run) multiple times

    - by HeavyWave
    I have this simple test: protected readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().ReflectedType); private static int count = 0; [Test] public void TestConfiguredSuccessfully() { logger.Debug("in test method" + count++); } log4net is set up like this: [TestFixtureSetUp] public void SetUp() { log4net.Config.BasicConfigurator.Configure(); } The problem is, that if I run this test in nUnit once, I get the output (as expected): 1742 [TestRunnerThread] DEBUG Tests.TestSomthing (null) - in test method0 But if I press RUN in nUnit.exe again (or more) I get the following: 1742 [TestRunnerThread] DEBUG Tests.TestSomthing (null) - in test method1 1742 [TestRunnerThread] DEBUG Tests.TestSomthing (null) - in test method1 And so on (if I run it 5 times, I'll get 5 repeating lines). Now, if I run the same test alone from reSharper the output is fine and does not repeat. However, if I run this test along side 2 other tests in the same class, the output is repeated three times. I am totally confused. What the hell is going on here?

    Read the article

  • Silverlight unit testing. Error while running tests.

    - by 1gn1ter
    I'm using VS2010. Silverlight 4, NUnit 2.5.5, and TypeMock TypemockIsolatorSetup6.0.3.619.msi In the test project MVVM is implemented, PeopleViewModel is a ViewModel which I want to test. Please advise if you use other products for unit testing of MVVM Silverlight. Or please help to win this TypeMock. TIA This is the code of the test: [Test] [SilverlightUnitTest] public void SomeTestAgainstSilverlight() { PeopleViewModel o = new PeopleViewModel(); var res = o.People; Assert.AreEqual(15, res.Count()); } While running the test in ReSharper i get the following error: TestA.SomeTestAgainstSilverlight : Failed****************************************** *Loading Silverlight Isolation Aspects...* ****************************************** TEST RESULTS: --------------------------------------------- System.MissingMethodException : Method not found: 'hv TypeMock.ArrangeActAssert.Isolate.a(System.Delegate)'. at a4.a(ref Delegate A_0) at a4.a(Boolean A_0) at il.b() at CThru.Silverlight.SilverlightUnitTestAttribute.Init() at CThru.Silverlight.SilverlightUnitTestAttribute.Execute() at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5) at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected) at Tests.TestA.SomeTestAgainstSilverlight() in TestA.cs: line 21 While running test in NUnit i get: Tests.TestA.SomeTestAgainstSilverlight: System.DllNotFoundException : Unable to load DLL 'agcore': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at MS.Internal.XcpImports.Application_GetCurrentNative(IntPtr context, IntPtr& obj) at MS.Internal.XcpImports.Application_GetCurrent(IntPtr& pApp) at System.Windows.Application.get_Current() at ViewModelExample.ViewModel.ViewModelBase.get_IsDesignTime() in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\ViewModelBase.cs:line 20 at ViewModelExample.ViewModel.PeopleViewModel..ctor(IServiceAgent serviceAgent) in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\PeopleViewModel.cs:line 28 at ViewModelExample.ViewModel.PeopleViewModel..ctor() in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\PeopleViewModel.cs:line 24 at Tests.TestA.SomeTestAgainstSilverlight() in C:\Documents and Settings\USER\Desktop\ViewModelExample\Tests\TestA.cs:line 22

    Read the article

  • How can this code throw a NullReferenceException?

    - by Davy8
    I must be going out of my mind, because my unit tests are failing because the following code is throwing a null ref exception: int pid = 0; if (parentCategory != null) { Console.WriteLine(parentCategory.Id); pid = parentCategory.Id; } The line that's throwing it is: pid = parentCategory.Id; The console.writeline is just to debug in the NUnit GUI, but that outputs a valid int. Edit: It's single-threaded so it can't be assigned to null from some other thread, and the fact the the Console.WriteLine successfully prints out the value shows that it shouldn't throw. Edit: Relevant snippets of the Category class: public class Category { private readonly int id; public Category(Category parent, int id) { Parent = parent; parent.PerformIfNotNull(() => parent.subcategories.AddIfNew(this)); Name = string.Empty; this.id = id; } public int Id { get { return id; } } } Well if anyone wants to look at the full code, it's on Google Code at http://code.google.com/p/chefbook/source/checkout I think I'm going to try rebooting the computer... I've seen pretty weird things fixed by a reboot. Will update after reboot. Update: Mystery solved. Looks like NUnit shows the error line as the last successfully executed statement... Copy/pasted test into new console app and ran in VS showed that it was the line after the if statement block (not shown) that contained a null ref. Thanks for all the ideas everyone. +1 to everyone that answered.

    Read the article

  • How Best to Replace Ugly Queries and Dynamic PL/SQL with C#?

    - by Mike
    Hi, I write a lot of one-off Oracle SQL queries (in Toad), and sometimes they can get complex, involving lots of unions, joins, and subqueries, and sometimes requiring dynamic SQL. That is, sometimes SQL queries require set based processing along with significant procedural processing. This is what PL/SQL is custom made for, but as a language it does not begin to compare to C#. Now and then I convert a PL/SQL procedure to C#, and am always amazed at how much cleaner and easier to both read and write the C# version is. The C# program might for example construct a SQL query string piece by piece and/or run several queries and process them as needed. The C# version is usually much faster as well, which must mean that I'm not very good at PL/SQL either. I do not currently have access to LINQ. My question is, how best to package all these little C# programs, which are really just mini reports, that is, replacements for ugly SQL queries? Right now I'm actually using NUnit to hold them, and calling each report a [Test], even though they aren't really tests. NUnit just happens to provide a convenient packaging framework.

    Read the article

  • Why Moq is thorwing "expected Invocation on the mock at least once". Where as it is being set once,e

    - by Mohit
    Following is the code. create a class lib add the ref to NUnit framework 2.5.3.9345 and Moq.dll 4.0.0.0 and paste the following code. Try running it on my machine it throws TestCase 'MoqTest.TryClassTest.IsMessageNotNull' failed: Moq.MockException : Expected invocation on the mock at least once, but was never performed: v = v.Model = It.Is(value(Moq.It+<c__DisplayClass21[MoqTest.GenInfo]).match) at Moq.Mock.ThrowVerifyException(IProxyCall expected, Expression expression, Times times, Int32 callCount) at Moq.Mock.VerifyCalls(Interceptor targetInterceptor, MethodCall expected, Expression expression, Times times) at Moq.Mock.VerifySet[T](Mock1 mock, Action1 setterExpression, Times times, String failMessage) at Moq.Mock1.VerifySet(Action`1 setterExpression) Class1.cs(22,0): at MoqTest.TryClassTest.IsMessageNotNull() using System; using System.Collections.Generic; using System.Linq; using System.Text; using Moq; using NUnit.Framework; namespace MoqTest { [TestFixture] public class TryClassTest { [Test] public void IsMessageNotNull() { var mockView = new Mock<IView<GenInfo>>(); mockView.Setup(v => v.ModuleId).Returns(""); TryPresenter tryPresenter = new TryPresenter(mockView.Object); tryPresenter.SetMessage(new object(), new EventArgs()); // mockView.VerifySet(v => v.Message, Times.AtLeastOnce()); mockView.VerifySet(v => v.Model = It.Is<GenInfo>(x => x != null)); } } public class TryPresenter { private IView<GenInfo> view; public TryPresenter(IView<GenInfo> view) { this.view = view; } public void SetMessage(object sender, EventArgs e) { this.view.Model = null; } } public class MyView : IView<GenInfo> { #region Implementation of IView<GenInfo> public string ModuleId { get; set; } public GenInfo Model { get; set; } #endregion } public interface IView<T> { string ModuleId { get; set; } T Model { get; set; } } public class GenInfo { public String Message { get; set; } } } And if you change one line mockView.VerifySet(v = v.Model = It.Is(x = x != null)); to mockView.VerifySet(v = v.Model, Times.AtLeastOnce()); it works fine. I think Exception is incorrect.

    Read the article

  • Why Moq is throwing "expected Invocation on the mock at least once". Where as it is being set once,e

    - by Mohit
    Following is the code. create a class lib add the ref to NUnit framework 2.5.3.9345 and Moq.dll 4.0.0.0 and paste the following code. Try running it on my machine it throws TestCase 'MoqTest.TryClassTest.IsMessageNotNull' failed: Moq.MockException : Expected invocation on the mock at least once, but was never performed: v = v.Model = It.Is(value(Moq.It+<c__DisplayClass21[MoqTest.GenInfo]).match) at Moq.Mock.ThrowVerifyException(IProxyCall expected, Expression expression, Times times, Int32 callCount) at Moq.Mock.VerifyCalls(Interceptor targetInterceptor, MethodCall expected, Expression expression, Times times) at Moq.Mock.VerifySet[T](Mock1 mock, Action1 setterExpression, Times times, String failMessage) at Moq.Mock1.VerifySet(Action`1 setterExpression) Class1.cs(22,0): at MoqTest.TryClassTest.IsMessageNotNull() using System; using System.Collections.Generic; using System.Linq; using System.Text; using Moq; using NUnit.Framework; namespace MoqTest { [TestFixture] public class TryClassTest { [Test] public void IsMessageNotNull() { var mockView = new Mock<IView<GenInfo>>(); mockView.Setup(v => v.ModuleId).Returns(""); TryPresenter tryPresenter = new TryPresenter(mockView.Object); tryPresenter.SetMessage(new object(), new EventArgs()); // mockView.VerifySet(v => v.Message, Times.AtLeastOnce()); mockView.VerifySet(v => v.Model = It.Is<GenInfo>(x => x != null)); } } public class TryPresenter { private IView<GenInfo> view; public TryPresenter(IView<GenInfo> view) { this.view = view; } public void SetMessage(object sender, EventArgs e) { this.view.Model = null; } } public class MyView : IView<GenInfo> { #region Implementation of IView<GenInfo> public string ModuleId { get; set; } public GenInfo Model { get; set; } #endregion } public interface IView<T> { string ModuleId { get; set; } T Model { get; set; } } public class GenInfo { public String Message { get; set; } } } And if you change one line mockView.VerifySet(v => v.Model = It.Is<GenInfo>(x => x != null)); to mockView.VerifySet(v => v.Model, Times.AtLeastOnce()); it works fine. I think Exception is incorrect.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >