コード例 #1
0
  @Test
  public void teardownArgumentsProblemsAreReported() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Teardown]    keyword")
            .build();

    final Map<String, Collection<KeywordEntity>> keywords = new HashMap<>();
    keywords.put(
        "keyword",
        newArrayList(
            newValidationKeywordEntity(
                KeywordScope.LOCAL, "file", "keyword", new Path("file"), "x")));
    final FileValidationContext context = prepareContext(keywords);
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems())
        .containsOnly(
            new Problem(
                ArgumentProblem.INVALID_NUMBER_OF_PARAMETERS,
                new ProblemPosition(3, Range.closed(40, 47))));
  }
コード例 #2
0
  @Ignore
  @Test
  public void duplicatedTeardownsAreReported() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Teardown]    keyword")
            .appendLine("  [Teardown]    keyword")
            .build();

    final Map<String, Collection<KeywordEntity>> keywords = new HashMap<>();
    keywords.put(
        "keyword",
        newArrayList(
            newValidationKeywordEntity(KeywordScope.LOCAL, "file", "keyword", new Path("file"))));
    final FileValidationContext context = prepareContext(keywords);
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems())
        .containsOnly(
            new Problem(
                TestCasesProblem.DUPLICATED_CASE_SETTING,
                new ProblemPosition(3, Range.closed(26, 36))),
            new Problem(
                TestCasesProblem.DUPLICATED_CASE_SETTING,
                new ProblemPosition(4, Range.closed(52, 62))));
  }
コード例 #3
0
  @Ignore
  @Test
  public void duplicatedTimeoutsAreReported() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Timeout]    1")
            .appendLine("  [Timeout]    2")
            .build();

    final FileValidationContext context = prepareContext();
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems())
        .containsOnly(
            new Problem(
                TestCasesProblem.DUPLICATED_CASE_SETTING,
                new ProblemPosition(3, Range.closed(26, 35))),
            new Problem(
                TestCasesProblem.DUPLICATED_CASE_SETTING,
                new ProblemPosition(4, Range.closed(43, 52))));
  }
コード例 #4
0
  @Test
  public void nothingIsReported_whenThereIsATagDefined() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Tags]    tag")
            .build();

    final FileValidationContext context = prepareContext();
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems()).isEmpty();
  }
コード例 #5
0
  @Test
  public void emptyTagsSettingIsReported() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Tags]")
            .build();

    final FileValidationContext context = prepareContext();
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems())
        .containsOnly(
            new Problem(
                TestCasesProblem.EMPTY_CASE_SETTING, new ProblemPosition(3, Range.closed(26, 32))));
  }
コード例 #6
0
  @Test
  public void nothingIsReported_whenThereIsATeardownDefined() throws CoreException {
    final RobotSuiteFile file =
        new RobotSuiteFileCreator()
            .appendLine("*** Test Cases ***")
            .appendLine("case")
            .appendLine("  [Teardown]    keyword")
            .build();

    final Map<String, Collection<KeywordEntity>> keywords = new HashMap<>();
    keywords.put(
        "keyword",
        newArrayList(
            newValidationKeywordEntity(KeywordScope.LOCAL, "file", "keyword", new Path("file"))));
    final FileValidationContext context = prepareContext(keywords);
    final TestCaseSettingsValidator validator =
        new TestCaseSettingsValidator(context, getTestCase(file), reporter);
    validator.validate(null);

    assertThat(reporter.getReportedProblems()).isEmpty();
  }