I have a Java server on the server. Clients connect to this server socket and exchange streams of I / O objects. Now I need to check the application for scalability. This means that I need to run the same test requests and check if the server is capable of handling requests from random clients.
Is a junit based test case the right way to check for random connections / requests. I get the feeling that the code below is testing clients sequentially.
Some links that I read and did not work for me
Creating a JUnit testuite with multiple test instances with parameters
public class ScalePostiveTestCases { SendQueue sendQueue; Socket clientSocket = null; public static void main(String[] args) throws Throwable { testSearching() ; } @SuppressWarnings("unchecked") private static void testSearching() throws ClassNotFoundException, InstantiationException, IllegalAccessException { TestSuite tests = new TestSuite(); for (int i = 0; i < 99; i++) { Class<SingleSearchTest> singleSearchTest = (Class<SingleSearchTest>) ClassLoader .getSystemClassLoader().loadClass( "SingleSearchTest"); SingleSearchTest singleSearch = singleSearchTest.newInstance(); tests.addTest(singleSearch); } TestRunner.run(tests); } public class SingleSearchTest extends TestCase { static SingleSearchTest singleSearch = null; private String device, connection, user; private ClientSession clientSession; private SendQueue sendQueue; public static SingleSearchTest main(String args[]) { singleSearch = new SingleSearchTest(); return singleSearch; } public SingleSearchTest() { super("testSingleSearch"); Random rand = new Random(); } }
source share