org.squashtest.tm.domain.testcase
Class TestCase

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

@Entity
@Indexed
@ClassBridges(value={@ClassBridge(name="attachments",store=YES,impl=TestCaseAttachmentBridge.class),@ClassBridge(name="callsteps",store=YES,impl=TestCaseCallStepBridge.class),@ClassBridge(name="iterations",store=YES,impl=TestCaseIterationBridge.class),@ClassBridge(name="executions",store=YES,impl=TestCaseExecutionBridge.class),@ClassBridge(name="issues",store=YES,impl=TestCaseIssueBridge.class),@ClassBridge(name="cufs",store=YES,impl=TestCaseCUFBridge.class),@ClassBridge(name="createdBy",store=YES,analyze=NO,impl=TestCaseBridgeCreatedBy.class),@ClassBridge(name="modifiedBy",store=YES,analyze=NO,impl=TestCaseBridgeModifiedBy.class),@ClassBridge(name="createdOn",store=YES,analyze=NO,impl=TestCaseBridgeCreatedOn.class),@ClassBridge(name="modifiedOn",store=YES,analyze=NO,impl=TestCaseBridgeModifiedOn.class)})
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 addDataset(Dataset dataset)
           
protected  void addParameter(Parameter parameter)
          If the given parameter doesn't already exists in this.parameters, and, if the given parameter's name is not found in this.parmeters : will add the given parameter to this.parameters.
 void addRequirementCoverage(RequirementVersionCoverage requirementVersionCoverage)
          Set the verifying test case as this, and add the coverage the the this.requirementVersionCoverage
 void addStep(int index, TestStep step)
           
 void addStep(TestStep step)
           
 void checkRequirementNotVerified(RequirementVersion version)
          checks if the given version is already verified.
 void checkRequirementNotVerified(RequirementVersionCoverage requirementVersionCoverage, RequirementVersion version)
          Checks if the given version is already verified, avoiding to look at the given requirementVersionCoverage.
 TestCase createCopy()
          Will create a copy from this instance.
 List<RequirementVersionCoverage> createRequirementVersionCoveragesForCopy(TestCase copy)
          Copy this.requirementVersionCoverages .
 Parameter findParameterByName(String name)
          Will go through this.parameters and return the Parameter matching the given name
 Set<String> findUsedParamsNamesInSteps()
          Will find the names of all parameters used in this test case's steps.
 List<ActionTestStep> getActionSteps()
           
 AutomatedTest getAutomatedTest()
           
 Long getBoundEntityId()
           
 BindableEntity getBoundEntityType()
           
 String getClassName()
           
 String getClassSimpleName()
           
 Set<Dataset> getDatasets()
           
 TestCaseExecutionMode getExecutionMode()
           
 String getFullName()
           
 TestCaseImportance getImportance()
           
 TestCaseNature getNature()
           
 Set<Parameter> getParameters()
           
 int getPositionOfStep(long stepId)
          Will compare id of test-case steps with given id and return the index of the matching step.
 String getPrerequisite()
           
 String getReference()
           
 Set<RequirementVersionCoverage> getRequirementVersionCoverages()
           
 TestCaseStatus getStatus()
           
 List<TestStep> getSteps()
           
 TestCaseType getType()
           
 Set<RequirementVersion> getVerifiedRequirementVersions()
           
 int getVersion()
           
 boolean hasStep(TestStep step)
          Returns true if a step of the same id is found in this.steps.
 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 removeRequirementVersionCoverage(RequirementVersionCoverage requirementVersionCoverage)
          Simply remove the RequirementVersionCoverage from this.requirementVersionCoverages.
 void setAutomatedTest(AutomatedTest testAutomationTest)
           
 void setExecutionMode(TestCaseExecutionMode executionMode)
           
 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)
           
 boolean verifies(RequirementVersion rVersion)
           
 
Methods inherited from class org.squashtest.tm.domain.testcase.TestCaseLibraryNode
equals, getAllAttachments, getId, getLibrary, hashCode
 
Methods inherited from class org.squashtest.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.tm.domain.attachment.AttachmentHolder
getAttachmentList
 
Methods inherited from interface org.squashtest.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

getFullName

public String getFullName()
Returns:
{reference} - {name} if reference is not empty, or {name} if it is

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()

setExecutionMode

public void setExecutionMode(@NotNull
                             TestCaseExecutionMode executionMode)

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.

accept

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

createCopy

public TestCase createCopy()
Will create a copy from this instance.
Will copy all properties, steps, automated scripts, parameters, datasets.
! Will not copy RequirementVersionCoverages !

Specified by:
createCopy in interface Copiable
Returns:
a copy of this TestCase

getPositionOfStep

public int getPositionOfStep(long stepId)
                      throws UnknownEntityException
Will compare id of test-case steps with given id and return the index of the matching step. Otherwise throw an exception.

Parameters:
stepId -
Returns:
the step index (starting at 0)
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

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

getActionSteps

public List<ActionTestStep> getActionSteps()
Returns:
the list of ActionTestStep or empty list

getVerifiedRequirementVersions

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

checkRequirementNotVerified

public void checkRequirementNotVerified(RequirementVersionCoverage requirementVersionCoverage,
                                        RequirementVersion version)
                                 throws RequirementAlreadyVerifiedException
Checks if the given version is already verified, avoiding to look at the given requirementVersionCoverage.

Parameters:
requirementVersionCoverage -
version -
Throws:
RequirementAlreadyVerifiedException

addRequirementCoverage

public void addRequirementCoverage(RequirementVersionCoverage requirementVersionCoverage)
Set the verifying test case as this, and add the coverage the the this.requirementVersionCoverage

Parameters:
requirementVersionCoverage -

createRequirementVersionCoveragesForCopy

public List<RequirementVersionCoverage> createRequirementVersionCoveragesForCopy(TestCase copy)
Copy this.requirementVersionCoverages . All RequirementVersionCoverage having for verifying test case the copy param.

Parameters:
copy - : the TestCase that will verify the copied coverages
Returns:
: the copied RequirementVersionCoverages

hasStep

public boolean hasStep(TestStep step)
Returns true if a step of the same id is found in this.steps.

Parameters:
step - : the step to check
Returns:
true if this TestCase has the given step.

removeRequirementVersionCoverage

public void removeRequirementVersionCoverage(RequirementVersionCoverage requirementVersionCoverage)
Simply remove the RequirementVersionCoverage from this.requirementVersionCoverages.

Parameters:
requirementVersionCoverage - : the entity to remove from this test case's RequirementVersionCoverages list.

getRequirementVersionCoverages

public Set<RequirementVersionCoverage> getRequirementVersionCoverages()
Returns:
an unmodifiable set of the test case RequirementVersionCoverages

verifies

public boolean verifies(RequirementVersion rVersion)
Parameters:
calledVersion -
Returns:
true if this TestCase verifies the RequirementVersion

checkRequirementNotVerified

public void checkRequirementNotVerified(RequirementVersion version)
                                 throws RequirementAlreadyVerifiedException
checks if the given version is already verified.

Parameters:
version -
Throws:
RequirementAlreadyVerifiedException

getParameters

public Set<Parameter> getParameters()

addParameter

protected void addParameter(@NotNull
                            Parameter parameter)
If the given parameter doesn't already exists in this.parameters, and, if the given parameter's name is not found in this.parmeters : will add the given parameter to this.parameters.

Parameters:
parameter -
Throws:
NameAlreadyInUseException

getDatasets

public Set<Dataset> getDatasets()

addDataset

public void addDataset(@NotNull
                       Dataset dataset)

findParameterByName

public Parameter findParameterByName(String name)
Will go through this.parameters and return the Parameter matching the given name

Parameters:
name - : the name of the parameter to return
Returns:
the parameter matching the given name or null

findUsedParamsNamesInSteps

public Set<String> findUsedParamsNamesInSteps()
Will find the names of all parameters used in this test case's steps.

Returns:
a Set of Sting empty or containing all used parameter names in this steps.


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