Search Results

Search found 4765 results on 191 pages for 'gh unit'.

Page 66/191 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • unittest in python: ignore an import from the code I want to test

    - by vaidab
    I have a python program that imports pythoncom (and uses pythoncom.CoCreateInstance from it). I want to create a unittest for the program logic without it importing pythoncom (so I can run the test on Linux as well). What options are there? Can I do it without modifying the system under test? What I found so far: sys.modules["pythoncom"] = "test" import module_that_imports_pythoncom My problem with it is if I have: from pythoncom.something import something I'll get: ImportError: No module named something.something And sys.modules["something.something"] or sys.modules["pythoncom.something.something"] doesn't work. Any ideas?

    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

  • Best practices to test protected methods with PHPUnit

    - by GrGr
    Hello, I found the discussion on Do you test private method informative. I have decided, that in some classes, I want to have protected methods, but test them. Some of these methods are static and short. Because most of the public methods make use of them, I will probably be able to safely remove the tests later. But for starting with a TDD approach and avoid debugging, I really want to test them. I thought of the following: Method Object as adviced in an answer seems to be overkill for this. Start with public methods and when code coverage is given by higher level tests, turn them protected and remove the tests. Inherit a class with a testable interface making protected methods public Which is best practice? Is there anything else? It seems, that JUnit automatically changes protected methods to be public, but I did not have a deeper look at it. PHP does not allow this via reflection.

    Read the article

  • NUnit [Test] is not a valid attribute

    - by tyndall
    I've included the necessary assemblies into a Windows Class project in VS2008. When I start to try to write a test I get a red squiggle line and the message [Test] is not a valid attribute. I've used NUnit before... maybe an earlier version. What am I doing wrong? I'm on version 2.5.2. using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit; using NUnit.Core; using NUnit.Framework; namespace AccessPoint.Web.Test { public class LoginTests { [Test] public void CanLogin() { } } }

    Read the article

  • How can I display more info in an error message when using NUnit Assert in a loop?

    - by Ian
    Consider the following code: [Test] public void WidgetTest() { foreach (Widget widget in widgets) { Assert.AreEqual(0, widget.SomeValue); } } If one of the asserts fails, I will get a very unhelpful error message like the one below: 1) Test Failure : WidgetTest.TestSomeValue Expected: 0 But was: 1 at WidgetTest.TestSomeValue() So, the question is, how can I get NUnit to display more useful info, such as the name of the widget, or the iteration of the loop, etc? Even a line number would be more helpful, since this is run in automated manner and I'd like to be able to spot the failing assert without debugging into the code.

    Read the article

  • Best way to test class methods without running __init__

    - by KenFar
    I've got a simple class that gets most of its arguments via init, which also runs a variety of private methods that do most of the work. Output is available either through access to object variables or public methods. Here's the problem - I'd like my unittest framework to directly call the private methods called by init with different data - without going through init. What's the best way to do this? So far, I've been refactoring these classes so that init does less and data is passed in separately. This makes testing easy, but I think the usability of the class suffers a little.

    Read the article

  • How do I verify my EF4 Code-Only mappings?

    - by Tomas Lycken
    In NHibernate, there is a method doing something like ThisOrThat.VeryfyMappings() (I don't know the exact definition of it since it was a while ago I last tried NHibernate...) I recall seeing a blog post somewhere where the author showed how to do some similar testing in Entity Framework 4, but now I cant find it. So, how do I test my EF4 Code-Only mappings?

    Read the article

  • Unable to locate using find element by link

    - by First Rock
    Newbie in testing. I generated a test case using Selenium, and then exported it as a Python script. Now, when I try to run that in terminal, I get following error: raise exception_class(message, screen, stacktrace) NoSuchElementException: Message: u'Unable to locate element: {"method":"link text","selector":"delete"}' I am using the command generated by Selenium i.e driver.find_element_by_link_text("delete").click() The reason for the error I believe is that the link "delete" in my web page is seen only when I click on a particular line to be deleted. So I guess it is being unable to locate the link. Please suggest what alternative measure could I use to locate and click on the "delete" link. Thanks in Advance:)

    Read the article

  • PHP: How to begin testing large, existing codebase, and test for regression on production site?

    - by anonymous coward
    I'm in charge of at least one large body of existing PHP code, that desperately needs tests, and as well I need some method of checking the production site for errors. I've been working with PHP for many years, but am unfortunately new to testing. (Sorry!). While writing tests for code that has predictable outcomes seems easy enough, I'm having trouble wrapping my head around just how I can test the live site, to ensure proper output. I know that in a test environment, I could set up the database in a known state... but are there proper methods or techniques for testing a live site? Where should I begin? [I am aware of PHPUnit and SimpleTest, but haven't chosen one over the other yet]

    Read the article

  • C# Attributes Aren't Supposed to Inherit

    - by Adam
    Since attributes don't inherit in C# (at least I didn't think they did) - how does the following code still display the Hello popup when the MyTestMethod test is run: [TestClass] public class BaseTestClass { [TestInitialize] public void Foo() { System.Windows.Forms.MessageBox.Show("Hello"); } } [TestClass] public class TestClass : BaseTestClass { [TestMethod] public void MyTestMethod() { Assert.IsTrue(true); } }

    Read the article

  • How to test that action uses argument?

    - by Caster Troy
    I am supposed to be using test-driven development but in this particular case, as I am having trouble, I implemented the action method first. It looks like this: public ViewResult Index(int pageNumber = 1) { var posts = repository.All(); var model = new PagedList<Post>(posts, pageNumber, PageSize); return View(model); } Both the repository and the PagedList<> have been tested already. Now I want to verify that when the action is given a page number that the page number is actually considered. private Mock<IPostsRepository> repository; private HomeController controller; [Test] public void Index_Doohickey() { var actual = controller.Index(2); // .. How do I test that the controller actually uses the page number here? }

    Read the article

  • Managing test data for Junit tests.

    - by nobody
    Hi, We are facing one problem in managing test data(xmls which is used to create mock objects). The data which we have currently has been evolved over a long period of time. Each time we add a new functionality or test case we add new data to test that functionality. Now, the problem is when the business requirement changes the format( like length or format of a variable) or any change which the test data doesn't support , we need to change the entire test data which is 100s of MBs in size. Could anyone suggest a better method or process to overcome this problem? Any suggestion would be appreciated.

    Read the article

  • How can I pass in specific parameters to mstest in Visual Studio

    - by Eric Langland
    I'm trying to modify my test projuect to allow for remote invocation of an api we're building. Right now the tests are hard coded to run locally(against localhost), but I would like to be able to point the tests at any endpoint (even remote ones in production). Ideally there would be a place in the .testsettings for config values to be stored. Sadly this isn't the case. Or, being able to pass parameters to MSTest that the test would read...? Any ideas? Thanks in advance.

    Read the article

  • Hyperlinks in VS2008 Test Result Details

    - by Red XIII
    In case when resulting string in "Test Result Details" (TRD) is very long, the Visual Studio 2008 crashes. I fixed this by sending the result data into a file. There is a problem, however, because there isn't a simple way to open such file. Of course, I can manually open folder and then the file, but it isn't very efficient. Now, to the questions part. Is there a possibility to include in the "Error Message" part of TRD a hyperlink to a file? (something similar to what we can already find in the stack trace part) If not, is there any way to add such functionality (easy opening of a file) to TRD? If not, are there any ways to expand the default reporting of VS? Thanks for any help.

    Read the article

  • JUnit Theories: Why can't I use Lists (instead of arrays) as DataPoints?

    - by MatrixFrog
    I've started using the new(ish) JUnit Theories feature for parameterizing tests. If your Theory is set up to take, for example, an Integer argument, the Theories test runner picks up any Integers marked with @DataPoint: @DataPoint public static Integer number = 0; as well as any Integers in arrays: @DataPoints public static Integer[] numbers = {1, 2, 3}; or even methods that return arrays like: @DataPoints public static Integer[] moreNumbers() { return new Integer[] {4, 5, 6};}; but not in Lists. The following does not work: @DataPoints public static List<Integer> numberList = Arrays.asList(7, 8, 9); Am I doing something wrong, or do Lists really not work? Was it a conscious design choice not to allow the use Lists as data points, or is that just a feature that hasn't been implemented yet? Are there plans to implement it in a future version of JUnit?

    Read the article

  • Strategies for testing reactive, asynchronous code

    - by Arne
    I am developing a data-flow oriented domain-specific language. To simplify, let's just look at Operations. Operations have a number of named parameters and can be asked to compute their result using their current state. To decide when an Operation should produce a result, it gets a Decision that is sensitive to which parameter got a value from who. When this Decision decides that it is fulfilled, it emits a Signal using an Observer. An Accessor listens for this Signal and in turn calls the Result method of the Operation in order to multiplex it to the parameters of other Operations. So far, so good, nicely decoupled design, composable and reusable and, depending on the specific Observer used, as asynchronous as you want it to be. Now here's my problem: I would love to start coding actual Tests against this design. But with an asynchronous Observer... how should I know that the whole signal-and-parameters-plumbing worked? Do I need to use time outs while waiting for a Signal in order to say that it was emitted successfully or not? How can I be, formally, sure that the Signal will not be emitted if I just wait a little longer (halting problem? ;-)) And, how can I be sure that the Signal was emitted because it was me who set a parameter, and not another Operation? It might well be that my test comes to early and sees a Signal that was emitted way before my setting a parameter caused a Decision to emit it. Currently, I guess the trivial cases are easy to test, but as soon as I want to test complex many-to-many - situations between operations I must resort to hoping that the design Just Works (tm)...

    Read the article

  • C# InternalsVisibleTo() attribute for VBNET 2.0 while testing?

    - by Will Marcouiller
    I'm building an Active Directory wrapper in VBNET 2.0 (can't use later .NET) in which I have the following: IUtilisateur IGroupe IUniteOrganisation These interfaces are implemented in internal classes (Friend in VBNET), so that I want to implement a façade in order to instiate each of the interfaces with their internal classes. This will allow the architecture a better flexibility, etc. Now, I want to test these classes (Utilisateur, Groupe, UniteOrganisation) in a different project within the same solution. However, these classes are internal. I would like to be able to instantiate them without going through my façade, but only for these tests, nothing more. Here's a piece of code to illustrate it: public static class DirectoryFacade { public static IGroupe CreerGroupe() { return new Groupe(); } } // Then in code, I would write something alike: public partial class MainForm : Form { public MainForm() { IGroupe g = DirectoryFacade.CreerGroupe(); // Doing stuff with instance here... } } // My sample interface: public interface IGroupe { string Domaine { get; set; } IList<IUtilisateur> Membres { get; } } internal class Groupe : IGroupe { private IList<IUtilisateur> _membres; internal Groupe() { _membres = new List<IUtilisateur>(); } public string Domaine { get; set; } public IList<IUtilisateur> Membres { get { return _membres; } } } I heard of InternalsVisibleTo() attribute, recently. I was wondering whether it is available in VBNET 2.0/VS2005 so that I could access the assmebly's internal classes for my tests? Otherwise, how could I achieve this?

    Read the article

  • Does Visual Studio run Tests with a less privileged process?

    - by Filip Ekberg
    I have an application that is supposed to read from the Registry and when executing a console application my registry access works perfectly. However when I move it over to a test this returns null: var masterKey = Registry.LocalMachine.OpenSubKey("path_to_my_key"); So my question is: Does Visual Studio run Tests with a less privileged process? I tested to see what user this gave me: var x = WindowsIdentity.GetCurrent().Name; and it gives me the same as in the console application. So I am a bit confused here.

    Read the article

  • Unittest in Django. Static variable feeded into the test case

    - by ziang
    I want to generate some dynamic data and feed these data in to test cases. But I found that Django will initial the test class every time to do the test. So the data will get generated every time django test framework calls the function. Is there anyway to use something like the singleton or static variable to solve the problem? What should be the solution? Thanks!

    Read the article

  • Testing Hibernate DAO, without building the universe around it.

    - by Varun Mehta
    We have an application built using spring/Hibernate/MySQL, now we want to test the DAO layer, but here are a few shortcomings we face. Consider the use case of multiple objects connected to one another, eg: Book has Pages. The Page object cannot exist without the Book as book_id is mandatory FK in Page. For testing a Page I have to create a Book. This simple usecase is easy to manage, but if you start building a Library, till you don't create the whole universe surrounding the Book and Page, you cannot test it! So to test Page; Create Library Create Section Create Genre Create Author Create Book Create Page Now test Page. Is there an easy way to by pass this "universe creation" and just test he page object in isolation. I also want to be able to test HQLs related to Page. eg: SELECT new com.test.BookPage (book.id, page.name) FROM Book book, Page page. JUnit is supposed to run in isolation, so I have to write the whole test case to create the Page. Any tips will be useful.

    Read the article

  • How to emulate onLowMemory()?

    - by Samuh
    I have put some instructions in onLowMemory() callback and want to test the same. Is there a "direct" way to test onLowMemory function of the application subclass? Or will I have to just overload the phone by starting many apps and doing memory intensive tasks? Thanks.

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >