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
Smartfox Extension Unit Testing (the beginning)
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:
How to unit test asynchronous calls to SFS server via java client?
Here are some answers I've just googled on junit asynchronous tests:
- http://joe.truemesh.com/blog/000279.html
- http://stackoverflow.com/questions/631598/how-to-use-junit-to-test-asynchronous-processes
- http://code.google.com/webtoolkit/doc/1.6/DevGuideTesting.html#DevGuideAsynchronousTesting
- 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?
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
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
SmartFoxClient.class
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...
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...
SmartFoxClient
Lapo,
The SFSTest.java class sample from the link on the first post (http://ideacandi.com/blogzero/?p=44)contains the following code:
You are saying those classes do not exist?
So "startzero" (the user that posted that link) created them from scratch?
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?
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
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
Re: Smartfox Extension Unit Testing (the beginning)
The main article link is dead.
Re: Smartfox Extension Unit Testing (the beginning)
Would it be possible to provide a working link to the code ?
Re: Smartfox Extension Unit Testing (the beginning)
This is a 6 year old post regarding SmartFoxServer 1.x. Is it possible you're referring to SFS2X?
Return to “Server Side Extension Development”
Who is online
Users browsing this forum: No registered users and 41 guests