Hi all,
i have been wondering about how i can do unit testing for smartfox server. I believe it would be really difficult cause it would need to deal with AS3 coding and Java server side coding as well. Does anyone know any unit testing framework or have done unit testing on Smart fox Server?? If yes then could you please give us some details?
Do we need 2 different unit testing framework for server and client side? or is there any unit testing framework which covers both?
How to do unit testing on Client and Server for SmartFox 2x?
-
BonyYousuf
- Posts: 120
- Joined: 20 Feb 2011, 12:54
-
BonyYousuf
- Posts: 120
- Joined: 20 Feb 2011, 12:54
-
ThomasLund
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
The test cases I made for the Java and C# API simply are small clients to the API and require a running server. But like all good unit tests they do not leave a state on the server.
But in general its tricky, as you are "unit testing" your client.
You *could* unit test your server extension too outside the server. Code up some mock classes for e.g. User and other objects. I know of one guy who did that.
/Thomas
But in general its tricky, as you are "unit testing" your client.
You *could* unit test your server extension too outside the server. Code up some mock classes for e.g. User and other objects. I know of one guy who did that.
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
I am currently trying to unit test my server.
Is there a way to get at the Smartfox Api for a unit test.
I need it because one of my extensions uses a timer like this.
Is there a way to get at the Smartfox Api for a unit test.
I need it because one of my extensions uses a timer like this.
Code: Select all
public void init()
{
SmartFoxServer sfs = SmartFoxServer.getInstance();
// Schedule the task to run every second, with no initial delay
taskHandle = sfs.getTaskScheduler().scheduleAtFixedRate(new TaskRunner(sfs.getAPIManager().getSFSApi()), 0, 1, TimeUnit.SECONDS);
}
I did a junit test case for SFS1.6. I'm actually coding a new one for 2X and I can give it to you when I finish it if you want.
That's only for server class testing and it's a test case class with an embedded dummy java client. I make the connection and all necessary work in the constructor. The methods of the test case check the behaviour of classes or small processes.
Thomas
That's only for server class testing and it's a test case class with an embedded dummy java client. I make the connection and all necessary work in the constructor. The methods of the test case check the behaviour of classes or small processes.
Thomas
Here is the class : http://www.tvuilleumier.ch/resources
You can extend the SFSTestCase class for your application tests and override the setUp and tearDown methods to prepare your application for a specific testing environnement. Then you can extend the newly created test case class for all your tests.
I put my application specific test case class (SFSColonyTestCase) and an example (GalaxyTest).
Regards,
Thomas
You can extend the SFSTestCase class for your application tests and override the setUp and tearDown methods to prepare your application for a specific testing environnement. Then you can extend the newly created test case class for all your tests.
I put my application specific test case class (SFSColonyTestCase) and an example (GalaxyTest).
Regards,
Thomas