Smartfox Extension Unit Testing (the beginning)

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

starzero
Posts: 28
Joined: 19 Jun 2009, 18:41

Smartfox Extension Unit Testing (the beginning)

Postby starzero » 29 Nov 2009, 15:29

Hello everyone, this is my first attempt at something resembling a testing structure for my extension that I thought I'd share. Feel free to comment / critique.

http://ideacandi.com/blogzero/?p=44

Thanks!

Paul
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Dec 2009, 21:29

Excellent work.
I've made the post a sticky so that it doesn't get lost.
Lapo
--
gotoAndPlay()
...addicted to flash games
hadrien
Posts: 5
Joined: 17 Nov 2009, 18:01

Postby hadrien » 16 Dec 2009, 22:01

I have read your article (http://ideacandi.com/blogzero/?p=44) with lots of attention: Thank you! I (and my team) are facing the same issue:
How to unit test asynchronous calls to SFS server via java client?

Here are some answers I've just googled on junit asynchronous tests:Actually, your article makes me wonder lots of things on SFS (thank you a lot!) and, it raised some questions:
  • Why is there no any synchronous java methods in the java client (using blocking IO rather than NIO with apache mina) so that we can write unit test in a linear manner without the asynchronous issue?
  • Is there a plan to provide such unit test case framework in future?
  • If yes, when?
  • How do SFS/gotoandplay team do develop server extensions with continuous integration and team collaboration in mind?
Thank you a lot!
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Dec 2009, 15:40

Thanks for your comments and links.
As regards the Java API they where not aimed at providing a Unit Testing tool.

As you might have already noticed from some of our posts we are working on a major new release which will take a significant leap forward in all departments. On of them will certainly be Java Extension development which will see big improvements. (At the moment I am not allowed to say much more than this but it shouldn't take much before we can release more details)

Back to the topic I think unit testing of asynchronous code would be an cool feature and we are interested in providing a solution for it. It is still a bit premature at this point of our road map as we have lots of other priorities but we'll definitely put in the queue for later discussion and analysis.

hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
rockycaam
Posts: 14
Joined: 08 Jan 2009, 19:47
Contact:

SmartFoxClient.class

Postby rockycaam » 22 Mar 2010, 17:35

How do I get the classes that are imported in the unit test classes?

import it.gotoandplay.smartfoxclient.ISFSEventListener;
import it.gotoandplay.smartfoxclient.SFSEvent;
import it.gotoandplay.smartfoxclient.SmartFoxClient;
import it.gotoandplay.smartfoxclient.data.SFSObject;

The SmartFox jar I have does not contain any of those file...
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Mar 2010, 18:30

Those are client side API classes, not server side.
Lapo

--

gotoAndPlay()

...addicted to flash games
rockycaam
Posts: 14
Joined: 08 Jan 2009, 19:47
Contact:

SmartFoxClient

Postby rockycaam » 22 Mar 2010, 18:50

Lapo,

The SFSTest.java class sample from the link on the first post (http://ideacandi.com/blogzero/?p=44)contains the following code:

Code: Select all

package com.foo.test;

import it.gotoandplay.smartfoxclient.SFSEvent;
import it.gotoandplay.smartfoxclient.SmartFoxClient;
import it.gotoandplay.smartfoxclient.data.SFSObject;

import org.junit.Before;

import com.smithandtinker.smartfox.cluster.test.junit.SFSTestCase;

public class SFFTest extends SFSTestCase{   

   public SmartFoxClient sfsClient = null;
   
   public void sfsSetUp() {
      sfsClient = this.getSmartFoxClient();
   }
   
   public void testAvatarCard() {
      //your test method will depend heavily on how your class structures are implemented
      SFSObject sfsObject = new SFSObject();
      sfsObject.put("type", "clothing");
      sfsObject.put("sex", "male");
      sfsObject.put("method", "getItemsByType");
      
      sfsClient.sendXtMessage("requestHandler", "store", sfsObject);
      try {
         Thread.sleep(20000);
      } catch (InterruptedException e) {
         e.printStackTrace();
      }
      //this is for demo only ... no validation included
   }
   
   public void sfsTearDown(){
      sfsClient.logout();
      sfsClient.disconnect();      
      
   }
}


You are saying those classes do not exist?
So "startzero" (the user that posted that link) created them from scratch?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 22 Mar 2010, 23:07

Sorry, this post was started more than 6 months ago :)
You are referring to the Java API client classes.
Here you go --> http://www.smartfoxserver.com/labs/API/
Scroll down a bit until you see the Java logo :)
Lapo

--

gotoAndPlay()

...addicted to flash games
Zammy
Posts: 29
Joined: 05 Aug 2014, 16:37

Re: Smartfox Extension Unit Testing (the beginning)

Postby Zammy » 21 Aug 2014, 18:17

The main article link is dead.
alexdev
Posts: 1
Joined: 07 Mar 2016, 16:53

Re: Smartfox Extension Unit Testing (the beginning)

Postby alexdev » 09 Mar 2016, 10:52

Would it be possible to provide a working link to the code ?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox Extension Unit Testing (the beginning)

Postby Lapo » 09 Mar 2016, 12:31

This is a 6 year old post regarding SmartFoxServer 1.x. Is it possible you're referring to SFS2X?
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 18 guests