How do you do remote service tests in IJ

How do you do async tests in IJ if you can't specify the tests to run in the browser with the http address?

This works fine in FB4 where the test runs fine in the browser with the specific url, in IJ it just uses the path to the file ie e:/app/test

package services
{
    import flexunit.framework.Assert;
    
    import mx.rpc.AsyncResponder;
    import mx.rpc.AsyncToken;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    
    import org.flexunit.async.Async;
    
    import services.AuthenticationService;
    
    public class AuthenticationServiceTest
    {        
        
        private var objectToTest:AuthenticationService
        
        [Before]
        public function setUp():void
        {
            objectToTest = new AuthenticationService;
        }
        
        [After]
        public function tearDown():void
        {
            
        }
        
        [BeforeClass]
        public static function setUpBeforeClass():void
        {
            
        }
        
        [AfterClass]
        public static function tearDownAfterClass():void
        {
        }
        
        [Test(async)]
        public function testAttemptLogin():void
        {
            var token: AsyncToken = objectToTest.attemptLogin('k','sd');
            token.addResponder(Async.asyncResponder(this, new AsyncResponder(onResult, faultHandler), 1300));
        }
        
    
        private function onResult(event:ResultEvent,pass:Object):void {
            
            Assert.assertEquals('Sucessful login',event.result.length ,1);
            
        }
        
        
        private function faultHandler(event:FaultEvent,pass:Object):void
        {
            
            Assert.fail("service Fail");
        }
    
    }
}

0
6 comments
Avatar
Permanently deleted user

for example when running locally

faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Security.Error error Error #2048: Security sandbox violation: file:///X:/Inetpub/wwwroot/FLEX/G/_flexunit.swf cannot load data from http://localhost/flex2gateway/. url: 'http://localhost/flex2gateway/''

If I ran normally from the server URL it would work but I can't specify this in the run dialogue for unit tests.

0
Avatar
Permanently deleted user

Hello Nikos,

Have you tried to check 'Place SWF file in local-trusted sandbox' option at your run configuration dialog?

Regards,
Kirill

0
Avatar
Permanently deleted user

Yes but that won't help

my tests are using Coldfusion remote objects and only work when running under the correct url, as the .cfc's are hosted on another server

0
Avatar
Permanently deleted user

There must be some people that have used remote objects in tests in IJ no?


0
Avatar
Permanently deleted user

Hello Nikos,

Currently IDEA generates local test SWF and executes it. Please file a feature request in our bugtracker. Any additional details (or even a sample project) are very welcome to get better understanding of your particular workflow.

Thanks,
Kirill

0
Avatar
Permanently deleted user

I actually don't bother with the test dialogue,green folders anymore, I find it easier to create my own custom runner and running the tests just like the normal applications.

0

Please sign in to leave a comment.