Unit Testing - Mock Out A Service Using Local Data In Flex 3?
Jul 9, 2009
I am writing a small flex application that will, eventually, call PHP services to perform its work. In the meantime, however, I would like to have it use local data in XML form to allow me to develop the Flex part independently of the data service.
What is the best way to do this? I want to emulate a service like this:
[Code]...
And invoke the service using issuerService.send(), populating my results as expected. How do I do this as though it were a RemoteObject instead, but keep my data local?
What methods do you use to unit test event handlers, particularly if they require information from the event (such as mouse coordinates, or the target of the event)? Is the most common practice to just refactor the behavior into a method that does the lifting while the handler just extracts information from the event, or are there effective ways to simulate event dispatch in FlexUnit or Fluint?
I have a flex application written using PureMVC framework.Now,I want to write tests.We are using FlashBuilder 4.Is FlexUnit sufficient for testing? Are there any issues you have faced while writing tests?
I have a flex application build with actionscript 3 on flex builder with unit testing on it using flexUnit4. I want to build this project on my cruise control and i don't know how?
I've been trying to setup a working method for unit testing flex libraries using Flex Builder. i have tried setting up a standard flex lib project and using Ant to compile and run the units tests. But this means that when something does go wrong and I want to use the flex builder debugger I cannot do so.
So my next plan is to setup the library as a normal as3/flax/air app as I can use the concept of a main class to run the unit tests. I can then compile the actual library code using Ant.
I could also setup a separate companion project who's sole task is to run units tests on the lib. But this is a little awkward as each library now requires two projects to manage. How do other people develop flex libraries and use unit tests to test/develop/debug the code?
I want to profile and unit test my application in Flash Builder 4 Standard. Adobe says I need to upgrade to the Premium version but I can't pay the money they want right now.Are there any alternatives for unit testing and profiling?
I'm writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I'd prefer not to generate the data in code like this:
var mockData = new Array(); mockData.push(new Foo(1, "abc", "xyz")); mockData.push(new Foo(2, "def", "xyz")); ...
Rather I'd like to store the data in a file in some format that it can be easily serialized into my strongly-typed value objects (i.e. Foo above). Ideally I'd like to create the data in a self-describing format(i.e. what data type each field is, what class it represents, etc)
I would like to use different service definitions in a Flex app depending on whether I'm running on:
My local developer machine The test tier The QA tier The production tier
My services are all AMFPHP remote objects, living on different hosts and at different locations depending on which tier I'm on. How can I have my flex app choose the 'correct' tier at runtime to connect to?
I'm looking for a reliable mocking framework for ActionScript. I've been using mock-as3, but I'm annoyed with what I feel is a hack-ish solution for triggering events. There are other a few other reasons why I'd like to have some options, but not sure if I necessarily need to go into them. I've also looked into Mock4AS, but the interface appears to be cumbersome.
I am developing an AS3 application which uses a Singleton class to store Metrics in Arrays. It's a Singleton because I only ever want one instance of this class to be created and it needs to be created from any part of the app. The difficulty comes when I want to unit test this class. I thought adding public getters and setters would enable me to unit test this properly and would be useful for my app. I have read that changing to a Factory pattern will enable unit testing or using Inversion of control. This would of course make it more flexible too. I would like to know of people's thoughts on this matter as there are SO many conflicting opinions on this!
I am bussy with a Flex Project with a data services. Flash builder installed Zend Framework with Zend_Amf.
When i run the project i get the error NetConnection.Call.Failed: HTTP: Failed. With chalers i say that Zend_Amf give the error: AMF data is incomplete (0 bytes of 0 bytes). Please check the recording limits in the Recording Settings.
I don't know what the problem means. I have searched on google, but i haven't found a good result. The Flex project code is:
I have been working on a flex application with java, as i have used Life Cycle Data Service for communication, i wana know, is there any function of flex, where i can see the loading status in percentage, that how much record is being loaded.Problem is, if there is lengthy record, no body comes to know, whats happening with software, like in Comboboxes or Grids, users usually think it as a BUG in application, but ofcourse it is not.I need such graphical loader, which keeps on loading with proper status in percentage, until it receives all data from JAVA (SQL Server).
I'm using the data/services in Flash Builder 4 to access the php functions of a site within an Air based Crud, and figuring out the most efficient ways to work with the data objects that come back.
[Code]...
The data comes back as an associative array, which is fine if I want everything from it to be treated the same. But I'm not sure how I am supposed to pull a particular column from the array without having to go through a for loop to parse through it.. since right now the contact name would be at allContacts[i].name.
Basically I want to make a list of the names from the allContacts, so I want an array of allContacts[i].name to set as the data provider for a element. Is there any way to get that done without having to write a for loop to convert it into a new array or writing a new php function?
i am trying to add a web service in flex 4. This web service is deployed in share point 2010 in the intranet . I am able to see this wsdl file through browser but trying to introspect the service is giving an authentication error. I am getting the following error :-
There was an error during service introspection.
WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://sql2008:47672/_vti_bin/StoryboardingDatabaseConnect.asmx?WSDL'.: java.io.IOException: Authentication failure
I am writing an application in Flash Builder 4.5. I am also writing a PHP Web service to access data from our MySQL database. This Web service will be made available to third party clients for them to develop applications to access our database as well, via SOAP.
Is there a big performance difference between connecting to the service in Flash Builder via connecting directly to the PHP file vs. connecting to a Web Service via SOAP?I would kind of like to connect to this service the same way that our clients will, to make sure things stay as uncomplicated as possible for future development, but performance is my main priority.
I have generated a service call to a service called ServiceName.getService() - I can successfully pull data displayed inside mxml layout elements, but, instead of displaying it, I just want to assign it to a global.
I always get an error on the second line below - apparently the value has not been fetched yet. I have also tried adding a listener, and setting the global value on COMPLETE, but that is apparently never called. (I am guessing this generated service call stuff does not actually trigger a COMPLETE?)
Short question is: how do you simply assign a variable after you have loaded it via a service data call. (Not just HTTP)
My question is about XML loading. I need to avoid xml caching. On a web server, the technique is adding a random param to reload each time the XML file. But on local testing (in Flash CS4 IDE, CTRL + Enter), the following lines are not possible :
var my_date : Date; path = "toto.xml?time="+my_date.getSeconds()+my_date.getMilliseconds();
Is there any trick to bypass this issue ? I've read on different forum about the "delete" method, we delete the xml object and then recreate one new.
My AS3 makes a call to a php script and it works beautifully during testing. However, once I upload it to the web, it no longer works.
I am using absolute URL's, since my game exists in various places, such as facebook and my website. Here' s the code:
ActionScript Code: public function checkMovements():void { var urlLoader:URLLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, checkMovements_Complete);
I am working on a flash application on my local machine. It involves reading and writing to an xml file. I am facing a lot of security problems because of flash sandbox. In order to get around this I have installed php+apache to call an external file that writes to a file. I have created the crossdomain.xml and put it in the root of the web server on my local machine.
However, I can ONLY run the flash file in the flash program AND IT DOES WRITE TO A FILE. If I publish it as a html I still get the security error msg. Now another requirement of my program is as the user interacts with my flash application it changes an xml and the page should refresh to show the changes. But because I can't run my flash program as a html file I can't refresh the damn page! I'm half thinking of setting up a vm machine as a pretend server to get this damn thing working. Then I at least have the server + client model.
I found at this Adobe tutorial a nice "RemoteService" class that creates a RemoteObject and contains the functions for handling the result and fault events. If I wanted to use this approach, how could I pass the data from the result handler to interfaces that modules from the main application could use?
I could put the RemoteService/RemoteObject in the modules, but (in my opinion- and I could be wrong) the best design seems to be using the remote calls in the main app and passing the data along to the modules.
i am trying to put data in to combo box from php page using http service .there are 2 data records in the php page but instead of displaying data it displays [object object] [object object] in the combo box list
here is the mxml code
@namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx";
I am working on a flash application on my local machine. It involves reading and writing to an xml file. I am facing a lot of security problems because of flash sandbox.In order to get around this I have installed php+apache to call an external file that writes to a file. I have created the crossdomain.xml and put it in the root of the web server on my local machine.However, I can only run the flash file in the flash program. Even if I publish it as a html I still get the security error msg.Now another requirement of my program is as the user interacts with my flash application it changes an xml and the page should refresh to show the changes.But because I can't run my flash program as a html file I can't refresh the damn page!I'm half thinking of setting up a vm machine as a pretend server to get this damn thing working. Then I at least have the server + client model.
I am experiencing a strange problem when I want to bind a service to a button or something else:
[Code]...
I can add the services to the Data Services panel but I have two strange things:
1) when I want to configure the return type he doesn't let me create a new ValueObject type, I only get the bottom datagrid which states: Properties returned by the operation: Property: country_Id, provence_Id, city_Id, id_cdpc, district_Id with the related values on the right side. Why can't I create a new data type on the top?
2) When I accept this and want to add the service call to a button (drag&drop) I get the following error: Error occurred while generating code. Make sure that there are no compiler eroors and try again after reopening the file. Componentn type services.cdpc.CDPC not found... (ps: When I perform a Test Operation everything seems to be ok, I get the expected output values)
I'm working on a general code library for ActionScript 3.0 called as3lib which includes several extensions to the core API and some useful functions. I've written several unit tests (using FlexUnit) to make sure everything is working correctly.
What is the best way to organize these tests in the library? Currently, I have all my code in src/ and my tests in test/ but I've set up a secondary Flex project to run the unit tests. I am also manually adding and removing the test files from the library when I want to run the tests.
Preferably one where the compiled library doesn't include the test files but I don't need two separate projects to test them.