Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)? 오류 문의 드립니다.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)? 오류 문의 드립니다.

bluestone
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)? 오류 문의 드립니다.

bluestone
ngrinder 버전은 3.4.1을 사용하고 있습니다.
Reply | Threaded
Open this post in threaded view
|

Re: Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)? 오류 문의 드립니다.

bluestone
In reply to this post by bluestone
제 스크립트가

import static net.grinder.script.Grinder.grinder
import static org.junit.Assert.*
import static org.hamcrest.Matchers.*
import net.grinder.plugin.http.HTTPRequest
import net.grinder.plugin.http.HTTPPluginControl
import net.grinder.script.GTest
import net.grinder.script.Grinder
import net.grinder.scriptengine.groovy.junit.GrinderRunner
import net.grinder.scriptengine.groovy.junit.annotation.Repeat
import net.grinder.scriptengine.groovy.junit.annotation.BeforeProcess
import net.grinder.scriptengine.groovy.junit.annotation.BeforeThread
import net.grinder.scriptengine.groovy.junit.annotation.AfterThread
// import static net.grinder.util.GrinderUtils.* // You can use this if you're using nGrinder after 3.2.3
import org.junit.Before
import org.junit.BeforeClass
import org.junit.After
import org.junit.Test
import org.junit.runner.RunWith

import java.util.Date
import java.util.List
import java.util.ArrayList
import java.lang.Thread

import HTTPClient.Cookie
import HTTPClient.CookieModule
import HTTPClient.HTTPResponse
import HTTPClient.NVPair
import com.ntwo.socketio.Client

/**
 * A simple example using the HTTP plugin that shows the retrieval of a
 * single page via HTTP.
 *
 * This script is automatically generated by ngrinder.
 *
 * @author admin
 */
@RunWith(GrinderRunner)
class TestRunner {

        public static GTest test
        public static HTTPRequest request
        public static NVPair[] headers = []
        public static NVPair[] params = []
        public static Cookie[] cookies = []
        public Client client
        public String url = "url"
        public String nickname = "name"
        public String msg = "Test"
        public int count = 0

        @BeforeProcess
        public static void beforeProcess() {
                //HTTPPluginControl.getConnectionDefaults().timeout = 6000
                test = new GTest(1, "Test1")
                //println(grinder.getProperties().getInt("grinder.threads", 1))
                //request = new HTTPRequest()
                grinder.logger.info("before process.");
        }

        @BeforeThread
        public void beforeThread() {
                test.record(this, "sendTest")
                grinder.statistics.setDelayReports(true);
                client = new Client()
                client.connect(url)
                grinder.logger.info("before thread.");
        }
       
        @Before
        public void before() {
                //test.record(this, "test")
                //request.setHeaders(headers)
                //cookies.each { CookieModule.addCookie(it, HTTPPluginControl.getThreadHTTPClientContext()) }
                grinder.logger.info("before thread. init headers and cookies");
        }

        @Test
        public void test(){
                try {
                        sendTest()
                } catch (Exception ex) {
                        grinder.statistics.forLastTest.setSuccess(false);
                } finally {
                        Thread.sleep(10)
                }
        }
       
        private void sendTest() {
                if(!client.isConnect() || !client.isSendComplete())
                        throw new Exception("isSendComplete = false")
                       
                client.sendAllMessage(nickname, msg)
        }
       
        @After
        public void after() {
               
        }
        @AfterThread
        public void afterThread() {
                client.close()
                while(true) {
                        if(!client.isConnect()) {
                                break;
                        }
                        Thread.sleep(100)
                }
               
        }
}

입니다.

sendTest에서 sendComplete가 완료되지 않았을 때 false로 넘겨 오류로 체크하려고 하는데요
Thread수가 50개 이하일때는 컨트롤러에서 에러를 발생시키지 않으나 그 이상이 넘어가면
테스트 중간이거나 마지막에

2017-10-25 18:04:12,067 ERROR Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)?
net.grinder.script.InvalidContextException: Statistics for test invocation have been reported and cannot be updated. Perhaps you should have called setDelayReports(true)?
        at net.grinder.engine.process.StatisticsForTestImplementation.getStatisticsChecked(StatisticsForTestImplementation.java:80) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.StatisticsForTestImplementation.setSuccess(StatisticsForTestImplementation.java:135) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.script.Statistics$StatisticsForTest$setSuccess$0.call(Unknown Source) ~[na:na]
        at TestRunner.test(socket_io.groovy:85) ~[na:na]
        at net.grinder.scriptengine.groovy.junit.GrinderRunner.run(GrinderRunner.java:170) ~[ngrinder-groovy-3.4.1.jar:na]
        at net.grinder.scriptengine.groovy.GroovyScriptEngine$GroovyWorkerRunnable.run(GroovyScriptEngine.java:147) ~[ngrinder-groovy-3.4.1.jar:na]
        at net.grinder.engine.process.GrinderThread.run(GrinderThread.java:118) ~[grinder-core-3.9.1.jar:na]
에러가 나옵니다. 원인을 모르겠네요.. 답변부탁드립니다.