Thursday, June 16, 2011

how to create random dictionary words ( creating tags for test data )

This post will explain you how to create test data for " tags " ..

public static String generateRandomString(){
String word="";
try{
URL url = new URL("http://randomword.setgetgo.com/get.php");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-type", "text/html; charset="
+ "UTF-8");
BufferedReader rd = new BufferedReader(new InputStreamReader(conn
.getInputStream()));
String aaa="";
while ((aaa = rd.readLine()) != null) {
word = aaa;
}
rd.close();
}catch(Exception e){
e.printStackTrace();
}
return word;
}

No comments:

Post a Comment