Search Results

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

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

  • How to rewrite data-driven test suites of JUnit 3 in Junit 4?

    - by rics
    I am using data-driven test suites running JUnit 3 based on Rainsberger's JUnit Recipes. The purpose of these tests is to check whether a certain function is properly implemented related to a set of input-output pairs. Here is the definition of the test suite: public static Test suite() throws Exception { TestSuite suite = new TestSuite(); Calendar calendar = GregorianCalendar.getInstance(); calendar.set(2009, 8, 05, 13, 23); // 2009. 09. 05. 13:23 java.sql.Date date = new java.sql.Date(calendar.getTime().getTime()); suite.addTest(new DateFormatTestToString(date, JtDateFormat.FormatType.YYYY_MON_DD, "2009-SEP-05")); suite.addTest(new DateFormatTestToString(date, JtDateFormat.FormatType.DD_MON_YYYY, "05/SEP/2009")); return suite; } and the definition of the testing class: public class DateFormatTestToString extends TestCase { private java.sql.Date date; private JtDateFormat.FormatType dateFormat; private String expectedStringFormat; public DateFormatTestToString(java.sql.Date date, JtDateFormat.FormatType dateFormat, String expectedStringFormat) { super("testGetString"); this.date = date; this.dateFormat = dateFormat; this.expectedStringFormat = expectedStringFormat; } public void testGetString() { String result = JtDateFormat.getString(date, dateFormat); assertTrue( expectedStringFormat.equalsIgnoreCase(result)); } } How is it possible to test several input-output parameters of a method using JUnit 4? This question and the answers explained to me the distinction between JUnit 3 and 4 in this regard. This question and the answers describe the way to create test suite for a set of class but not for a method with a set of different parameters.

    Read the article

  • Need help mocking a ASP.NET Controller in RhinoMocks

    - by Pure.Krome
    Hi folks, I'm trying to mock up a fake ASP.NET Controller. I don't have any concrete controllers, so I was hoping to just mock a Controller and it will work. This is what I have, currently. _fakeRequestBase = MockRepository.GenerateMock<HttpRequestBase>(); _fakeRequestBase.Stub(x => x.HttpMethod).Return("GET"); _fakeContextBase = MockRepository.GenerateMock<HttpContextBase>(); _fakeContextBase.Stub(x => x.Request).Return(_fakeRequestBase); var controllerContext = new ControllerContext(_fakeContextBase, new RouteData(), MockRepository.GenerateMock<ControllerBase>()); _fakeController = MockRepository.GenerateMock<Controller>(); _fakeController.Stub(x => x.ControllerContext).Return(controllerContext); Everything works except the last line, which throws a runtime error and is asking me for some Rhino.Mocks source code or something (which I don't have). See how I'm trying to mock up an abstract Controller - is that allowed? Can someone help me?

    Read the article

  • Python: How to run unittest.main() for all source files in a subdirectory?

    - by Pete
    I am developing a Python module with several source files, each with its own test class derived from unittest right in the source. Consider the directory structure: dirFoo\ test.py dirBar\ __init__.py Foo.py Bar.py To test either Foo.py or Bar.py, I would add this at the end of the Foo.py and Bar.py source files: if __name__ == "__main__": unittest.main() And run Python on either source, i.e. $ python Foo.py ........... ---------------------------------------------------------------------- Ran 11 tests in 2.314s OK Ideally, I would have "test.py" automagically search dirBar for any unittest derived classes and make one call to "unittest.main()". What's the best way to do this in practice? I tried using Python to call execfile for every *.py file in dirBar, which runs once for the first .py file found & exits the calling test.py, plus then I have to duplicate my code by adding unittest.main() in every source file--which violates DRY principles.

    Read the article

  • Is it possible to talk to the iPhone simulator/device.

    - by Plumenator
    I need to automate the build/deploy process for my iphone applications from a script. I can use xcodebuild to build the project, then use Applescript to deploy and debug/run the application. Assuming the application will stop by itself after a while, I need to collect the generated logs for verification. But the problem is I have no way to know when the application ended from outside of the application itself. If the running time is fixed, I can again use Applescript to stop the application (Cmd+Shift+Enter). So there has to be a way to connect to the device/simulator and wait on the application somehow.

    Read the article

  • Fluent NHibernate CheckProperty and Dates

    - by Chris C
    I setup a NUnit test as such: new PersistenceSpecification<MyTable>(_session) .CheckProperty(c => c.ActionDate, DateTime.Now); When I run the test via NUnit I get the following error: SomeNamespace.MapTest: System.ApplicationException : Expected '2/23/2010 11:08:38 AM' but got '2/23/2010 11:08:38 AM' for Property 'ActionDate' The ActionDate field is a datetime field in a SQL 2008 database. I use Auto Mapping and declare the ActionDate as a DateTime property in C#. If I change the test to use DateTime.Today the tests pass. My question is why is the test failing with DateTime.Now? Is NHibernate losing some precision when saving the date to the database and if so how do prevent the lose? Thank you.

    Read the article

  • How to flush coverage data when my test cause app crash - For ios app

    - by Ypy
    I want to get the code coverage of my tests. So I set the settings, build an app with .gcno files and run it on simulator. It can get the coverage data successfully if there is no crash issue. But if the app crashed, I will get nothing. So how can I get the code coverage data when the app crash? In my thought, this is because it will not call __gcov_flush() method when app crash. I only add app does not run in background to my plist file, so __gcov_flush() is called only at the time I press Home button. Is there any way to call __gcov_flush() before the app crash?

    Read the article

  • Multi language testing framework

    - by santiiiii
    I need to write two versions of the same application, one in .NET and the other one in Java. So I'd like to write a single test suite, and then use it against both codebases. Which testing tool would you advise me to use?

    Read the article

  • How to test Guice Singleton?

    - by 01
    Guice Singletons are weird for me First I thought that IService ser = Guice.createInjector().getInstance(IService.class); System.out.println("ser=" + ser); ser = Guice.createInjector().getInstance(IService.class); System.out.println("ser=" + ser); will work as singleton, but it returns ser=Service2@1975b59 ser=Service2@1f934ad its ok, it doesnt have to be easy. Injector injector = Guice.createInjector(); IService ser = injector.getInstance(IService.class); System.out.println("ser=" + ser); ser = injector.getInstance(IService.class); System.out.println("ser=" + ser); works as singleton ser=Service2@1975b59 ser=Service2@1975b59 So i need to have static field with Injector(Singleton for Singletons) how do i pass to it Module for testing?

    Read the article

  • Reports Generation for Web Based Application Using Selenium Tool

    - by Rahul Mendiratta
    Currently we are generating HTML Reports for Automation, but those reports are not good enough to explain number of scenario which we cover in Automation, Is there anything we can use with Selenium to generate a proper reports which can give a complete overview and can easily understand by anyone First Thing we can show a complete pie charts which cover number of test case passed and Failed. Second thing we can show, what are test cases are there in this build.

    Read the article

  • Asp.Net MVC How to test that the view rendered

    - by Miau
    HI there I was wondering if there is a better way of testing that a view has rendered in MVC. I was thinking perhaps I should render the view to a string but perhaps there are simpler methods? Basically what I want to know if that the view for a given action has rendered without errors I m already testing the view model but I want to see that rendering the view giving a correct ViewData.Model works

    Read the article

  • Receiving an Expectedmessage differs error

    - by Mark
    I am quite new to TDD and am going with NUnit and Moq. I have got a method where I expect an exception, so I wanted to play a little with the frameworks features. My test code looks as follows: [Test] [ExpectedException(ExpectedException = typeof(MockException), ExpectedMessage = "Actual differs from expected")] public void Write_MessageLogWithCategoryInfoFail() { string message = "Info Test Message"; Write_MessageLogWithCategory(message, "Info"); _LogTest.Verify(writeMessage => writeMessage.Info("This should fail"), "Actual differs from expected" ); } But I always receive the errormessage that the error message that the actual exception message differs from the expected message. What am I doing wrong?

    Read the article

  • JUnit : Is there a way to skip a test belonging to a Test class's parent?

    - by Jon
    I have two classes: public abstract class AbstractFoobar { ... } and public class ConcreteFoobar extends AbstractFoobar { ... } I have corresponding test classes for these two classes: public class AbstractFoobarTest { ... } and public class ConcreteFoobarTest extends AbstractFoobarTest { ... } When I run ConcreteFoobarTest (in JUnit), the annotated @Test methods in AbstractFoobarTest get run along with those declared directly on ConcreteFoobarTest because they are inherited. Is there anyway to skip them?

    Read the article

  • how to interpret testng console log message for passing tests?

    - by Kunal Cholera
    I ran testng tests for my test classes, I get the following three types of log output when I run the passing tests. I am using org.testng.AssertJUnit.assertTrue() methods in my tests. [testng] PASSED: testMethod1 on null(test.foo.bar.Class1) [testng] PASSED: testMethod2 on Default test name(test.foo.bar.jar.Class2) [testng] PASSED: testMethod3 Can any one please tell me why for some tests it says "on null" for some it says "on Default test name ... " and for some it does not say anything on the console output. Specifically I want to make it consistent message. Environment : linux Testng framework : 6.3.2beta please advise. thanks.

    Read the article

  • Is it a bad idea to create tests that rely on each other within a test fixture?

    - by nbolton
    For example: // NUnit-like pseudo code (within a TestFixture) Ctor() { m_globalVar = getFoo(); } [Test] Create() { a(m_globalVar) } [Test] Delete() { // depends on Create being run b(m_globalVar) } … or… // NUnit-like pseudo code (within a TestFixture) [Test] CreateAndDelete() { Foo foo = getFoo(); a(foo); // depends on Create being run b(foo); } … I’m going with the later, and assuming that the answer to my question is: No, at least not with NUnit, because according to the NUnit manual: The constructor should not have any side effects, since NUnit may construct the class multiple times in the course of a session. ... also, can I assume it's bad practice in general? Since tests can usually be run separately. So the result of Create may never be cleaned up by Delete.

    Read the article

  • How to deal with the test data in Junit?

    - by user351637
    In TDD(Test Driven Development) development process, how to deal with the test data? Assumption that a scenario, parse a log file to get the needed column. For a strong test, How do I prepare the test data? And is it properly for me locate such files to the test class files?

    Read the article

  • VC++ and VisualAssert

    - by C_Bevan
    Hi, For some reason I can't get my test's to load in my project. In the test explorer it says "This process exited without registering with the agent - this may be due to the module not containing any test fixtures" ....I've tried Right Click-Add TestFixture, and adding them other various ways I can get it to work on a blank project Any idea which settings I might need to change

    Read the article

  • [C++] Boost test: catch user defined exceptions

    - by user231536
    If I have user defined exceptions in my code, I can't get Boost test to consider them as failures. For example, BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(MyTest,1) BOOST_AUTO_TEST_CASE(MyTest) { // code which throws user defined exception, not derived from std::exception. } I get a generic message: Caught exception: .... unknown location(0):.... It does not recognize this error as a failure since it is not a std::exception. So it does not honor the expected_failures clause. How do I enforce that the piece of code should always throw an exception? THis seems to be a useful thing to want. In case future code changes cause the code to pass and the exception is not thrown, I want to know that.

    Read the article

  • How do I get the name of the test method that was run in a testng tear down method?

    - by Zachary Spencer
    Basically I have a tear down method that I want to log to the console which test was just run. How would I go about getting that string? I can get the class name, but I want the actual method that was just executed. Class testSomething() { @AfterMethod public void tearDown() { system.out.println('The test that just ran was....' + getTestThatJustRanMethodName()'); } @Test public void testCase() { assertTrue(1==1); } } should output to the screen: "The test that just ran was.... testCase" However I don't know the magic that getTestThatJustRanMethodName should actually be.

    Read the article

  • how many lines of code does my class library have

    - by zachary
    for metrics reasons I need to know how many lines of code my class library has. I'm doing this for code coverage.... So if Class library 1 has 50 lines of code and 100% coverage And if Class library 2 has 500 lines of code and 0% coverage My total coverage is 90% Any idea how to do this? Is there a utility or a way to use Visual Studio?

    Read the article

  • Are there any test data generator tools which can be used with selenium/Nunit?

    - by Jon
    Hi, I was wondering if there was anything that provides test data for injecting into Nunit tests? I'm sure I came across something recently that does this but I couldn't find it again. Basically the idea is that I could use selenium and Nunit to create new customers within the system automatically. So I could have selenium type in customer names generated from test generator (the < DataGenerator is just an imaginary class): e.g. dim sFirstName as string = < DataGenerator >.GetRandomFirstName() dim sLastName as string = < DataGenerator >.GetRandomLastName() selenium.type("firstname_field",sFirstName) selenium.type("lastname_field",sLastName ) I've already seen SQLDataGenerator from Redgate which has a cmd line wrapper class, but I was wondering if there was anything else.

    Read the article

  • Simple Java AMPQ server

    - by splix
    Are there exists an simple AMPQ server/broker implementation written in Java? I need it only for local integration tests, starting it from ant/maven, and i don't need any features like a clustering, persistence, performance and so on. Just a fake RabbitMQ-like instance, without installation (just as a dependency at maven pom) and configuration.

    Read the article

  • Field name being converted in Unit Tests [rails]?

    - by yar
    I am noting this strange behavior where one of my fields -- receive_empresa_test_info -- has worked fine though it's always been referred to as receive_empresa_info. In Functional Tests, though, the real field name is receive_empresa_test_info. What is going on here? Might this be some part of the Rails environment that I'm missing during testing?

    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

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