public void GeneratedDescriptionTest() { Effect eff1 = new Effect(structure); Effect eff2 = new Effect(structure); Effect eff3 = new Effect(structure); Effect eff6 = new Effect(structure); eq11.Value = "Valor 1"; eq12.Value = "Valor Opcional 2"; eq22.Value = "Valor 2"; eff2.Description = "Efecto 2"; eff3.Description = "Effecto Indirecto"; combi2.AddEffect(eff3); eff6.Description = "Efecto de equivalence"; eq11.AddEffect(eff3); combi2.AddEquivalenceClass(eq11); combi2.AddEffect(eff2); combi.AddEquivalenceClass(eq12); combi.AddEquivalenceClass(eq22); eq22.AddEffect(eff3); combi.AddEffect(eff1); Assert.AreEqual(combi.GeneratedDescription, "(Element Untitled 1='Valor Opcional 2' OR Element Untitled 1='Valor 1') AND (Element Untitled 2='Valor 2') THEN {CE1,Effecto Indirecto,Efecto 2}"); }
public void CanBeAssignedToTestCase() { test2.RemoveCombination(combi4); CombinationManager man3 = new CombinationManager(combi3); Assert.IsFalse(man3.CanBeAssignedToTestCase(test1)); CombinationManager man5 = new CombinationManager(combi5); Assert.IsTrue(man5.CanBeAssignedToTestCase(test1)); CombinationManager man4 = new CombinationManager(combi4); //combination already assigned Assert.IsFalse(man4.CanBeAssignedToTestCase(test1)); //child combination Assert.IsFalse(man4.CanBeAssignedToTestCase(test2)); //compatible combination combi5.AddEquivalenceClass(eq13); combi5.AddEquivalenceClass(eq23); combi5.AddEquivalenceClass(eq31); Assert.IsTrue(man5.CanBeAssignedToTestCase(test2)); //incompatible combination combi5.RemoveEquivalenceClass(eq23); combi5.AddEquivalenceClass(eq21); Assert.IsFalse(man5.CanBeAssignedToTestCase(test2)); }
protected void setUp() { //test a combination from 3 elements structure = new TestCasesStructure(); Element elem1 = new Element(structure); EquivalenceClass eq11 = new EquivalenceClass(elem1); EquivalenceClass eq12 = new EquivalenceClass(elem1); EquivalenceClass eq13 = new EquivalenceClass(elem1); Element elem2 = new Element(structure); EquivalenceClass eq21 = new EquivalenceClass(elem2); EquivalenceClass eq22 = new EquivalenceClass(elem2); EquivalenceClass eq23 = new EquivalenceClass(elem2); Element elem3 = new Element(structure); EquivalenceClass eq31 = new EquivalenceClass(elem3); EquivalenceClass eq32 = new EquivalenceClass(elem3); EquivalenceClass eq33 = new EquivalenceClass(elem3); dep = new Dependency(structure); foreach (Element element in structure.Elements) { dep.AddElement(element); foreach (EquivalenceClass equivalenceClass in element.EquivalenceClasses) { dep.AddEquivalenceClass(equivalenceClass); } } combi1 = new Combination(dep); combi2 = new Combination(dep); combi3 = new Combination(dep); combi4 = new Combination(dep); combi1.AddEquivalenceClass(eq11); combi1.AddEquivalenceClass(eq22); combi1.AddEquivalenceClass(eq33); combi2.AddEquivalenceClass(eq21); combi2.AddEquivalenceClass(eq11); combi2.AddEquivalenceClass(eq32); combi3.AddEquivalenceClass(eq13); combi3.AddEquivalenceClass(eq23); combi3.AddCombination(combi4); test1 = new TestCase(structure); test2 = new TestCase(structure); test1.AddCombination(combi1); test1.AddEquivalenceClass(eq23); test1.AddEquivalenceClass(eq33); test1.AddCombination(combi4); test2.AddCombination(combi3); test2.AddCombination(combi4); }
protected void setUp() { //test a combination from 3 elements structure = new TestCasesStructure(); Element elem1 = new Element(structure); eq11 = new EquivalenceClass(elem1); eq12 = new EquivalenceClass(elem1); eq13 = new EquivalenceClass(elem1); Element elem2 = new Element(structure); eq21 = new EquivalenceClass(elem2); eq22 = new EquivalenceClass(elem2); eq23 = new EquivalenceClass(elem2); Element elem3 = new Element(structure); eq31 = new EquivalenceClass(elem3); eq32 = new EquivalenceClass(elem3); eq33 = new EquivalenceClass(elem3); dep = new Dependency(structure); foreach (Element element in structure.Elements) { dep.AddElement(element); foreach (EquivalenceClass equivalenceClass in element.EquivalenceClasses) { dep.AddEquivalenceClass(equivalenceClass); } } combi2 = new CaseMaker.Entities.Testcases.Combination(dep); combi3 = new CaseMaker.Entities.Testcases.Combination(dep); combi5 = new CaseMaker.Entities.Testcases.Combination(dep); combi2.AddEquivalenceClass(eq21); combi2.AddEquivalenceClass(eq11); combi2.AddEquivalenceClass(eq32); combi3.AddEquivalenceClass(eq13); combi3.AddEquivalenceClass(eq23); combi3.AddEquivalenceClass(eq31); combi5.AddEquivalenceClass(eq11); combi5.AddEquivalenceClass(eq23); combi5.AddEquivalenceClass(eq31); }
protected IUndoableEdit CreateCombinationsFromPatterns(IList <IList <EquivalenceClass> > patterns, CombinationOrigin origin) { //order the patterns based on equivalenceclasses ((List <IList <EquivalenceClass> >)patterns).Sort(new PatternComparer()); ////create a combination for each pattern in the patterns CompoundEdit ce = new CompoundEdit(); IPolicyFactory pfact = new PolicyFactory(); ////delete all combinations from the dependency if (generationOption == CombinationsGenerationOption.OVERWRITE) { ce.AddEdit(pfact.DeleteAllCombinationsPolicy(parentDependency)); } else { ce.AddEdit(RemoveInvalidCombinations(patterns)); RemoveRepeatedPatterns(patterns); } ////create the combinations from the pattern and remove the invalid ones foreach (IList <EquivalenceClass> list in patterns) { Combination comb = new Combination(); ce.AddEdit(EditFactory.instance.CreateAddCombinationEdit(parentDependency, comb)); parentDependency.AddCombination(comb); ce.AddEdit(EditFactory.instance.CreateChangePropertyEdit(comb, "Origin", origin)); comb.Origin = origin; foreach (EquivalenceClass equivalenceClass in list) { ce.AddEdit(EditFactory.instance.CreateAddEquivalenceClassEdit(comb, equivalenceClass)); comb.AddEquivalenceClass(equivalenceClass); } } ////put the positions int i = 1; foreach (Combination combination in parentDependency.Combinations) { if (combination.Position != i) { ce.AddEdit(EditFactory.instance.CreateChangePropertyEdit(combination, "Position", i)); combination.Position = i; } i++; } return(ce); }
public void IEquivalenceClassBean() { DefaultDAO dao = new DefaultDAO(to.TestCasesStruct); Dependency dep = new Dependency(to.TestCasesStruct); Combination combi = new Combination(dep); Element elem = new Element(to.TestCasesStruct); EquivalenceClass equiv = new EquivalenceClass(elem); combi.AddEquivalenceClass(equiv); dao.Save(); dep.RemoveCombination(combi); dao.DeleteItem(combi); to.TestCasesStruct.RemoveDependency(dep); dao.DeleteItem(dep); elem.RemoveEquivalenceClass(equiv); dao.DeleteItem(equiv); to.TestCasesStruct.RemoveElement(elem); dao.DeleteItem(elem); }