I can get the proper relationship between requests, but now the timer is
not correct
This commit is contained in:
parent
c43a9494fd
commit
7a1b15147a
|
@ -330,7 +330,8 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
|
|||
return;
|
||||
}
|
||||
|
||||
String respStr = new String(response).toLowerCase();
|
||||
String responseWithProperCase = new String(response);
|
||||
String respStr = responseWithProperCase.toLowerCase();
|
||||
|
||||
String respCode = parseResponseCode(respStr);
|
||||
String contentType = parseContentType(respStr);
|
||||
|
@ -347,7 +348,7 @@ public abstract class AbstractCodeGenerator implements IScriptGenerator,
|
|||
|
||||
if (contentType.toLowerCase().compareTo("text/html") == 0) {
|
||||
doTidyCode(HttpTestCase.staticUrlDecode(header.url));
|
||||
doParseHtmlContent(respStr, header.url);
|
||||
doParseHtmlContent(responseWithProperCase, header.url);
|
||||
if (cpRspToStdout)
|
||||
doResponseForStdOut(HttpTestCase.staticUrlDecode(
|
||||
header.url).trim());
|
||||
|
|
|
@ -218,11 +218,15 @@ public class Bench4qCodeGenerator extends AbstractCodeGenerator {
|
|||
childAbsoluteUrl = element.absUrl("href");
|
||||
}
|
||||
System.out.println(childAbsoluteUrl);
|
||||
int parentBatchId = this.getScriptAdapter()
|
||||
.getParentBatchIdWithParentUrl(rootUrl);
|
||||
if (parentBatchId == -1) {
|
||||
continue;
|
||||
}
|
||||
this.getScriptAdapter()
|
||||
.getChildrenUrls()
|
||||
.add(ChildrenUrl.createChilldUrl(childAbsoluteUrl,
|
||||
this.getScriptAdapter()
|
||||
.getParentBatchIdWithParentUrl(rootUrl)));
|
||||
parentBatchId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,13 +19,17 @@ public class TestDomGenerator extends TestRecordBase {
|
|||
|
||||
@Test
|
||||
public void testDomParser() throws IOException {
|
||||
this.getCodeGenerator()
|
||||
.getScriptAdapter()
|
||||
.insertUserBehaviorsToScenario(
|
||||
createUserBehaviorModel(parentUrl));
|
||||
this.getCodeGenerator().doParseHtmlContent(
|
||||
FileUtils.readFileToString(new File(url.getPath())), parentUrl);
|
||||
assertTrue(this.getCodeGenerator().getScriptAdapter().getChildrenUrls()
|
||||
.size() == 8);
|
||||
for (ChildrenUrl childrenUrl : this.getCodeGenerator()
|
||||
.getScriptAdapter().getChildrenUrls()) {
|
||||
assertTrue(childrenUrl.getParentBatchId() == -1);
|
||||
assertTrue(childrenUrl.getParentBatchId() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,4 +51,21 @@ public class TestDomGenerator extends TestRecordBase {
|
|||
assertTrue(childrenUrl.getParentBatchId() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDomParserWithIncorrectParentUrl() throws IOException {
|
||||
this.getAdpater().insertUserBehaviorsToScenario(
|
||||
createUserBehaviorModel(parentUrl));
|
||||
this.getAdpater().insertUserBehaviorsToScenario(
|
||||
createUserBehaviorModel(independentUrl));
|
||||
this.getCodeGenerator().doParseHtmlContent(
|
||||
FileUtils.readFileToString(new File(this.url.getPath())),
|
||||
parentUrl + "error");
|
||||
assertTrue(this.getCodeGenerator().getScriptAdapter().getChildrenUrls()
|
||||
.size() == 0);
|
||||
}
|
||||
|
||||
public void testChildUrlWithNotProperCase() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public abstract class TestRecordBase {
|
|||
private Bench4qCodeGenerator codeGenerator;
|
||||
protected static String parentUrl = "http://localhost:8080/Bench4QTestCase/testcase.html";
|
||||
protected static String independentUrl = "www.baidu.com";
|
||||
protected static String childrenUrl1 = "http://localhost:8080/Bench4QTestCase/script/agenttable.js";
|
||||
|
||||
protected IScriptAdapter getAdpater() {
|
||||
return adapter;
|
||||
|
|
Loading…
Reference in New Issue