Search Results

Search found 10206 results on 409 pages for 'tooling and testing'.

Page 106/409 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • Mock a void method which change the input value

    - by Kar
    Hi, How could I mock a void method with parameters and change the value parameters? My void method looks like this: public interface IFoo { void GetValue(int x, object y) // takes x and do something then access another class to get the value of y } I prepared a delegate class: private delegate void GetValueDelegate(int x, object y); private void GetValue(int x, object y) { // process x // prepare a new object obj if (y == null) y = new Object(); if (//some checks) y = obj; } I wrote something like this: Expect.Call(delegate {x.GetValue(5, null);}).Do (new GetValueDelegate(GetValue)).IgnoreArguments().Repeat.Any(); But seems like it's not working. Any clue on what could be wrong?

    Read the article

  • defining a simple implicit Arbitary

    - by FredOverflow
    I have a type Foo with a constructor that takes an Int. How do I define an implicit Arbitrary for Foo to be used with scalacheck? implicit def arbFoo: Arbitrary[Foo] = ??? I came up with the following solution, but it's a bit too "manual" and low-level for my taste: val fooGen = for (i <- Gen.choose(Int.MinValue, Int.MaxValue)) yield new Foo(i) implicit def arbFoo: Arbitrary[Foo] = Arbitrary(fooGen) Ideally, I would want a higher-order function where I just have to plug in an Int => Foo function. I managed to cut it down to: implicit def arbFoo = Arbitrary(Gen.resultOf((i: Int) => new Foo(i))) But I still feel like there has got to be a slightly simpler way.

    Read the article

  • Spring MVC with several configurations

    - by Michael Bulla
    Hello, for my spring-mvc application I created several types of configuration (unittest, integration, qa, production). All the configs are in one war-file, so there is only one type of application I create. Which configuration to take should be decided by the server, where the application is running. To decide what kind of configuration should be used, I have to look into a file. After that I can decide which configuration should be used by spring mvc. For now by convention there is always the -servlet.xml used. Is there a way how to decide dynamically which config to take? Regards, Michael

    Read the article

  • what kind of credentials/prerequisites do you need to be a professional penetration tester ?

    - by dfafa
    does it take more than knowing Bt4 ? are there any one that just runs a scanner and no real labor involved ? would you be expected to be able to code your own exploits without having to dl from milw0rm and discover entry into a system by yourself, in other words, do you have to think outside the box even when there's so many tools that makes the job a lot easier ? would you ever be expected to be able to write your own scanners, exploits and etc ? i am also curious how people are able to write long pages of hex address, that magically causes some type of memory overflow...how are people guessing at the hex values for game hacks for instance ? are certification important ? what about formal school education ? I am a CS major.

    Read the article

  • Caching result of setUp() using Python unittest

    - by dbr
    I currently have a unittest.TestCase that looks like.. class test_appletrailer(unittest.TestCase): def setup(self): self.all_trailers = Trailers(res = "720", verbose = True) def test_has_trailers(self): self.failUnless(len(self.all_trailers) > 1) # ..more tests.. This works fine, but the Trailers() call takes about 2 seconds to run.. Given that setUp() is called before each test is run, the tests now take almost 10 seconds to run (with only 3 test functions) What is the correct way of caching the self.all_trailers variable between tests? Removing the setUp function, and doing.. class test_appletrailer(unittest.TestCase): all_trailers = Trailers(res = "720", verbose = True) ..works, but then it claims "Ran 3 tests in 0.000s" which is incorrect.. The only other way I could think of is to have a cache_trailers global variable (which works correctly, but is rather horrible): cache_trailers = None class test_appletrailer(unittest.TestCase): def setUp(self): global cache_trailers if cache_trailers is None: cache_trailers = self.all_trailers = all_trailers = Trailers(res = "720", verbose = True) else: self.all_trailers = cache_trailers

    Read the article

  • Given a typical Rails 3 environment, why am I unable to execute any tests?

    - by Tom
    I'm working on writing simple unit tests for a Rails 3 project, but I'm unable to actually execute any tests. Case in point, attempting to run the test auto-generated by Rails fails: require 'test_helper' class UserTest < ActiveSupport::TestCase # Replace this with your real tests. test "the truth" do assert true end end Results in the following error: <internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- test_helper (LoadError) from <internal:lib/rubygems/custom_require>:29:in `require' from user_test.rb:1:in `<main>' Commenting out the require 'test_helper' line and attempting to run the test results in this error: user_test.rb:3:in `<main>': uninitialized constant Object::ActiveSupport (NameError) The action pack gems appear to be properly installed and up to date: actionmailer (3.0.3, 2.3.5) actionpack (3.0.3, 2.3.5) activemodel (3.0.3) activerecord (3.0.3, 2.3.5) activeresource (3.0.3, 2.3.5) activesupport (3.0.3, 2.3.5) Ruby is at 1.9.2p0 and Rails is at 3.0.3. The sample dump of my test directory is as follows: /fixtures /functional /integration /performance /unit -- /helpers -- user_helper_test.rb -- user_test.rb test_helper.rb I've never seen this problem before - I've run the typical rake tasks for preparing the test environment. I have nothing out of the ordinary in my application or environment configuration files, nor have I installed any unusual gems that would interfere with the test environment. Edit Xavier Holt's suggestion, explicitly specifying the path to the test_helper worked; however, this revealed an issue with ActiveSupport. Now when I attempt to run the test, I receive the following error message (as also listed above): user_test.rb:3:in `<main>': uninitialized constant Object::ActiveSupport (NameError) But as you can see above, Action Pack is all installed and update to date.

    Read the article

  • Is Assert.Fail() considered bad practice?

    - by Mendelt
    I use Assert.Fail a lot when doing TDD. I'm usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where the name of the test method indicates what I want to implement as sort of a todo-list. To make sure I don't forget I put an Assert.Fail() in the body. When trying out xUnit.Net I found they hadn't implemented Assert.Fail. Of course you can always Assert.IsTrue(false) but this doesn't communicate my intention as well. I got the impression Assert.Fail wasn't implemented on purpose. Is this considered bad practice? If so why? @Martin Meredith That's not exactly what I do. I do write a test first and then implement code to make it work. Usually I think of several tests at once. Or I think about a test to write when I'm working on something else. That's when I write an empty failing test to remember. By the time I get to writing the test I neatly work test-first. @Jimmeh That looks like a good idea. Ignored tests don't fail but they still show up in a separate list. Have to try that out. @Matt Howells Great Idea. NotImplementedException communicates intention better than assert.Fail() in this case @Mitch Wheat That's what I was looking for. It seems it was left out to prevent it being abused in another way I abuse it.

    Read the article

  • Multiple asserts in single test?

    - by Gern Blandston
    Let's say I want to write a function that validates an email address with a regex. I write a little test to check my function and write the actual function. Make it pass. However, I can come up with a bunch of different ways to test the same function ([email protected]; [email protected]; test.test.com, etc). Do I put all the incantations that I need to check in the same, single test with several ASSERTS or do I write a new test for every single thing I can think of? Thanks!

    Read the article

  • How to unit-test a Wicket component with AbstractAjaxTimerBehavior?

    - by Juha Syrjälä
    I have a Wicket panel that has AbstractAjaxTimeBehavior, that I'd like to unit test. How can I trigger a ajax event during the unit test that end up calling AbstractAjaxTimeBehavior's .onTimer(AjaxRequestTarget target) method? behavior = new AbstractAjaxTimerBehavior(Duration.seconds(pollingPeriodInSeconds)) { protected void onTimer(AjaxRequestTarget target) { // how to unit test this? } } add(behavior);

    Read the article

  • ReSharper no longer runs unit tests

    - by Ed Woodcock
    Hey folks I'm trying to write some unit tests for an app I work on at work (In the vague hope that others might follow suit), and I was originally running these tests using NUnit and the ReSharper plugin. However, ReSharper will no longer run tests for me for some reason: It simply crosses them out with a red strikeout. There's no error code I'm afraid, and there's no mention of such behaviour on the JetBrains site. Has anyone else experienced similar benhaviour? Cheers, Ed

    Read the article

  • how to access objects in run-time in qtp?

    - by Onnesh
    We have a function which accesses two types of controls like button and list box in standard windows app. The function uses only the control name as arguments, so there is no way qtp could understand what type of control it is. how to resolve this? Write 2 separate functions- 1 for button & another for list box?

    Read the article

  • Test assertions for tuples with floats

    - by Space_C0wb0y
    I have a function that returns a tuple that, among others, contains a float value. Usually I use assertAlmostEquals to compare those, but this does not work with tuples. Also, the tuple contains other data-types as well. Currently I am asserting every element of the tuple individually, but that gets too much for a list of such tuples. Is there any good way to write assertions for such cases?

    Read the article

  • JUnit terminates child threads

    - by Marco
    Hi to all, When i test the execution of a method that creates a child thread, the JUnit test ends before the child thread and kills it. How do i force JUnit to wait for the child thread to complete its execution? Thanks

    Read the article

  • How to test a site rigorously?

    - by Sarfraz
    Hello, I recently created a big portal site. It's time for putting it to test. How do you guys test a site rigorously? What are the ways and tools for that? Can we sort of mimic hundreds of virtual users visiting the site to see its load handling? The test should be for both security and speed Thanks in advance.

    Read the article

  • Grails 1.3.3: controller.redirectArgs.action not populated

    - by Matthias Hryniszak
    Does anyone knows what happened to controller.redirectArgs.action in the latest version of Grails (1.3.3)? It used to work properly but now I get NPE when I use it. class FooController { def someRedirect = { redirect(action:"bar") } } class FooControllerTests extends grails.test.ControllerUnitTestCase { void testSomeRedirect() { controller.someRedirect() assertEquals "bar", controller.redirectArgs.action } } In this case controller.redirectArgs is already null...

    Read the article

  • How to test the performance of a user's PC in/for Flash?

    - by Jan P.
    Hey, I'm a developer on nice space MMO using Flash. On new PCs performance is quite good, but some features shouldn't be enabled on older PCs because the framerate drops to shit if we do. Flash wasn't made for this, but hey, pushing boundaries is fun. An example is fullscreen mode. Of course every user can manually enable it, but "advertising" it to a user with and oldie PC would be a bad idea - but for the Alienware crowd it would be dumb not to. So I want to find out how "capable" a user's PC is to decide if I should enable or disable some features for him. Any ideas? Thanks, Sujan

    Read the article

  • How to unit test private methods in BDD / TDD?

    - by robert_d
    I am trying to program according to Behavior Driven Development, which states that no line of code should be written without writing failing unit test first. My question is, how to use BDD with private methods? How can I unit test private methods? Is there better solution than: - making private methods public first and then making them private when I write public method that uses those private methods; or - in C# making all private methods internal and using InternalsVisibleTo attribute. Robert

    Read the article

  • Convert C# unit test names to English (testdox style)

    - by Igor Zevaka
    I have a whole bunch of unit tests written in MbUnit and I would like to generate plain English sentences from test names. The concept is introduced here: http://dannorth.net/introducing-bdd This is from the article: public class CustomerLookupTest extends TestCase { testFindsCustomerById() { ... } testFailsForDuplicateCustomers() { ... } ... } renders something like this: CustomerLookup - finds customer by id - fails for duplicate customers - ... Unfortunately the tool quoted in the above article (testdox) is Java based. Is there one for .NET? Sounds like this would be something pretty simple to write, but I simply don't have the bandwidth and want to use something already written.

    Read the article

  • Where is the help.py for Android's monkeyrunner

    - by Keyboardsurfer
    Hi, I just can't find the help.py file in order to create the API reference for the monkeyrunner. The command described at the Android references monkeyrunner <format> help.py <outfile> does not work when i call monkeyrunner html help.py /path/to/place/the/doc.html. It's quite obvious that the help.py file is not found and the monkeyrunner also tells me "Can't open specified script file". But a locate on my system doesn't bring me a help.py file that has anything to do with monkeyrunner or Android. So my question is: Where did they hide the help.py file for creating the API reference?

    Read the article

  • Passing a paramter/object to a ruby unit/test before running it using TestRunner

    - by Nahir Khan
    I'm building a tool that automates a process then runs some tests on it's own results then goes to do some other stuff. In trying to clean up my code I have created a separate file that just has the test cases class. Now before I can run these tests, I have to pass the class a couple of parameters/objects before they can be run. Now the problem is that I can't seem to find a way to pass a parameter/object to the test class. Right now I am thinking to generate a Yaml file and read it in the test class but it feels "wrong" to use a temporary file for this. If anyone has a nicer solution that would be great! *********Edit******* Example Code of what I am doing right now: #!/usr/bin/ruby require 'test/unit/ui/console/testrunner' require 'yaml' require 'TS_SampleTestSuite' automatingSomething() importantInfo = getImportantInfo() File.open('filename.yml', 'w') do |f| f.puts importantInfo.to_yaml end Test::Unit::UI::Console::TestRunner.run(TS_SampleTestSuite) Now in the example above TS_SampleTestSuite needs importantInfo, so the first "test case" is a method that just reads in the information from the Yaml file filname.yml. I hope that clears up some confusion.

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >