Package org.sonar.api.test

Examples of org.sonar.api.test.MutableTestPlan


    ScanGraph graph = ScanGraph.create();
    TestPlanPerspectiveLoader loader = new TestPlanPerspectiveLoader();
    TestPlanBuilder builder = new TestPlanBuilder(graph, loader);
    ComponentVertex file = graph.addComponent(MockSourceFile.createMain("org.foo.Bar"));

    MutableTestPlan plan = builder.create(file);
    assertThat(plan).isNotNull();
    assertThat(plan.component()).isSameAs(file);
    assertThat(builder.getPerspectiveLoader().load(file)).isSameAs(plan);
  }
View Full Code Here


  }

  @Override
  public void store(TestCaseExecution testCase) {
    File testRes = getTestResource(((DefaultTestCaseExecution) testCase).testFile());
    MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, testRes);
    if (testPlan != null) {
      testPlan
        .addTestCase(testCase.name())
        .setDurationInMs(testCase.durationInMs())
        .setType(testCase.type().name())
        .setStatus(org.sonar.api.test.TestCase.Status.valueOf(testCase.status().name()))
        .setMessage(testCase.message())
View Full Code Here

  public void store(TestCaseCoverage testCaseCoverage) {
    File testRes = getTestResource(testCaseCoverage.testFile());
    File mainRes = getMainResource(testCaseCoverage.coveredFile());
    Testable testAbleFile = perspectives.as(MutableTestable.class, mainRes);
    if (testAbleFile != null) {
      MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, testRes);
      if (testPlan != null) {
        for (MutableTestCase mutableTestCase : testPlan.testCasesByName(testCaseCoverage.testName())) {
          mutableTestCase.setCoverageBlock(testAbleFile, testCaseCoverage.coveredLines());
        }
      } else {
        throw new IllegalStateException("Unable to get MutableTestPlan perspective from " + testRes);
      }
View Full Code Here

    String testData = findTestData(fileKey);
    JsonWriter json = response.newJsonWriter().beginObject();
    if (testData != null) {
      writeFromTestData(testData, json);
    } else {
      MutableTestPlan testPlan = snapshotPerspectives.as(MutableTestPlan.class, fileKey);
      if (testPlan != null) {
        writeFromTestable(testPlan, json);
      }
    }
    json.endObject().close();
View Full Code Here

TOP

Related Classes of org.sonar.api.test.MutableTestPlan

Copyright © 2018 www.massapicom. 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.