验证脚本是正常的,但是在ngrinder启动后测试后,agent都没有执行test,无TPS数据
脚本验证: 2017-04-13 18:12:06,813 INFO The Grinder version 3.9.1 2017-04-13 18:12:06,819 INFO OpenJDK Runtime Environment 1.7.0_131-mockbuild_2017_02_13_15_19-b00: OpenJDK 64-Bit Server VM (24.131-b00, mixed mode) on Linux amd64 3.10.104-1.el6.elrepo.x86_64 2017-04-13 18:12:06,824 INFO time zone is CST (+0800) 2017-04-13 18:12:06,935 INFO worker process 0 of agent number 0 2017-04-13 18:12:06,966 INFO Instrumentation agents: byte code transforming instrumenter for Java; byte code transforming instrumenter for Java 2017-04-13 18:12:08,061 INFO Running "Webapi.groovy" using GroovyScriptEngine running with groovy version: 2.2.1 2017-04-13 18:12:08,107 INFO starting, will do 1 run 2017-04-13 18:12:08,107 INFO Start time is 1492078328107 ms since Epoch 2017-04-13 18:12:09,660 INFO finished 1 run 2017-04-13 18:12:09,663 INFO elapsed time is 1556 ms 2017-04-13 18:12:09,663 INFO Final statistics for this process: 2017-04-13 18:12:09,677 INFO Tests Errors Mean Test Test Time TPS Time (ms) Standard Deviation (ms) Test 1 1 0 5.00 0.00 0.64 "10.68.100.61" Totals 1 0 5.00 0.00 0.64 Tests resulting in error only contribute to the Errors column. Statistics for individual tests can be found in the data file, including (possibly incomplete) statistics for erroneous tests. Composite tests are marked with () and not included in the totals. 2017-04-13 18:12:08,068 INFO validation-0: Starting threads 2017-04-13 18:12:08 -[INFO] 测试工作表 Input 成功初始化 2017-04-13 18:12:08 -[INFO] 非本次测试数据集,第 0 行测试数据将跳过 2017-04-13 18:12:08 -[INFO] 正确匹配,第 1 行测试数据压入数据集 2017-04-13 18:12:08 -[INFO] 所有测试用例初始化完成 2017-04-13 18:12:08 -[INFO] HTTP请求报文组装完成 2017-04-13 18:12:09 -[INFO] 接口请求成功 2017-04-13 18:12:09,677 INFO validation-0: Finished my groovy脚本: import static net.grinder.script.Grinder.grinder import java.util.Iterator import java.util.Map import org.gradle.needle.client.HttpClientFactory import org.gradle.needle.engine.HttpReqGen import org.gradle.needle.util.ExcelDataUtils import org.junit.Before import org.junit.BeforeClass import org.junit.Test import org.junit.runner.RunWith import static org.junit.Assert.assertThat; import static org.hamcrest.Matcher.* import net.grinder.script.GTest import net.grinder.script.Grinder import net.grinder.scriptengine.groovy.junit.GrinderRunner import net.grinder.scriptengine.groovy.junit.annotation.BeforeProcess import net.grinder.scriptengine.groovy.junit.annotation.BeforeThread @RunWith(GrinderRunner) class Webapi { public static GTest test private String testset = "main" private String testid = "t001" private String filePath = "./resources/webapi.xls" //private String filePath = System.getProperty("user.dir") + "/src/scada_v5/resources/webapi.xls"; public ExcelDataUtils edu public Iterator<Map<String, String>> datamap public Iterator<Object[]> requestfiles @BeforeProcess public static void beforeProcess() { test = new GTest(1, "10.68.100.61") test.record(this, "test"); } @BeforeThread public void beforeThread() { grinder.statistics.delayReports=true; } @Before public void before() { edu = new ExcelDataUtils(filePath); edu.setWorkSheet("Input"); datamap = edu.getCaseSet(testset); requestfiles = HttpReqGen.preReqGen(datamap); } @Test public void test() { while (requestfiles.hasNext()) { Object[] rf = requestfiles.next() if (rf[0].equals(testid)) { String response = HttpClientFactory.invokeServiceMethod(rf[1],rf[2],rf[3],rf[4]) //println response //assertThat(HttpClientFactory.getStatusCode(), is(200)) } } } } agent log: 2017-04-13T10:18:01.481526633Z 2017-04-13 10:18:01,480 INFO agent controller: Received a start agent message 2017-04-13T10:18:01.481550637Z 2017-04-13 10:18:01,481 INFO agent controller: Starting agent... for test_40 2017-04-13T10:18:01.481959818Z 2017-04-13 10:18:01,481 INFO agent daemon: Agent daemon connecting to port 12005 is started. 2017-04-13T10:18:01.481977395Z 2017-04-13 10:18:01,481 INFO agent controller: Agent is started. Waiting for agent controller signal 2017-04-13T10:18:01.482768045Z 2017-04-13 10:18:01,482 INFO agent daemon: The Grinder 3.9.1 2017-04-13T10:18:01.555505665Z 2017-04-13 10:18:01,554 INFO agent daemon: Connect to console at /10.1.39.200:12005 2017-04-13T10:18:01.555531145Z 2017-04-13 10:18:01,555 INFO agent daemon: Waiting for console signal 2017-04-13T10:18:05.503350587Z 2017-04-13 10:18:05,502 INFO agent daemon: communication shut down 2017-04-13T10:18:05.504266878Z 2017-04-13 10:18:05,503 INFO agent daemon: Test shuts down. 2017-04-13T10:18:05.504297125Z 2017-04-13 10:18:05,504 INFO agent controller: Send log for test_40 2017-04-13T10:18:31.868176760Z 2017-04-13 10:18:31,867 INFO agent controller: Received a start agent message 2017-04-13T10:18:31.868533336Z 2017-04-13 10:18:31,868 INFO agent controller: Starting agent... for test_41 2017-04-13T10:18:31.868677445Z 2017-04-13 10:18:31,868 INFO agent daemon: Agent daemon connecting to port 12006 is started. 2017-04-13T10:18:31.869262851Z 2017-04-13 10:18:31,868 INFO agent controller: Agent is started. Waiting for agent controller signal 2017-04-13T10:18:31.869744327Z 2017-04-13 10:18:31,869 INFO agent daemon: The Grinder 3.9.1 2017-04-13T10:18:31.906183179Z 2017-04-13 10:18:31,905 INFO agent daemon: Connect to console at /10.1.39.200:12006 2017-04-13T10:18:31.906205363Z 2017-04-13 10:18:31,906 INFO agent daemon: Waiting for console signal 2017-04-13T10:18:33.011593796Z 2017-04-13 10:18:33,011 INFO agent daemon: Clearing file store 2017-04-13T10:18:33.015477405Z 2017-04-13 10:18:33,015 INFO agent daemon: Updating file store: "Webapi.groovy" (1887 bytes) 2017-04-13T10:18:40.409786790Z 2017-04-13 10:18:40,409 INFO agent daemon: Updating file store: "lib/httpclient-4.3.6.jar" (592008 bytes) 2017-04-13T10:18:45.164449753Z 2017-04-13 10:18:45,164 INFO agent daemon: Updating file store: "lib/commons-logging-1.1.3.jar" (62050 bytes) 2017-04-13T10:18:49.918185975Z 2017-04-13 10:18:49,917 INFO agent daemon: Updating file store: "lib/hamcrest-core-1.3.jar" (45024 bytes) 2017-04-13T10:18:55.470774459Z 2017-04-13 10:18:55,470 INFO agent daemon: Updating file store: "lib/httpcore-4.3.3.jar" (282793 bytes) 2017-04-13T10:18:59.801776311Z 2017-04-13 10:18:59,801 INFO agent daemon: Updating file store: "lib/GreenFlower-1.0.jar" (98232 bytes) 2017-04-13T10:20:34.081205435Z 2017-04-13 10:20:34,080 INFO agent daemon: Updating file store: "lib/org.apache.poi_3.7.0.jar" (6943840 bytes) 2017-04-13T10:20:59.708364621Z 2017-04-13 10:20:59,707 INFO agent daemon: Updating file store: "lib/assertj-core-3.6.2.jar" (1129451 bytes) 2017-04-13T10:21:01.351367420Z 2017-04-13 10:21:01,350 INFO agent daemon: Updating file store: "lib/jxls-core-1.0.2.jar" (154348 bytes) 2017-04-13T10:21:04.807642055Z 2017-04-13 10:21:04,807 INFO agent daemon: Updating file store: "lib/slf4j-api-1.7.16.jar" (40509 bytes) 2017-04-13T10:21:08.375855850Z 2017-04-13 10:21:08,375 INFO agent daemon: Updating file store: "lib/org.apache.log4j_1.2.15.v201012070815.jar" (414385 bytes) 2017-04-13T10:21:13.795504838Z 2017-04-13 10:21:13,795 INFO agent daemon: Updating file store: "lib/junit-4.8.2.jar" (237344 bytes) 2017-04-13T10:21:14.510059604Z 2017-04-13 10:21:14,509 INFO agent daemon: Updating file store: "lib/hamcrest-library-1.3.jar" (53070 bytes) 2017-04-13T10:21:16.089923836Z 2017-04-13 10:21:16,089 INFO agent daemon: Updating file store: "resources/webapi.xls" (203776 bytes) |
Free forum by Nabble | Edit this page |