Search Results

Search found 65503 results on 2621 pages for 'real application testing'.

Page 37/2621 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Testing the program in different OS

    - by Alex Farber
    I want to test my program by installing it in different OS versions. My development computer is Ubuntu. What other Linux versions can I test by installing them inside VirtualBox and running my program there? Though it is not critical for me right now, I want to try something different and see what happens. Also, what is the chance that the program running in Linux will work in the Unix OS? The program is not open source, I can distribute only pre-built binaries.

    Read the article

  • Grails Unit testing a function with session object

    - by Suganthan
    I having a Controller like def testFunction(testCommand cmdObj) { if (cmdObj.hasErrors()) { render(view: "testView", model: [cmdObj:cmdObj]) return } else { try { testService.testFunction(cmdObj.var1, cmdObj.var2, session.user.username as String) flash.message = message(code: 'message') redirect url: createLink(mapping: 'namedUrl') } catch (GeneralException error) { render(view: "testView", model: [cmdObj:cmdObj]) return } } } For the above controller function I having a Unit test function like: def "test function" () { controller.session.user.username = "testUser" def testCommandOj = new testCommand( var1:var1, var2:var2, var3:var3, var4:var4 ) testService service = Mock(testService) controller.testService = service service.testFunction(var2,var3,var4) when: controller.testFunction(testCommandOj) then: view == "testView" assertTrue model.cmdObj.hasErrors() where: var1 | var2 | var3 | var4 "testuser" | "word@3" | "word@4" | "word@4" } When running this test function I getting the error like Cannot set property 'username' on null object, means I couldn't able to set up the session object. Can someone help to fix this. Thanks in advance

    Read the article

  • RSpec: Expectation on model's not working while testing controller

    - by gmile
    I'm trying to write a functional test. My test looks as following: describe PostsController do it "should create a Post" do Post.should_receive(:new).once post :create, { :post => { :caption => "ThePost", :category => "MyCategory" } } end end My PostsController (a part of it actually) looks as following: PostController < ActiveRecord::Base def create @post = Post.new(params[:post]) end end Running the test I'm always receiving a failure, which says that the Post class expected :new but never got it. Still, the actual post is created. I'm a newbie to RSpec. Am I missing something?

    Read the article

  • Need help with writing test

    - by London
    I'm trying to write a test for this class its called Receiver : public void get(People person) { if(null != person) { LOG.info("Person with ID " + person.getId() + " received"); processor.process(person); }else{ LOG.info("Person not received abort!"); } } Here is the test : @Test public void testReceivePerson(){ context.checking(new Expectations() {{ receiver.get(person); atLeast(1).of(person).getId(); will(returnValue(String.class)); }}); } Note: receiver is the instance of Receiver class(real not mock), processor is the instance of Processor class(real not mock) which processes the person(mock object of People class). GetId is a String not int method that is not mistake. Test fails : unexpected invocation of person.getId() I'm using jMock any help would be appreciated. As I understood when I call this get method to execute it properly I need to mock person.getId() , and I've been sniping around in circles for a while now any help would be appreciated.

    Read the article

  • Unit Testing and SharePoint Development

    - by MagicAndi
    Hi, I am interested in writing unit tests for the SharePoint development work I am doing. Can anyone suggest practical approachs to implementing unit tests in MOSS? Note that any third party tools have to be free (but not necessarily open-source); the company I work for will not pay for additional tooling. In particular, any alternatives to the Typemock Isolator for SharePoint would be appreciated. Thanks, MagicAndi.

    Read the article

  • Dummy SMTP Server for testing apps that send email

    - by Patrick McElhaney
    I have a lot of apps that send email. Sometimes it's one or two messages at a time. Sometimes it's thousands of messages. In development, I usually test by substituting my own address for any recipient addresses. I'm sure that's what everybody else does, until they get fed up with it and find a better solution. I was thinking about creating a dummy SMTP server that just catches the messages and dumps them in a SQLLite database, or an mbox file, or whatever. But surely such a tool already exists? How do you test sending email?

    Read the article

  • IronPython For Unit Testing over C#

    - by Krish
    We know that Python provides a lot of productivity over any compiled languages. We have programming in C# & need to write the unit test cases in C# itself. If we see the amount of code we write for unit test is approximately ten times more than the original code. Is it ideal choice to write unit test cases in IronPython instead of C#? Any body has done like that? I wrote few test cases, they seems to be good. But hairy pointy managers won't accept.

    Read the article

  • Unit testing installation of services

    - by skiphoppy
    Our installer program is going to be installing a number of system services, under both Windows and UNIX, using JavaServiceWrapper. There will be a class responsible for creating JavaServiceWrapper config files, installing the services, etc. Can I have some suggestions on how to unit-test this class?

    Read the article

  • Unit testing MVC.net Redirection

    - by Dan
    How do I Unit Test a MVC redirection? public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } Is Ayende's approach still the best way to go, with preview 5: public static void RenderView(this Controller self, string action) { typeof(Controller).GetMethod("RenderView").Invoke(self,new object[] { action} ); } Seems odd to have to do this, especially as the MVC team have said they are writing the framework to be testable.

    Read the article

  • unit-testing maven plugins

    - by Don
    Hi, I'm looking for information about how to write unit tests for Maven plugins. Although there's a page on the Maven site about this topic, there's only one example unit test, which does nothing useful. I also found this wiki page, but it hasn't been updated for more than 4 years, so I'm reluctant to invest any faith in it. I checked the book "The Definitive Guide to Maven", but it doesn't even mention the subject. I'd like to write my unit tests in either Groovy or Java, and would appreciate any information about how to do this. Thanks, Don

    Read the article

  • Unit testing ASP.NET Code behind.

    - by user102533
    I've been reading about MVC in which the authors suggest that testability is one of the major strengths of MVC. They go to compare it with ASP.NET WebForms and how difficult it is to test the code behind in WebForms. I do understand it's difficult but can someone explain how unit tests were written to test code behind logic in the old days?

    Read the article

  • Testing a method used from an abstract class

    - by Bas
    I have to Unit Test a method (runMethod()) that uses a method from an inhereted abstract class to create a boolean. The method in the abstract class uses XmlDocuments and nodes to retrieve information. The code looks somewhat like this (and this is extremely simplified, but it states my problem) namespace AbstractTestExample { public abstract class AbstractExample { public string propertyValues; protected XmlNode propertyValuesXML; protected string getProperty(string propertyName) { XmlDocument doc = new XmlDocument(); doc.Load(new System.IO.StringReader(propertyValues)); propertyValuesXML= doc.FirstChild; XmlNode node = propertyValuesXML.SelectSingleNode(String.Format("property[name='{0}']/value", propertyName)); return node.InnerText; } } public class AbstractInheret : AbstractExample { public void runMethod() { bool addIfContains = (getProperty("AddIfContains") == null || getProperty("AddIfContains") == "True"); //Do something with boolean } } } So, the code wants to get a property from a created XmlDocument and uses it to form the result to a boolean. Now my question is, what is the best solution to make sure I have control over the booleans result behaviour. I'm using Moq for possible mocking. I know this code example is probably a bit fuzzy, but it's the best I could show. Hope you guys can help.

    Read the article

  • Is there value in unit testing auto implemented properties

    - by ahsteele
    It seems exceptionally heavy handed but going by the rule anything publicly available should be tested should auto-implemented properties be tested? Customer Class public class Customer { public string EmailAddr { get; set; } } Tested by [TestClass] public class CustomerTests : TestClassBase { [TestMethod] public void CanSetCustomerEmailAddress() { //Arrange Customer customer = new Customer(); //Act customer.EmailAddr = "[email protected]"; //Assert Assert.AreEqual("[email protected]", customer.EmailAddr); } }

    Read the article

  • Unit testing, mocking - simple case: Service - Repository

    - by rafek
    Consider a following chunk of service: public class ProductService : IProductService { private IProductRepository _productRepository; // Some initlization stuff public Product GetProduct(int id) { try { return _productRepository.GetProduct(id); } catch (Exception e) { // log, wrap then throw } } } Let's consider a simple unit test: [Test] public void GetProduct_return_the_same_product_as_getProduct_on_productRepository() { var product = EntityGenerator.Product(); _productRepositoryMock.Setup(pr => pr.GetProduct(product.Id)).Returns(product); Product returnedProduct = _productService.GetProduct(product.Id); Assert.AreEqual(product, returnedProduct); _productRepositoryMock.VerifyAll(); } At first it seems that this test is ok. But let's change our service method a little bit: public Product GetProduct(int id) { try { var product = _productRepository.GetProduct(id); product.Owner = "totallyDifferentOwner"; return product; } catch (Exception e) { // log, wrap then throw } } How to rewrite a given test that it'd pass with the first service method and fail with a second one? How do you handle this kind of simple scenarios? HINT: A given test is bad coz product and returnedProduct is actually the same reference.

    Read the article

  • Unit testing a Grails custom taglib based on built-in Grails taglib

    - by dipess
    I've an app based on Grails 1.3.7. And I need to write a unit test for a custom taglib that is based on the built-in taglib, <g:select /> to be specific. I checked out the solution on this previous SO post but the solution stated is not working in my case (some properties are not being prooperly mocked up). The other solution that I found was this. Using this approach, I get most of the properties of FormTagLib mocked up except for the grailsApplication property that select requires. The actual error that I get is Cannot invoke method getArtefact() on null object. How can I properly write the unit test in such a case? Edit Here are my test class and the full stacktrace. Line #45 on the stacktrace is the call to the g.select from my custom taglib. My custom taglib is something like def clientSpecificQueues = {attrs-> def queueList = taskService.getClientSpecificQueues(session.clientName) def queueLabel = "Some String" if (queueList.size() > 0){ out << queueLabel else out << g.select(name:'queueId', from: queueList, optionKey: 'id', optionValue: 'name') }

    Read the article

  • Testing if a UI element is hidden in an OCUnit test

    - by Logan Serman
    I have a button that is hidden under certain circumstances that I wish to test. The button is hidden with [theButton setHidden: YES] in the viewDidLoad method if it is appropriate. For simplicity, lets say that the button is hidden when the buttonIsHidden property is set to true in the view controller. Right now I am trying the following: self.viewController = [[ViewController alloc] init]; self.viewController.buttonIsHidden = YES; [self.viewController loadView]; UIButton *theButton = [...] // function I wrote to retrieve the button based on it's touch up inside action if (theButton) { NSLog(@"%c", theButton.hidden); return (theButton.hidden == true) } return NO; It looks like the hidden property is not what it should be, the NSLog lines from the above code are blank. But, if I output another property like the height, it outputs the correct value so I know it is getting the right button. How do I access the hidden property of the button in this case?

    Read the article

  • Unit testing code which uses Umbraco v4 API

    - by Jason Evans
    I'm trying to write a suite of integration tests, where I have custom code which uses the Umbraco API. The Umbraco database lives in a SQL Server CE 4.0 database (*.sdf file) and I've managed to get that association working fine. My problem looks to be dependancies in the Umbraco code. For example, I would like to create a new user for my tests, so I try: var user = User.MakeNew("developer", "developer", "mypassword", "[email protected]", adminUserType); Now as you can see, I have pass a user type which is an object. I've tried two separate ways to create the user type, both of which fail due to a null object exception: var adminUserType = UserType.GetUserType(1); var adminUserType2 = new UserType(1); The problem is that in each case the UserType code calls it's Cache method which uses the HttpRuntime class, which naturally is null. My question is this: Can someone suggest a way of writing integration tests against Umbraco code? Will I have to end up using a mocking framework such as TypeMock or JustMock?

    Read the article

  • Ruby on Rails: Unit Testing non activerecord models and still load fixtures

    - by Vaibhav Gumashta
    I may be missing something but I am stuck in this scenario: I have a non activerecord model, which I want to test. I have derived its test case class from: Test::Unit::TestCase. However, the test case class for the model, uses within itself, other activerecord model classes and I want to load fixtures for them. My problem is that the fixtures class method is available only when I subclass the test case class from ActiveSupport::TestCase (it is defined within ActiveRecord::TestFixtures which gets included in ActiveSupport::TestCase). Any help, coz running the tests gives me the error: undefined method "fixtures" (which is understandable) and in case I derive my test case class from ActiveSupport::TestCase it complains that there is no corresponding DB table. Also, I don't want to create a dummy table for backing my model class. Thanks a ton!

    Read the article

  • Testing methods called on yielded object

    - by Todd R
    I have the following controller test case: def test_showplain Cleaner.expect(:parse).with(@somecontent) Cleaner.any_instance.stubs(:plainversion).returns(@returnvalue) post :showplain, {:content => @somecontent} end This works fine, except that I want the "stubs(:plainversion)" to be an "expects(:plainversion)". Here's the controller code: def showplain Cleaner.parse(params[:content]) do | cleaner | @output = cleaner.plainversion end end And the Cleaner is simply: class Cleaner ### other code and methods ### def self.parse(@content) cleaner = Cleaner.new(@content) yield cleaner cleaner.close end def plainversion ### operate on @content and return ### end end Again, I can't figure out how to reliably test the "cleaner" that is made available from the "parse" method. Any suggestions?

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >