}
是用來傳遞參數的一個類。參數是主程序從文件中讀出來并存入這個類的一個對象里,然后通過初始化TestThread傳遞給它的對象。
public class TestServer {
static int loopTimes = 500;
public Parameter readFromArgFile(String str){
FileInputStream fileInput;
BufferedReader br;
Parameter param = new Parameter();
try {
fileInput = new FileInputStream(new File(str));
br = new BufferedReader(
new InputStreamReader( fileInput ));
String line;
while( (line = br.readLine()) != null ) {
if( line.startsWith("URL") == true && line.indexOf("=") >= 3) {
int f = line.indexOf("=");
String urlstring = line.substring(f+1);
urlstring.trim();
param.url = new URL(urlstring);
}
else if( line.startsWith("METHOD") == true && line.indexOf("=") >= 3) {
int f = line.indexOf("=");
String method = line.substring(f+1);
method.trim();
延伸閱讀
文章來源于領測軟件測試網 http://www.kjueaiud.com/