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