Skip to content
Snippets Groups Projects
Commit c3f634a2 authored by Tim Flicke's avatar Tim Flicke
Browse files

Merge branch 'prio' into 'master'

Prio

See merge request fe/fe-pda-testing-tool!1
parents 68089ef2 4cee0bb3
No related branches found
No related tags found
No related merge requests found
Showing
with 2485 additions and 2457 deletions
......@@ -96,7 +96,7 @@ ExternalTopic customer ;
ExternalTopic financial ;
Flow Flow_0 for process
with elements : [ Retoure_Start , Flow_Start , Gateway_Parallel_Lager_Neusendung , Flow_0eh02jo , Gateway_Beschaedigt , Flow_unbeschaedigt , Ware_einsortieren , Flow_0a9rzst , New_Task_1 , Flow_New_1 , Gateway_Beschaedigt_Close , Flow_1c2tfla , Flow_1gu0k49 , Kundendaten_ermitteln , Flow_0iibopi , Gateway_Neusendung , Flow_neusenden , Manuelle_Pruefung , Flow_0u77zm0 , Warennummer_ermitteln , Flow_03ubi3l , Gateway_Einpackung_Fehlerhaft_Closed , Flow_006t3wo , Paket_packen , Flow_0bhr7g8 , Paket_pruefen , Flow_1n6o3h6 , Gateway_Einpackung_Fehlerhaft , Flow_paket_okay , Paket_senden , Flow_0u4n4gn , Gateway_Neusendung_Closed , Flow_0m33odz , Gateway_Parallel_Lager_Neusendung_Closed , Flow_Ende , Retoure_Ende ]
with elements : [ Flow_Start , Gateway_Parallel_Lager_Neusendung , Flow_0eh02jo , Gateway_Beschaedigt , Flow_unbeschaedigt , Ware_einsortieren , Flow_0a9rzst , New_Task_1 , Flow_New_1 , Gateway_Beschaedigt_Close , Flow_1c2tfla , Flow_1gu0k49 , Kundendaten_ermitteln , Flow_0iibopi , Gateway_Neusendung , Flow_neusenden , Manuelle_Pruefung , Flow_0u77zm0 , Warennummer_ermitteln , Flow_03ubi3l , Gateway_Einpackung_Fehlerhaft_Closed , Flow_006t3wo , Paket_packen , Flow_0bhr7g8 , Paket_pruefen , Flow_1n6o3h6 , Gateway_Einpackung_Fehlerhaft , Flow_paket_okay , Paket_senden , Flow_0u4n4gn , Gateway_Neusendung_Closed , Flow_0m33odz , Gateway_Parallel_Lager_Neusendung_Closed , Flow_Ende , Retoure_Ende ]
without elements : [ Flow_Erstattung , Finanzdaten_ermitteln , Flow_Erstattung_Datenermittlung , Erstattung , Flow_Erstattung_abgeschlossen , New_Task_2 , New_Flow_2 , Flow_fehlerhaft_eingepackt , Gateway_Auspacken , Flow_normal_auspacken , Ware_auspacken_normal , Flow_0d8lhxo , Gateway_14evkap , Flow_1bnro90 , Flow_luxus_auspacken , Ware_auspacken_luxus , Flow_04tyvq1 , Flow_beschaedigt , Warendaten_erfassen , Flow_01lf19r , Vernichtung_ermitteln , Flow_0kgxxke , Gateway_Vernichtung , Flow_vernichten , Ware_vernichten , Flow_0zkq7z5 , Gateway_Vernichtung_Close , Flow_14jbtgw , Flow_spenden , Ware_spenden , Flow_0f171gg ] ;
Flow Flow_1 for process
with elements : [ Retoure_Start , Flow_Start , Gateway_Parallel_Lager_Neusendung , Flow_0eh02jo , Gateway_Beschaedigt , Flow_unbeschaedigt , Ware_einsortieren , Flow_0a9rzst , New_Task_1 , Flow_New_1 , Gateway_Beschaedigt_Close , Flow_1c2tfla , Flow_1gu0k49 , Kundendaten_ermitteln , Flow_0iibopi , Gateway_Neusendung , Flow_neusenden , Manuelle_Pruefung , Flow_0u77zm0 , Warennummer_ermitteln , Flow_03ubi3l , Gateway_Einpackung_Fehlerhaft_Closed , Flow_006t3wo , Paket_packen , Flow_0bhr7g8 , Paket_pruefen , Flow_1n6o3h6 , Gateway_Einpackung_Fehlerhaft , Flow_fehlerhaft_eingepackt , Gateway_Auspacken , Flow_normal_auspacken , Ware_auspacken_normal , Flow_0d8lhxo , Gateway_14evkap , Flow_1bnro90 , Gateway_Einpackung_Fehlerhaft_Closed , Flow_006t3wo , Paket_packen , Flow_0bhr7g8 , Paket_pruefen , Flow_1n6o3h6 , Gateway_Einpackung_Fehlerhaft , Flow_paket_okay , Paket_senden , Flow_0u4n4gn , Gateway_Neusendung_Closed , Flow_0m33odz , Gateway_Parallel_Lager_Neusendung_Closed , Flow_Ende , Retoure_Ende ]
......
package de.sample.onlineschuhdemo;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.complete;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.runtimeService;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.task;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.withVariables;
import static org.assertj.core.api.Assertions.entry;
import static de.sample.onlineschuhdemo.TestUtils.*;
import org.apache.ibatis.logging.LogFactory;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRuleBuilder;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class Testcollection-old {
@ClassRule
@Rule
public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();
static {
LogFactory.useSlf4jLogging();
}
@Before
public void setup() {
init(rule.getProcessEngine());
}
}
package de.sample.onlineschuhdemo;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.complete;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.runtimeService;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.task;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.withVariables;
import static org.assertj.core.api.Assertions.entry;
import static de.sample.onlineschuhdemo.TestUtils.*;
import org.apache.ibatis.logging.LogFactory;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRuleBuilder;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class Testcollection-old {
@ClassRule
@Rule
public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();
static {
LogFactory.useSlf4jLogging();
}
@Before
public void setup() {
init(rule.getProcessEngine());
}
}
File added
File added
File added
File added
File added
File added
File added
This diff is collapsed.
......@@ -4,7 +4,7 @@
"testPath": "\\src\\test\\java\\de\\sample\\onlineschuhdemo\\",
"modelPath": "\\src\\main\\resources",
"embeddedFilePath": "\\src\\main\\webapp",
"projectRootPath": "C:\\Users\\tillb\\Desktop\\fe_projekt\\fe-pda-testing-tool\\OnlineSchuhDemo"
"projectRootPath": "D:\\VSProjects\\fe-pda-testing-tool\\OnlineSchuhDemo"
},
"bpmnFiles": [
{
......
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OnlineSchuhDemo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OnlineSchuhDemo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
package de.fhmuenster.masterthesis.Testgenerator.bpmn.data;
import java.util.ArrayList;
import java.util.List;
public class BPMNTestcase {
private String name;
private String flow;
private List<TaskVariables> taskVariableList;
private List<EndCheck> endChecks;
private List<String> mocks;
public BPMNTestcase() {
this.taskVariableList = new ArrayList<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFlow() {
return flow;
}
public void setFlow(String flow) {
this.flow = flow;
}
public List<TaskVariables> getTaskVariableList() {
return taskVariableList;
}
public void setTaskVariableList(List<TaskVariables> taskVariableList) {
this.taskVariableList = taskVariableList;
}
public void addTaskVariables(TaskVariables taskVariables) {
taskVariableList.add(taskVariables);
}
public List<EndCheck> getEndChecks() {
return endChecks;
}
public void setEndChecks(List<EndCheck> endChecks) {
this.endChecks = endChecks;
}
public void addEndCheck(EndCheck endCheck) {
this.endChecks.add(endCheck);
}
public List<String> getMocks() {
return mocks;
}
public void setMocks(List<String> mocks) {
this.mocks = mocks;
}
}
package de.fhmuenster.masterthesis.Testgenerator.bpmn.data;
import java.util.ArrayList;
import java.util.List;
public class BPMNTestcase {
private String name;
private String flow;
private List<TaskVariables> taskVariableList;
private List<EndCheck> endChecks;
private List<String> mocks;
private int priority;
public BPMNTestcase() {
this.taskVariableList = new ArrayList<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFlow() {
return flow;
}
public void setFlow(String flow) {
this.flow = flow;
}
public List<TaskVariables> getTaskVariableList() {
return taskVariableList;
}
public void setTaskVariableList(List<TaskVariables> taskVariableList) {
this.taskVariableList = taskVariableList;
}
public void addTaskVariables(TaskVariables taskVariables) {
taskVariableList.add(taskVariables);
}
public List<EndCheck> getEndChecks() {
return endChecks;
}
public void setEndChecks(List<EndCheck> endChecks) {
this.endChecks = endChecks;
}
public void addEndCheck(EndCheck endCheck) {
this.endChecks.add(endCheck);
}
public List<String> getMocks() {
return mocks;
}
public void setMocks(List<String> mocks) {
this.mocks = mocks;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
package de.fhmuenster.masterthesis.Testgenerator.prioritization;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.test.TestService;
import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer;
import de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck;
import de.fhmuenster.masterthesis.testgeneratorDSL.Flow;
import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElementReference;
import de.fhmuenster.masterthesis.testgeneratorDSL.MockReference;
import de.fhmuenster.masterthesis.testgeneratorDSL.Test;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclarations;
public class PrioritizationMetrics {
@Autowired
private TestService testService;
public PrioritizationMetrics() {
}
/**
* Metric 1 (m1)
* @author Tim Flicke, Henning Schmeink
*/
public List<Flow> m1_flowAffected(List<Flow> newFlows, List<Flow> oldFlows) {
List<Flow> affectedFlows = new ArrayList<Flow>();
try
{
// NEU SCHREIBEN! Objekte iterieren
for(int i = 0; i < newFlows.size(); i++)
{
Flow newFlow = newFlows.get(i);
Flow oldFlow = oldFlows.get(i);
StringBuilder sNewWith = new StringBuilder();
StringBuilder sOldWith = new StringBuilder();
StringBuilder sNewWithout = new StringBuilder();
StringBuilder sOldWithout = new StringBuilder();
// Building strings to compare the elements of each flow
// with Elements = [..]
for(FlowElementReference newRefWith : newFlow.getInclElements())
sNewWith.append(newRefWith.getRef().getName()).append(", ");
for(FlowElementReference oldRefWith : oldFlow.getInclElements())
sOldWith.append(oldRefWith.getRef().getName()).append(", ");
// without Elements = [..]
for(FlowElementReference newRefWithout : newFlow.getExclElements())
sNewWithout.append(newRefWithout.getRef().getName()).append(", ");
for(FlowElementReference oldRefWithout : oldFlow.getExclElements())
sOldWithout.append(oldRefWithout.getRef().getName()).append(", ");
// Console output
System.out.println("=========================================");
System.out.println("++ Comparing [NEW] Flow " + newFlow.getName() + " with [OLD] Flow " + oldFlow.getName() + " ++");
// Included and excluded elements are the same
if(sNewWith.toString().equals(sOldWith.toString()) && sNewWithout.toString().equals(sOldWithout.toString()))
System.out.println("Equal");
else
{
affectedFlows.add(newFlow);
System.out.println("Not Equal");
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
return affectedFlows;
}
/**
* Metric 1 (m1)
* @author Tim Flicke, Henning Schmeink
*/
public void m1_getTestsOfAffectedFlows(List<Flow> affectedFlows, TestgeneratorDSLSerializer newDSL) {
List<Test> resultList = new ArrayList<Test>();
for(Flow flow : affectedFlows) {
resultList = newDSL.getTestsForFlow(flow);
for(Test test: resultList) {
System.out.println("Priority for Test " + test.getName() + " + 1 (for Flow: " + flow.getName() + ")");
}
}
}
/**
* Metric 2 (m1)
* @author Tim Flicke, Henning Schmeink
*/
public void m2_testsAffected(TestgeneratorDSLSerializer newDSL, TestgeneratorDSLSerializer oldDSL) {
try
{
List<Test> resultNewTests = new ArrayList<Test>();
List<Test> resultOldTests = new ArrayList<Test>();
// Lists with flows
List<Flow> newFlows = newDSL.getFlows();
List<Flow> oldFlows = oldDSL.getFlows();
// New Tests from new DSL
for(Flow flow : newFlows) {
List<Test> tests = newDSL.getTestsForFlow(flow);
resultNewTests.addAll(tests);
}
// Old Tests from old DSL
for(Flow flow : oldFlows) {
List<Test> tests = oldDSL.getTestsForFlow(flow);
resultOldTests.addAll(tests);
}
for(Test newTest : resultNewTests) {
for(Test oldTest : resultOldTests) {
if(newTest.getName().equals(oldTest.getName()))
{
System.out.println("COMPARE TEST [NEW]" + newTest.getName() + " to [OLD] " + oldTest.getName());
// ==================================================================================================
// Compare Mocks
Collection<String> newMocks = new ArrayList<String>();
Collection<String> oldMocks = new ArrayList<String>();
for(MockReference ref : newTest.getMocks())
newMocks.add(ref.getRef().getName());
for(MockReference ref : oldTest.getMocks())
oldMocks.add(ref.getRef().getName());
// Compare size of Mocks
if(newMocks.size() != oldMocks.size())
System.out.println("Deleted/Added Mock - Change detected"); // change detected
// NewMocks contains all Mocks from old DSL
if(!newMocks.containsAll(oldMocks))
System.out.println("New DSL doesnt contains all mocks from old DSL"); // change detected
// ==================================================================================================
// Compare Checks
Collection<String> newChecks = new ArrayList<String>();
Collection<String> oldChecks = new ArrayList<String>();
for(EndCheck ref : newTest.getEndCheck().getEndChecks())
System.out.println(ref); // Nur Value brauchen den Key
// ==================================================================================================
// Compare Variables
Collection<String> newVar = new ArrayList<String>();
Collection<String> oldVar = new ArrayList<String>();
for(VariableDeclarations ref : newTest.getDeclarations())
{
System.out.println(ref);
for(VariableDeclaration var : ref.getVariables())
{
System.out.println(var);
}
}
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
package de.fhmuenster.masterthesis.Testgenerator.prioritization;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import de.fhmuenster.masterthesis.Testgenerator.rest.mapper.ObjectMapper;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.flow.FlowService;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectService;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.test.TestService;
import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer;
import de.fhmuenster.masterthesis.testgeneratorDSL.Flow;
import de.fhmuenster.masterthesis.testgeneratorDSL.Test;
public class PrioritizationService {
private static final ObjectMapper MAPPER_FLOW = new ObjectMapper()
.withFlowConverter();
@Autowired
private ProjectService projectService;
@Autowired
private FlowService flowService;
@Autowired
private TestService testService;
private PrioritizationMetrics metrics;
private TestgeneratorDSLSerializer oldDSL;
private TestgeneratorDSLSerializer newDSL;
public PrioritizationService(TestgeneratorDSLSerializer oldDSL, TestgeneratorDSLSerializer newDSL) {
this.oldDSL = oldDSL;
this.newDSL = newDSL;
this.metrics = new PrioritizationMetrics();
}
public void prioritize() {
// Affected Flows
List<Flow> affectedFlows = new ArrayList<Flow>();
List<Test> affectedTests = new ArrayList<Test>();
// compare old and new flows
affectedFlows = this.metrics.m1_flowAffected(newDSL.getFlows(), oldDSL.getFlows());
this.metrics.m1_getTestsOfAffectedFlows(affectedFlows, newDSL);
// compare old and new tests
this.metrics.m2_testsAffected(newDSL, oldDSL);
//testService.get
}
}
package de.fhmuenster.masterthesis.Testgenerator.rest.dto;
import java.util.ArrayList;
import java.util.List;
public class BPMNTestcaseDTO {
private String name;
private String flow;
private List<TaskVariablesDTO> taskVariableList;
private List<EndCheckDTO> endChecks;
private List<String> mocks;
public BPMNTestcaseDTO() {
this.taskVariableList = new ArrayList<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFlow() {
return flow;
}
public void setFlow(String flow) {
this.flow = flow;
}
public List<TaskVariablesDTO> getTaskVariableList() {
return taskVariableList;
}
public void setTaskVariableList(List<TaskVariablesDTO> taskVariableList) {
this.taskVariableList = taskVariableList;
}
public List<EndCheckDTO> getEndChecks() {
return endChecks;
}
public void setEndChecks(List<EndCheckDTO> endChecks) {
this.endChecks = endChecks;
}
public List<String> getMocks() {
return mocks;
}
public void setMocks(List<String> mocks) {
this.mocks = mocks;
}
}
package de.fhmuenster.masterthesis.Testgenerator.rest.dto;
import java.util.ArrayList;
import java.util.List;
public class BPMNTestcaseDTO {
private String name;
private String flow;
private List<TaskVariablesDTO> taskVariableList;
private List<EndCheckDTO> endChecks;
private List<String> mocks;
private int priority;
public BPMNTestcaseDTO() {
this.taskVariableList = new ArrayList<>();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFlow() {
return flow;
}
public void setFlow(String flow) {
this.flow = flow;
}
public List<TaskVariablesDTO> getTaskVariableList() {
return taskVariableList;
}
public void setTaskVariableList(List<TaskVariablesDTO> taskVariableList) {
this.taskVariableList = taskVariableList;
}
public List<EndCheckDTO> getEndChecks() {
return endChecks;
}
public void setEndChecks(List<EndCheckDTO> endChecks) {
this.endChecks = endChecks;
}
public List<String> getMocks() {
return mocks;
}
public void setMocks(List<String> mocks) {
this.mocks = mocks;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment