Skip to main content

Posts

Showing posts from May, 2012

JMeter: Creating First Load Test

What we want to do Simulate concurrent users Simulate requests Generate reports Troubleshooting
JMeter GUI Test Pan Plan is a root element where all test related settings are define. In Thread Group we can define pool of user to simulate load on the test Work Bench is for non test helpers
Common terms in JMeter User           ⇒ Thread Request     ⇒ Sampler Report       ⇒ Listeners
Setting up the load test 1. Simulate concurrent users Add thread > Thread Group Number of Threads - concurrent users =10 Ramp-Up Period - seconds until all users are active =1 (eg. if user define 10 Threads and 100 Ramp-Up Period then, it means each thread will start in 100/10=10 seconds time difference) Loop Count - how many repetitions =1 Calculating think time
                                     Ramp-up time                 = 120 seconds
                                     Number of users             =  30
                                     Then think time will be  =  ramp up time/number of users  …

Guava: Some useful IO utilities

Guava IO package provides very useful utility classes for input/ouput stream, byte stream, file handling and many more. Here are few example which show case how these utilities can make your code much cleaner, modular and more readable.Copy “InputStream” to “OutputStream InputStream is = CopyStreams.class.getResourceAsStream("test.txt"); OutputStream os = System.out; ByteStreams.copy(is, os);Changing InputStream to “byte[]” InputStream is = CopyStreams.class.getResourceAsStream("test.txt"); byte[] isBytes = ByteStreams.toByteArray(is); // Now if you want to get base64 encoded string then it will be like this String isBase64Str = new sun.misc.BASE64Encoder().encode(isBytes);Combining two files in one File input1 = new File("c:\\testio\\AWords.txt"); File input2 = new File("c:\\testio\\BWords.txt"); File output = new File("c:\\testio\\ABWords.txt"); …