org.squashtest.csp.tm.domain.testcase
Class TestCase

java.lang.Object
  extended by org.squashtest.csp.tm.domain.library.GenericLibraryNode
      extended by org.squashtest.csp.tm.domain.testcase.TestCaseLibraryNode
          extended by org.squashtest.csp.tm.domain.testcase.TestCase
All Implemented Interfaces:
org.squashtest.csp.core.domain.Identified, AttachmentHolder, BoundEntity, Copiable, LibraryNode, TreeNode, ProjectResource<Project>, SelfClassAware

@Entity
public class TestCase
extends TestCaseLibraryNode
implements AttachmentHolder, BoundEntity

Author:
Gregory Fouquet

Constructor Summary
TestCase()
           
TestCase(Date createdOn, String createdBy)
           
 
Method Summary
 void accept(NodeVisitor visitor)
           
 void accept(TestCaseLibraryNodeVisitor visitor)
           
 void addCopyOfVerifiedRequirementVersion(RequirementVersion requirementVersionCopy)
          This should be used when making a copy of a RequirementVersion to have the copy verified by this TestCase.
 void addStep(int index, TestStep step)
           
 void addStep(TestStep step)
           
 void addVerifiedRequirement(Requirement requirement)
          This test case verifies the given requirement using its default verifiable version.
 void addVerifiedRequirementVersion(RequirementVersion requirementVersion)
          Adds a RequirementVersion verified by this TestCase
 void checkRequirementNotVerified(RequirementVersion version)
           
 TestCase createCopy()
           
 AutomatedTest getAutomatedTest()
           
 Long getBoundEntityId()
           
 BindableEntity getBoundEntityType()
           
 String getClassName()
           
 String getClassSimpleName()
           
 TestCaseExecutionMode getExecutionMode()
           
 TestCaseImportance getImportance()
           
 TestCaseNature getNature()
           
 int getPositionOfStep(long stepId)
           
 String getPrerequisite()
           
 String getReference()
           
 TestCaseStatus getStatus()
           
 List<TestStep> getSteps()
           
 TestCaseType getType()
           
 Set<RequirementVersion> getVerifiedRequirementVersions()
           
 int getVersion()
           
 boolean isAutomated()
           
 boolean isImportanceAuto()
           
 void moveStep(int stepIndex, int newIndex)
           
 void moveSteps(int newIndex, List<TestStep> movedSteps)
          Will move a list of steps to a new position.
 void removeAutomatedScript()
           
 void removeVerifiedRequirementVersion(RequirementVersion requirement)
           
 void setAutomatedTest(AutomatedTest testAutomationTest)
           
 void setImportance(TestCaseImportance weight)
           
 void setImportanceAuto(boolean importanceAuto)
           
 void setNature(TestCaseNature nature)
           
 void setPrerequisite(String prerequisite)
           
 void setReference(String reference)
          Set the test-case reference
 void setStatus(TestCaseStatus status)
           
 void setType(TestCaseType type)
           
 
Methods inherited from class org.squashtest.csp.tm.domain.testcase.TestCaseLibraryNode
equals, getAllAttachments, getId, getLibrary, hashCode
 
Methods inherited from class org.squashtest.csp.tm.domain.library.GenericLibraryNode
getAttachmentList, getDescription, getName, getProject, notifyAssociatedWithProject, setDescription, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.squashtest.csp.tm.domain.attachment.AttachmentHolder
getAttachmentList
 
Methods inherited from interface org.squashtest.csp.tm.domain.customfield.BoundEntity
getProject
 

Constructor Detail

TestCase

public TestCase(Date createdOn,
                String createdBy)

TestCase

public TestCase()
Method Detail

getVersion

public int getVersion()

getReference

public String getReference()
Returns:
the reference of the test-case

setReference

public void setReference(String reference)
Set the test-case reference

Parameters:
reference -

getPrerequisite

public String getPrerequisite()

getExecutionMode

public TestCaseExecutionMode getExecutionMode()
Returns:
TODO either replaced by isAutomated or should be synchronized with isAutomated
See Also:
isAutomated()

getSteps

public List<TestStep> getSteps()

addStep

public void addStep(@NotNull
                    TestStep step)

addStep

public void addStep(int index,
                    @NotNull
                    TestStep step)

moveStep

public void moveStep(int stepIndex,
                     int newIndex)

moveSteps

public void moveSteps(int newIndex,
                      List<TestStep> movedSteps)
Will move a list of steps to a new position.

Parameters:
newIndex - the position we want the first element of movedSteps to be once the operation is complete
movedSteps - the list of steps to move, sorted by rank among each others.

getVerifiedRequirementVersions

public Set<RequirementVersion> getVerifiedRequirementVersions()
Returns:
UNMODIFIABLE VIEW of verified requirements.

accept

public void accept(TestCaseLibraryNodeVisitor visitor)
Specified by:
accept in class TestCaseLibraryNode

addVerifiedRequirementVersion

public void addVerifiedRequirementVersion(@NotNull
                                          RequirementVersion requirementVersion)
                                   throws RequirementAlreadyVerifiedException
Adds a RequirementVersion verified by this TestCase

Parameters:
requirementVersion - requirement to add, should not be null.
Throws:
RequirementAlreadyVerifiedException - if this test case already verifies another version of the same requirment

addCopyOfVerifiedRequirementVersion

public void addCopyOfVerifiedRequirementVersion(RequirementVersion requirementVersionCopy)
This should be used when making a copy of a RequirementVersion to have the copy verified by this TestCase. When making a copy of a requirement, we cannot use addVerifiedRequirementVersion(RequirementVersion) because of the single requirement check.

Parameters:
requirementVersionCopy - a copy of an existing requirement version. It should not have a requirement yet.

checkRequirementNotVerified

public void checkRequirementNotVerified(RequirementVersion version)
                                 throws RequirementAlreadyVerifiedException
Parameters:
version -
Throws:
RequirementAlreadyVerifiedException

removeVerifiedRequirementVersion

public void removeVerifiedRequirementVersion(@NotNull
                                             RequirementVersion requirement)

createCopy

public TestCase createCopy()
Specified by:
createCopy in interface Copiable

getPositionOfStep

public int getPositionOfStep(long stepId)
                      throws UnknownEntityException
Throws:
UnknownEntityException

getClassSimpleName

public String getClassSimpleName()
Specified by:
getClassSimpleName in interface SelfClassAware

getClassName

public String getClassName()
Specified by:
getClassName in interface SelfClassAware

getImportance

public TestCaseImportance getImportance()
Returns:
the weight

setImportance

public void setImportance(@NotNull
                          TestCaseImportance weight)
Parameters:
weight - the weight to set

getNature

public TestCaseNature getNature()

setNature

public void setNature(@NotNull
                      TestCaseNature nature)

getType

public TestCaseType getType()

setType

public void setType(@NotNull
                    TestCaseType type)

getStatus

public TestCaseStatus getStatus()

setStatus

public void setStatus(@NotNull
                      TestCaseStatus status)

setPrerequisite

public void setPrerequisite(@NotNull
                            String prerequisite)
Parameters:
prerequisite - the prerequisite to set

isImportanceAuto

public boolean isImportanceAuto()
Returns:
the weightAuto

setImportanceAuto

public void setImportanceAuto(boolean importanceAuto)
Parameters:
importanceAuto - the importanceAuto to set

addVerifiedRequirement

public void addVerifiedRequirement(@NotNull
                                   Requirement requirement)
                            throws NoVerifiableRequirementVersionException,
                                   RequirementAlreadyVerifiedException
This test case verifies the given requirement using its default verifiable version.

Parameters:
requirement -
Throws:
NoVerifiableRequirementVersionException - when there is no suitable version to be added
RequirementAlreadyVerifiedException - when this test case already verifies some version of the requirement.

getAutomatedTest

public AutomatedTest getAutomatedTest()

setAutomatedTest

public void setAutomatedTest(AutomatedTest testAutomationTest)

removeAutomatedScript

public void removeAutomatedScript()

isAutomated

public boolean isAutomated()

getBoundEntityId

public Long getBoundEntityId()
Specified by:
getBoundEntityId in interface BoundEntity

getBoundEntityType

public BindableEntity getBoundEntityType()
Specified by:
getBoundEntityType in interface BoundEntity

accept

public void accept(NodeVisitor visitor)
Specified by:
accept in interface TreeNode


Copyright © 2010-2012 Henix, henix.fr. All Rights Reserved.