Examples of PerfTest


Examples of org.ngrinder.model.PerfTest

  @Test
  public void testTestScriptAll() {
    int maxConcurrent = testService.getMaximumConcurrentTestCount();
    assertThat(maxConcurrent, is(10));

    PerfTest testScript = createPerfTest("new TestScript", Status.READY, new Date());
    testService.addCommentOn(getTestUser(), testScript.getId(), "this is TestScript method", "");

    PerfTest testing = testService.markProgressAndStatus(testScript, Status.TESTING, "It is testing from ready");
    assertThat(testing.getStatus(), is(Status.TESTING));

    File testPath = testService.getDistributionPath(testScript);
    assertThat(testPath, not(nullValue()));

    List<String> fileList = testService.getLogFiles(testScript.getId());
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testCleanUpRuntimeOnlyData() {

    PerfTest test = createPerfTest("new test", Status.READY, new Date());
    test.setAgentState("{\"NC-PL-DEV013\":{\"freeMemory\":2937684,\"totalMemory\":8301204,\"cpuUsedPercentage\":31.234259,\"receivedPerSec\":1874668,\"sentPerSec\":1881129}}");
    test.setMonitorState("{\"127.0.0.1\":{\"freeMemory\":1091352,\"totalMemory\":4042436,\"cpuUsedPercentage\":0.24937657,\"receivedPerSec\":102718,\"sentPerSec\":135072}}");
    test.setRunningSample("{\"process\":1,\"peakTpsForGraph\":2192.0,\"lastSampleStatistics\":[{\"Peak_TPS\":0.0,\"Tests\":2145.0,\"Mean_time_to_first_byte\":0.3142191142191142,\"testDescription\":\"Test1\",\"Response_bytes_per_second\":62205.0,\"Errors\":0.0,\"TPS\":2145.0,\"testNumber\":1,\"Mean_Test_Time_(ms)\":0.4205128205128205}],\"thread\":1,\"cumulativeStatistics\":[{\"Peak_TPS\":2192.0,\"Tests\":197185.0,\"Mean_time_to_first_byte\":0.3229910997286812,\"testDescription\":\"Test1\",\"Response_bytes_per_second\":57481.98148390145,\"Errors\":0.0,\"TPS\":1982.1372925483258,\"testNumber\":1,\"Mean_Test_Time_(ms)\":0.4425539468012273}],\"tpsChartData\":2145.0,\"success\":true,\"totalStatistics\":{\"Peak_TPS\":2192.0,\"Tests\":197185.0,\"Mean_time_to_first_byte\":0.3229910997286812,\"Response_bytes_per_second\":57481.98148390145,\"Errors\":0.0,\"TPS\":1982.1372925483258,\"Mean_Test_Time_(ms)\":0.4425539468012273},\"test_time\":105}");
    perfTestService.save(getTestUser(), test);

    PerfTest testInDB = perfTestService.getOne(test.getId());
    assertTrue(testInDB.getAgentState().length() > 0 && testInDB.getMonitorState().length() > 0);
    test.setAgentState(null);
    test.setMonitorState(null);
    test.setRunningSample(null);
    perfTestService.save(getTestUser(), test);
    testInDB = perfTestService.getOne(test.getId());
    assertTrue(testInDB.getAgentState() == null && testInDB.getMonitorState() == null);

  }
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  boolean ended = false;

  @Test
  public void testStartConsole() throws IOException {
    // Get perf test
    PerfTest perfTest = perfTestService.getNextRunnablePerfTestPerfTestCandidate();
    perfTest.setScriptName("/hello/world.py");
    assertThat(perfTest, not(nullValue()));

    // Start console
    SingleConsole singleConsole = perfTestRunnable.startConsole(perfTest);
    assertThat(singleConsole, not(nullValue()));
    assertThat(singleConsole.getConsolePort(), is(perfTest.getPort()));

    // Start agents
    perfTest.setAgentCount(1);
    GrinderProperties grinderProperties = perfTestService.getGrinderProperties(perfTest);
    singleConsole.setReportPath(perfTestService.getReportFileDirectory(perfTest));

    // Distribute files
    perfTestService.prepareDistribution(perfTest);
View Full Code Here

Examples of org.ngrinder.model.PerfTest

    model.clear();
    long invalidId = 123123123123L;
    controller.getOne(getTestUser(), invalidId, model);
    assertThat(model.get(PARAM_TEST), notNullValue());

    PerfTest createPerfTest = createPerfTest("hello", Status.READY, new Date());
    model.clear();
    controller.getOne(getTestUser(), createPerfTest.getId(), model);
    assertThat(model.get(PARAM_TEST), notNullValue());

  }
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testDeleteTests() {
    String testName = "test1";
    PerfTest test = createPerfTest(testName, Status.READY, new Date());
    ModelMap model = new ModelMap();
    controller.delete(getTestUser(), String.valueOf(test.getId()));
    model.clear();
    PerfTest test1 = createPerfTest(testName, Status.READY, new Date());
    PerfTest test2 = createPerfTest(testName, Status.READY, new Date());
    String delIds = "" + test1.getId() + "," + test2.getId();
    controller.delete(getTestUser(), delIds);

    model.clear();
    controller.getOne(getTestUser(), test1.getId(), model);
    assertThat(((PerfTest) model.get(PARAM_TEST)).getId(), nullValue());
    model.clear();
    controller.getOne(getTestUser(), test2.getId(), model);
    assertThat(((PerfTest) model.get(PARAM_TEST)).getId(), nullValue());
  }
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testSavePerfTestCloneAndLeaveCommentAndStop() {
    String testName = "test1";
    PerfTest test = createPerfTest(testName, Status.READY, null);
    long preId = test.getId();

    PerfTest cloneTest = newPerfTest(testName, Status.READY, null);
    cloneTest.setId(test.getId()); // set cloned test's ID as previous test

    ModelMap model = new ModelMap();
    controller.saveOne(getTestUser(), cloneTest, true, model);
    assertThat(preId, not(cloneTest.getId()));

    // test leave comment
    controller.leaveComment(getTestUser(), cloneTest.getId(), "TestComment", "");
    model.clear();
    controller.getOne(getTestUser(), cloneTest.getId(), model);
    PerfTest testInDB = (PerfTest) model.get(PARAM_TEST);
    assertThat(testInDB.getTestComment(), is("TestComment"));

    // test stop test
    cloneTest.setStatus(Status.TESTING);
    perfTestService.save(getTestUser(), cloneTest);
    controller.stop(getTestUser(), String.valueOf(cloneTest.getId()));
View Full Code Here

Examples of org.ngrinder.model.PerfTest

   */
  @Test
  public void testSavePerfTestExist() {
    String testName = "test1";
    String newName = "new test1";
    PerfTest test = createPerfTest(testName, Status.READY, new Date());
    test.setTestName(newName);

    PerfTest newTest = new PerfTest();
    newTest.setId(test.getId());
    newTest.setTestName(newName);
    newTest.setStatus(Status.SAVED);
    newTest.setThreshold(test.getThreshold());
    newTest.setDuration(test.getDuration());
    newTest.setVuserPerAgent(test.getVuserPerAgent());
    newTest.setScheduledTime(test.getScheduledTime());
    newTest.setIgnoreSampleCount(test.getIgnoreSampleCount());
    newTest.setTargetHosts(test.getTargetHosts());
    newTest.setScriptName(test.getScriptName());
    newTest.setProcesses(2);
    newTest.setThreads(2);
    newTest.setVuserPerAgent(newTest.getProcesses() * newTest.getThreads());
    newTest.setRegion(config.getRegion());
    newTest.setAgentCount(1);

    ModelMap model = new ModelMap();
    controller.saveOne(getTestUser(), newTest, false, model);
    controller.getOne(getTestUser(), newTest.getId(), model);
    PerfTest testInDB = (PerfTest) model.get(PARAM_TEST);
    assertThat(testInDB.getTestName(), is(newName));
    assertThat(testInDB.getId(), is(test.getId()));

    model.clear();
    newTest.setStatus(Status.READY);
    controller.saveOne(getTestUser(), newTest, false, model);
    controller.getOne(getTestUser(), newTest.getId(), model);
    testInDB = (PerfTest) model.get(PARAM_TEST);
    assertThat(testInDB.getTestName(), is(newName));
    assertThat(testInDB.getId(), is(test.getId()));

    // test status id "START_TESTING", can not be saved.
    newTest.setStatus(Status.START_TESTING);
    try {
      newTest.setStatus(Status.START_TESTING);
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testGetTestListByOtherUser() {
    String testName = "new test1";
    PerfTest test = createPerfTest(testName, Status.READY, new Date());

    ModelMap model = new ModelMap();

    User otherTestUser = new User();
    otherTestUser.setUserId("testUser");
    otherTestUser.setPassword("testUser");
    otherTestUser.setRole(Role.USER);
    otherTestUser = userService.save(otherTestUser);
    otherTestUser.setTimeZone("Asia/Seoul");
    controller.getAll(otherTestUser, null, null, null, new PageRequest(0, 10), model);
    @SuppressWarnings("unchecked")
    Page<PerfTest> testPage = (Page<PerfTest>) model.get("testListPage");
    List<PerfTest> testList = testPage.getContent();

    assertThat(testList.size(), is(0));

    // test no permission for other user
    model.clear();
    try {
      controller.getOne(otherTestUser, test.getId(), model);
      assertTrue(false);
    } catch (NGrinderRuntimeException e) {
      assertTrue(true);
    }
  }
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testGetReportData() {
    String testName = "test1";
    PerfTest test = createPerfTest(testName, Status.FINISHED, new Date());
    ModelMap model = new ModelMap();
    controller.getReport(model, test.getId());

    model.clear();
    controller.getPerfGraph(test.getId(), "TPS,mean_time(ms)", true, 0);

    model.clear();
    controller.getReportSection(getTestUser(), model, test.getId(), 700);
  }
View Full Code Here

Examples of org.ngrinder.model.PerfTest

  }

  @Test
  public void testGetMonitorData() {
    String testName = "test1";
    PerfTest test = createPerfTest(testName, Status.FINISHED, new Date());
    controller.getMonitorGraph(test.getId(), "127.0.0.1", 0);

    long testId = 123456L;
    controller.getMonitorGraph(testId, "127.0.0.1", 700);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.