Search Results

Search found 5783 results on 232 pages for 'translation unit'.

Page 77/232 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • 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

  • Cannot execute newly created TestMethod in VS2010

    - by FrontSvin
    When I try to run a new TestMethod on an existing TestClass in Visual Studio 2010 (by right-clicking on the method name and choosing Run Tests) the test method does not execute. After a restart of VS, the problem has gone. Am I missing some refresh thing, or is right-clicking even the correct way of executing a single test method?

    Read the article

  • Python/Django tests running only one test at a time

    - by user2876296
    I have a unittest for my view class TestFromAllAdd(TestCase): fixtures = ['staging_accounts_user.json', 'staging_main_category.json', 'staging_main_dashboard.json', 'staging_main_location.json', 'staging_main_product.json', 'staging_main_shoppinglist.json'] def setUp(self): self.factory = RequestFactory() self.c = Client() self.c.login(username='admin', password='admin') def from_all_products_html404_test(self): request = self.factory.post('main/adding_from_all_products', {'product_id': ''}) request.user = User.objects.get(username= 'admin') response = adding_from_all_products(request) self.assertEqual(response.status_code, 404) But I have a few more classes with tests and I cant run them all at the same time: python manage.py test main doesnt run tests, but if i run; python manage.py test main.TestFromAllAdd.from_all_products_html404_test , runs one test;

    Read the article

  • Junit | How to test parameters in a method

    - by MMRUser
    How do I test parameters inside a method itself. For example class TestClass { public void paraMethod(String para1, String para2) { String testPara1 = para1; String testPara2 = para2; } } class TestingClass { @Test public void testParaMethod () throws Exception { String myPara1 = "MyPara1"; String myPara2 = "MyPara2"; new TestClass().paraMethod(myPara1, myPara2); } } Ok, so is it possible to test if the testPara1 and testPara2 are properly set to the values that I have passed? Thanks.

    Read the article

  • Keeping iPhone App private after AppStore approval for beta testing.

    - by Stack
    I have messed around with AD-HOC distribution quite a bit and got it working too. The problem I am facing is all the people who I want to use as beta testers are "normal people" who never even sync their iPhone to iTunes on a computer. So, you can understand how technically challenged these people are, which is fine with me because that is the audience I want to use for testing. All these guys can do for me is if I can give them an AppStore link they will download it on their iPhone and test it for me. So, basically AD-HOC distribution (UDIDs, mobileprovision file and all that crap) is out of question for me. My Question is after AppStore approves my app, is there a way for me to be under the radar so that normal public can not download the app until I am ready. From past experience I know that the moment you put an app out there, in first week you get 100s of downloads and I dont want that to happen until my beta testing is finished.

    Read the article

  • How to make an unit test always pass?

    - by brain_damage
    Let's assume someone has to write a solution to a problem and I have to test his solution with some tests. Is it possible (maybe with reflections or something) his program to pass all my tests, but to have nothing in common with the real solution to the problem?

    Read the article

  • Why Create Mock Objects?

    - by Chris
    During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed." Judging by response, my answer clearly was not what the interviewer was looking for. What's a better answer?

    Read the article

  • Using Moq to Validate Separate Invocations with Distinct Arguments

    - by Thermite
    I'm trying to validate the values of arguments passed to subsequent mocked method invocations (of the same method), but cannot figure out a valid approach. A generic example follows: public class Foo { [Dependency] public Bar SomeBar { get; set; } public void SomeMethod() { this.SomeBar.SomeOtherMethod("baz"); this.SomeBar.SomeOtherMethod("bag"); } } public class Bar { public void SomeOtherMethod(string input) { } } public class MoqTest { [TestMethod] public void RunTest() { Mock<Bar> mock = new Mock<Bar>(); Foo f = new Foo(); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("baz"))); mock.Setup(m => m.SomeOtherMethod(It.Is<string>("bag"))); // this of course overrides the first call f.SomeMethod(); mock.VerifyAll(); } } Using a Function in the Setup might be an option, but then it seems I'd be reduced to some sort of global variable to know which argument/iteration I'm verifying. Maybe I'm overlooking the obvious within the Moq framework?

    Read the article

  • Application test recommendation

    - by Polaris
    I never use unitests in my apps . I know that exists many technologies for testing .NET based application. (For example NUnit). Which of this tools more comfortable and more understandable to use. Please can you show the good articles where can I find information about unitests and understand key situation where I must use them?

    Read the article

  • JUnit - assertSame

    - by Michael
    Can someone tell me why assertSame() do fail when I use values 127? import static org.junit.Assert.*; ... @Test public void StationTest1() { .. assertSame(4, 4); // OK assertSame(10, 10); // OK assertSame(100, 100); // OK assertSame(127, 127); // OK assertSame(128, 128); // raises an junit.framework.AssertionFailedError! assertSame(((int) 128),((int) 128)); // also junit.framework.AssertionFailedError! } I'm using JUnit 4.8.1.

    Read the article

  • Unit Conversion from feet to meters

    - by user1742419
    I have to write a program that reads in a length in feet and inches and outputs the equivalent length in meters and centimeters. I have to create three functions: one for input, one or more for calculating, and one for output; And include a loop that lets the user repeat this computation for new input values until the user says he or she wants to end the program. I can't seem to get the input from one function to be used in the conversion function and then outputted by the next function. How do I do that? Thank you. #include <iostream> #include <conio.h> using namespace std; double leng; void length(double leng); double conv(double leng); void output(double leng); int main() { length(leng); conv(leng); output(leng); _getche(); return 0; } void length(double leng) { cout<<"Enter a length in feet, then enter a length in inches if needed: "; cin>>leng; return; } double conv(double leng) { return leng = leng * .3048; } void output(double leng) { cout<<"Your input is converted to "<<leng; return; }

    Read the article

  • Catch test case order [on hold]

    - by DeadMG
    Can I guarantee the order of execution with multiple TEST_CASEs with Catch? I am testing some code using LLVM, and they have some despicable global state that I need to explicitly initialize. Right now I have one test case that's like this: TEST_CASE("", "") { // Initialize really shitty LLVM global variables. llvm::InitializeAllTargets(); llvm::InitializeAllTargetMCs(); llvm::InitializeAllAsmPrinters(); llvm::InitializeNativeTarget(); llvm::InitializeAllAsmParsers(); // Some per-test setup I can make into its own function CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile(...)); CHECK_NOTHROW(Compile...)); CHECK_NOTHROW(Interpret(...)); CHECK_THROWS(Compile(...)); CHECK_THROWS(Compile(...)); } What I want is to refactor it into three TEST_CASE, one for tests that should pass compilation, one for tests that should fail, and -one for tests that should pass interpretation (and in the future, further such divisions, perhaps). But I can't simply move the test contents into another TEST_CASE because if that TEST_CASE is called before the one that sets up the inconvenient globals, then they won't be initialized and the testing will spuriously fail.

    Read the article

  • Python: Inheritance of a class attribute (list)

    - by Sano98
    Hi everyone, inheriting a class attribute from a super class and later changing the value for the subclass works fine: class Unit(object): value = 10 class Archer(Unit): pass print Unit.value print Archer.value Archer.value = 5 print Unit.value print Archer.value leads to the output: 10 10 10 5 which is just fine: Archer inherits the value from Unit, but when I change Archer's value, Unit's value remains untouched. Now, if the inherited value is a list, the shallow copy effect strikes and the value of the superclass is also affected: class Unit(object): listvalue = [10] class Archer(Unit): pass print Unit.listvalue print Archer.listvalue Archer.listvalue[0] = 5 print Unit.listvalue print Archer.listvalue Output: 10 10 5 5 Is there a way to "deep copy" a list when inheriting it from the super class? Many thanks Sano

    Read the article

  • Strategy game programming in Java, how the map and unit classes should work/relate each other.

    - by Gabriel A. Zorrilla
    As a way of learning Java i'm doing a little strategy game. You have a game map and military units. The gamemap and the units are Jpanels which are binded together in another class called GameWindow, which has a JLayeredPane where the gamepap is below the units. Every time i click a unit (and therefore, the JPane) I can get the unit's information. The problem comes when i want to move a unit... each unit is self drawn inside it's Jpanel, how do i represent the change in position over the gamemap? I'm thinking about reloading the whole game window based on a position change of a unit (because the JPAnels that represent the units are created in the GameWindow, not drawn in the gamemap). Another more elegant option, should be repainting the whole map, with the units. But that way the units would lose it's status of objects (no more JPAnels, just being drawn in the gamemap paint() method), and how would i tell if one unit is clicked? I dont know how people with more experience in games handle the class structure in strategy games. I believe i have the right structure (map, game units, each one an object) but I'm having difficulties making it work together. Here is a snapshot of the map with a couple of units:

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >