Search in sources :

Example 1 with SourceCodeRemarkImpl

use of org.asqatasun.entity.audit.SourceCodeRemarkImpl in project Asqatasun by Asqatasun.

the class CheckTitleTagRelevancyTest method setProcess.

@Override
protected void setProcess() {
    /*
          PASSED : testcase 1 
        */
    ProcessResult pr = processPageTest("Rulescreationdemo.Test.4-1-1-1Passed-01");
    // solution is passed
    assertEquals(TestSolution.PASSED, pr.getValue());
    // 1 element of the scope has been found
    assertEquals(1, pr.getElementCounter());
    // no remark has been created
    assertNull(pr.getRemarkSet());
    /*
          FAILED : testcase 1 
        */
    pr = processPageTest("Rulescreationdemo.Test.4-1-1-2Failed-01");
    // final solution is failed
    assertEquals(TestSolution.FAILED, pr.getValue());
    // 1 element of the scope has been found
    assertEquals(1, pr.getElementCounter());
    // one remark is created 
    assertEquals(1, pr.getRemarkSet().size());
    // the remark is of SourceCodeRemark type
    assertTrue(pr.getRemarkSet().iterator().next() instanceof SourceCodeRemarkImpl);
    // the remark concerns an title element
    assertEquals("title", ((SourceCodeRemark) pr.getRemarkSet().iterator().next()).getTarget());
    // this remark handles the failed solution
    assertEquals(TestSolution.FAILED, pr.getRemarkSet().iterator().next().getIssue());
    // this remark handles the "IframeDetected" message
    assertEquals("IrrelevantTitle", pr.getRemarkSet().iterator().next().getMessageCode());
    // on evidence element is extracted to be help qualification
    assertEquals(1, pr.getRemarkSet().iterator().next().getElementList().size());
    // the evidence element is of text type
    assertEquals("text", pr.getRemarkSet().iterator().next().getElementList().iterator().next().getEvidence().getCode());
    // the value of the evidence element is "document
    assertEquals("document", pr.getRemarkSet().iterator().next().getElementList().iterator().next().getValue());
    /*
          FAILED : testcase 2 
        */
    pr = processPageTest("Rulescreationdemo.Test.4-1-1-2Failed-02");
    // final solution is failed
    assertEquals(TestSolution.FAILED, pr.getValue());
    // 1 element of the scope has been found
    assertEquals(1, pr.getElementCounter());
    // one remark is created 
    assertEquals(1, pr.getRemarkSet().size());
    // the remark is of SourceCodeRemark type
    assertTrue(pr.getRemarkSet().iterator().next() instanceof SourceCodeRemarkImpl);
    // the remark concerns an title element
    assertEquals("title", ((SourceCodeRemark) pr.getRemarkSet().iterator().next()).getTarget());
    // this remark handles the failed solution
    assertEquals(TestSolution.FAILED, pr.getRemarkSet().iterator().next().getIssue());
    // this remark handles the "IframeDetected" message
    assertEquals("IrrelevantTitle", pr.getRemarkSet().iterator().next().getMessageCode());
    // on evidence element is extracted to be help qualification
    assertEquals(1, pr.getRemarkSet().iterator().next().getElementList().size());
    // the evidence element is of text type
    assertEquals("text", pr.getRemarkSet().iterator().next().getElementList().iterator().next().getEvidence().getCode());
    // the value of the evidence element is "document
    assertEquals("UNTITLED", pr.getRemarkSet().iterator().next().getElementList().iterator().next().getValue());
    /*
          NOT_APPLICABLE : testcase 1 
        */
    pr = processPageTest("Rulescreationdemo.Test.4-1-1-4NA-01");
    // solution is passed
    assertEquals(TestSolution.NOT_APPLICABLE, pr.getValue());
    // 0 element of the scope has been found
    assertEquals(0, pr.getElementCounter());
    // no remark has been created
    assertNull(pr.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemarkImpl(org.asqatasun.entity.audit.SourceCodeRemarkImpl)

Example 2 with SourceCodeRemarkImpl

use of org.asqatasun.entity.audit.SourceCodeRemarkImpl in project Asqatasun by Asqatasun.

the class CheckWhetherEachLinkHaventTitleAttributeTest method setProcess.

@Override
protected void setProcess() {
    /*
          PASSED : testcase 1 
        */
    ProcessResult pr = processPageTest("Rulescreationdemo.Test.2-1-1-1Passed-01");
    // solution is passed
    assertEquals(TestSolution.PASSED, pr.getValue());
    // 1 element of the scope has been found
    assertEquals(1, pr.getElementCounter());
    // no remark has been created
    assertNull(pr.getRemarkSet());
    /*
          FAILED : testcase 1 
        */
    pr = processPageTest("Rulescreationdemo.Test.2-1-1-2Failed-01");
    // final solution is failed
    assertEquals(TestSolution.FAILED, pr.getValue());
    // 2 element of the scope has been found
    assertEquals(2, pr.getElementCounter());
    // one remark is created 
    assertEquals(1, pr.getRemarkSet().size());
    // the remark is of SourceCodeRemark type
    assertTrue(pr.getRemarkSet().iterator().next() instanceof SourceCodeRemarkImpl);
    // the remark concerns an "a" element
    assertEquals("a", ((SourceCodeRemark) pr.getRemarkSet().iterator().next()).getTarget());
    // this remark handles the failed solution
    assertEquals(TestSolution.FAILED, pr.getRemarkSet().iterator().next().getIssue());
    // this remark handles the "LinkWithTitleDetected" message
    assertEquals("LinkWithTitleDetected", pr.getRemarkSet().iterator().next().getMessageCode());
    /*
          NOT_APPLICABLE : testcase 1 
        */
    pr = processPageTest("Rulescreationdemo.Test.2-1-1-4NA-01");
    // solution is passed
    assertEquals(TestSolution.NOT_APPLICABLE, pr.getValue());
    // 0 element of the scope has been found
    assertEquals(0, pr.getElementCounter());
    // no remark has been created
    assertNull(pr.getRemarkSet());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemarkImpl(org.asqatasun.entity.audit.SourceCodeRemarkImpl)

Example 3 with SourceCodeRemarkImpl

use of org.asqatasun.entity.audit.SourceCodeRemarkImpl in project Asqatasun by Asqatasun.

the class DetectIframeTest method setProcess.

@Override
protected void setProcess() {
    /*
          PASSED : testcase 1 
        */
    ProcessResult pr = processPageTest("Rulescreationdemo.Test.1-2-1-1Passed-01");
    // solution is passed
    assertEquals(TestSolution.PASSED, pr.getValue());
    // 0 element of the scope has been found
    assertEquals(0, pr.getElementCounter());
    // no remark has been created
    assertNull(pr.getRemarkSet());
    /*
          FAILED : testcase 1 
        */
    pr = processPageTest("Rulescreationdemo.Test.1-2-1-2Failed-01");
    // final solution is failed
    assertEquals(TestSolution.FAILED, pr.getValue());
    // 1 element of the scope has been found
    assertEquals(1, pr.getElementCounter());
    // one remark is created 
    assertEquals(1, pr.getRemarkSet().size());
    // the remark is of SourceCodeRemark type
    assertTrue(pr.getRemarkSet().iterator().next() instanceof SourceCodeRemarkImpl);
    // the remark concerns an iframe element
    assertEquals("iframe", ((SourceCodeRemark) pr.getRemarkSet().iterator().next()).getTarget());
    // this remark handles the failed solution
    assertEquals(TestSolution.FAILED, pr.getRemarkSet().iterator().next().getIssue());
    // this remark handles the "IframeDetected" message
    assertEquals("IframeDetected", pr.getRemarkSet().iterator().next().getMessageCode());
}
Also used : ProcessResult(org.asqatasun.entity.audit.ProcessResult) SourceCodeRemarkImpl(org.asqatasun.entity.audit.SourceCodeRemarkImpl)

Aggregations

ProcessResult (org.asqatasun.entity.audit.ProcessResult)3 SourceCodeRemarkImpl (org.asqatasun.entity.audit.SourceCodeRemarkImpl)3