def testIdAcceptanceTestDoesNotExists(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idBacklog = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idBacklog) search = aAcc.searchAccion('cinrohbwidia',idBacklog) idAccion = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idAccion, idBacklog,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idBacklog) idStory = searchHist[0].UH_idUserHistory # Inicio de la prueba. oTest = acceptanceTest() result = oTest.findIdAcceptanceTest(1532) self.assertFalse(result) # Eliminamos los datos insertados. aHist.deleteUserHistory(idStory) aAcc.deleteAccion('cinrohbwidia', idBacklog) aBacklog.deleteProduct('Podn fjdd.')
def insertAcceptanceCriteria(self,idUserHistory,description): '''Permite insertar un nuevo criterio de aceptacion''' checkTypeidUserHistory = type(idUserHistory) == int checkTypeDescription = type(description) == str if checkTypeidUserHistory and checkTypeDescription: oUserStory = userHistory() foundUserHistory = oUserStory.searchIdUserHistory(idUserHistory) if len(description) > MAX_ACCEPTANCE_DESCRIPTION: return False if foundUserHistory != []: foundAC = clsAcceptanceCriteria.query.filter_by(HAC_idUserHistory = idUserHistory).all() for elem in foundAC: if elem.HAC_description == description: return False newHAC = clsAcceptanceCriteria(idUserHistory,description) db.session.add(newHAC) db.session.commit() return True return False
def testInsertTestElementMay(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idBacklog = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idBacklog) search = aAcc.searchAccion('cinrohbwidia',idBacklog) idAccion = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idAccion, idBacklog,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idBacklog) idStory = searchHist[0].UH_idUserHistory # Inicio de la prueba. oTest = acceptanceTest() result = oTest.insertAcceptanceTest(idStory, 'SDFSDF', '/foo/bar/baz') self.assertTrue(result) # Eliminamos los datos insertados. test = aHist.testsAsociatedToUserHistory(idStory)[0] oTest.deleteAcceptanceTest(test.AT_idAT) aHist.deleteUserHistory(idStory) aAcc.deleteAccion('cinrohbwidia', idBacklog) aBacklog.deleteProduct('Podn fjdd.')
def insertTask(self, HW_description, C_idCategory, HW_weight, UH_idUserHistory, HW_iniciado, HW_fechaInicio): '''Permite insertar una tarea''' typedescription = (type(HW_description) == str) typeidCategory = (type(C_idCategory) == int) typeWeight = (type(HW_weight) == int) typeid = (type(UH_idUserHistory) == int) typeIniciado = (type(HW_iniciado) == bool) if (typedescription and typeidCategory and typeWeight and typeid and typeIniciado): long_HW_description = MIN_TASK_DESCRIPTION <= len(HW_description) <= MAX_TASK_DESCRIPTION min_C_idCategory = C_idCategory >= MIN_ID min_HW_weight = HW_weight >= MIN_WEIGHT min_UH_idUserHistory = UH_idUserHistory >= MIN_ID if (long_HW_description and min_C_idCategory and min_HW_weight and min_UH_idUserHistory): oUserHistory = clsUserHistory.query.filter_by(UH_idUserHistory = UH_idUserHistory).all() oCategory = clsCategory.query.filter_by(C_idCategory = C_idCategory).all() oTask = clsTask.query.filter_by(HW_description = HW_description).all() oHistory = userHistory() esEpica = (oHistory.isEpic(UH_idUserHistory)) if ((oUserHistory != []) and (oCategory != []) and (oTask == []) and (not esEpica)): new_task = clsTask(HW_description,C_idCategory,HW_weight,UH_idUserHistory,HW_iniciado,HW_fechaInicio) db.session.add(new_task) db.session.commit() return True return False
def testCompletarHistoriaUsuarioNoExistenteSinTareas(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.', 'ODJdbeidbww', 1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia', idFound0) search = aAcc.searchAccion('cinrohbwidia', idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1', 0, 1, idFound, idFound0, 1, True, TODAY,True, TOMORROW) searchHist = aHist.searchUserHistory('BIEEIEB1', idFound0) idFound1 = searchHist[0].UH_idUserHistory # Completamos historia badId = 1324 self.assertEqual((aHist.completeHistory(badId)), False) # Eliminamos todo de la BD aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def insertTask(self, HW_description, C_idCategory, HW_weight, UH_idUserHistory): '''Permite insertar una tarea''' typedescription = (type(HW_description) == str) typeidCategory = (type(C_idCategory) == int) typeWeight = (type(HW_weight) == int) typeid = (type(UH_idUserHistory) == int) if (typedescription and typeidCategory and typeWeight and typeid): long_HW_description = MIN_TASK_DESCRIPTION <= len( HW_description) <= MAX_TASK_DESCRIPTION min_C_idCategory = C_idCategory >= MIN_ID min_HW_weight = HW_weight >= MIN_WEIGHT min_UH_idUserHistory = UH_idUserHistory >= MIN_ID if (long_HW_description and min_C_idCategory and min_HW_weight and min_UH_idUserHistory): oUserHistory = clsUserHistory.query.filter_by( UH_idUserHistory=UH_idUserHistory).all() oCategory = clsCategory.query.filter_by( C_idCategory=C_idCategory).all() oTask = clsTask.query.filter_by( HW_description=HW_description).all() oHistory = userHistory() esEpica = (oHistory.isEpic(UH_idUserHistory)) if ((oUserHistory != []) and (oCategory != []) and (oTask == []) and (not esEpica)): new_task = clsTask(HW_description, C_idCategory, HW_weight, UH_idUserHistory) db.session.add(new_task) db.session.commit() return True return False
def testCicloIndirecto(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.', 'ODJdbeidbww', 1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia', idFound0) search = aAcc.searchAccion('cinrohbwidia', idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1', 0, 1, idFound, idFound0, 1, True, TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1', idFound0) idFound1 = searchHist[0].UH_idUserHistory # Insertamos la categoria aCategory = category() aCategory.insertCategory('wofhweoifh', 1) # Insertamos la tarea 1 aTarea = task() aTarea.insertTask('dwidjw', 1, 1, idFound1, True, TODAY) searchTask1 = aTarea.searchTask('dwidjw') idprimera = searchTask1[0].HW_idTask # Insertamos la tarea 2 bTarea = task() bTarea.insertTask('dfghj', 2, 2, idFound1, True, TODAY) searchTask2 = bTarea.searchTask('dfghj') idsegunda = searchTask2[0].HW_idTask # Insertamos la tarea 3 cTarea = task() cTarea.insertTask('dfghj2', 3, 3, idFound1, True, TODAY) searchTask3 = cTarea.searchTask('dfghj2') idtercera = searchTask3[0].HW_idTask #Insertamos la precedencia aPrecedence = precedence() aPrecedence.insertPrecedence(idprimera, idsegunda, idFound0) aPrecedence.insertPrecedence(idsegunda, idtercera, idFound0) self.assertEqual( (aPrecedence.insertPrecedence(idtercera, idprimera, idFound0)), None) # Eliminamos la precedencia, tarea, categoria, historia, accion y producto aPrecedence.deletePrecedence(idprimera, idsegunda) aPrecedence.deletePrecedence(idsegunda, idtercera) aTarea.deleteTask('dwidjw') bTarea.deleteTask('dfghj') bTarea.deleteTask('dfghj2') aCategory.deleteCategory('wofhweoifh') aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def insertAcceptanceCriteria(self, idUserHistory, description): '''Permite insertar un nuevo criterio de aceptacion''' checkTypeidUserHistory = type(idUserHistory) == int checkTypeDescription = type(description) == str if checkTypeidUserHistory and checkTypeDescription: oUserStory = userHistory() foundUserHistory = oUserStory.searchIdUserHistory(idUserHistory) if len(description) > MAX_ACCEPTANCE_DESCRIPTION: return False if foundUserHistory != []: foundAC = clsAcceptanceCriteria.query.filter_by( HAC_idUserHistory=idUserHistory).all() for elem in foundAC: if elem.HAC_description == description: return False newHAC = clsAcceptanceCriteria(idUserHistory, description) db.session.add(newHAC) db.session.commit() return True return False
def testCompletarHistoriaUsuarioNoExistenteSinTareas(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idFound0) search = aAcc.searchAccion('cinrohbwidia',idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idFound, idFound0,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idFound0) idFound1 = searchHist[0].UH_idUserHistory # Completamos historia badId = 1324 self.assertEqual ((aHist.completeHistory(badId)),False) # Eliminamos todo de la BD aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def testSearchConsecuenteMuchosCorrecto(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idFound0) search = aAcc.searchAccion('cinrohbwidia',idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idFound, idFound0,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idFound0) idFound1 = searchHist[0].UH_idUserHistory # Insertamos la categoria aCategory = category() aCategory.insertCategory('wofhweoifh',1) # Insertamos la tarea 1 aTarea = task() aTarea.insertTask('dwidjw',1,1,idFound1,True,TODAY) searchTask1 = aTarea.searchTask('dwidjw') idprimera = searchTask1[0].HW_idTask # Insertamos la tarea 2 bTarea = task() bTarea.insertTask('dfghj',2,2,idFound1,True,TODAY) searchTask2 = bTarea.searchTask('dfghj') idsegunda = searchTask2[0].HW_idTask # Insertamos la tarea 3 cTarea = task() cTarea.insertTask('dfghj2',3,3,idFound1,True,TODAY) searchTask3 = cTarea.searchTask('dfghj2') idtercera = searchTask3[0].HW_idTask #Insertamos la precedencia aPrecedence = precedence() aPrecedence.insertPrecedence(idprimera,idsegunda,idFound0) aPrecedence.insertPrecedence(idtercera,idsegunda,idFound0) self.assertEqual ((aPrecedence.searchTaskByCons(idsegunda) != []), True) # Eliminamos la precedencia, tarea, categoria, historia, accion y producto aPrecedence.deletePrecedence(idprimera,idsegunda) aPrecedence.deletePrecedence(idtercera,idsegunda) aTarea.deleteTask('dwidjw') bTarea.deleteTask('dfghj') bTarea.deleteTask('dfghj2') aCategory.deleteCategory('wofhweoifh') aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def taskWithIdAndDescription(self, idPila): otask = task() oHistory = userHistory() result = [] historias = oHistory.getAllUserHistoryId(idPila) for h in historias: tareas = otask.getAllTask(h.UH_idUserHistory) for t in tareas: result.append((t.HW_idTask, t.HW_description + "\n(" + h.UH_codeUserHistory + ")")) return result
def asignSprintHistory(self, sprintNumber, idBacklog, idUserHistory): ''' Permite asignar a un Sprint una historia de usuario asociado al producto ''' checkSprintNumber = type(sprintNumber) == int and MIN_SPRINT_NUMBER <= sprintNumber <= MAX_SPRINT_NUMBER checkidBacklog = type(idBacklog) == int and MIN_ID <= idBacklog checkidUserHistory = type(idUserHistory) == int and MIN_ID <= idUserHistory if checkSprintNumber and checkidBacklog and checkidUserHistory: oUserHistory = userHistory() history = oUserHistory.searchIdUserHistory(idUserHistory) sprint = self.searchIdSprint(sprintNumber, idBacklog) if history != [] and sprint != []: history[0].UH_idSprint = sprint[0].S_idSprint db.session.commit() return True return False
def deleteAssignedSprintHistory(self, sprintNumber, idBacklog, idUserHistory): ''' Permite eliminar la asignacion de una historia asociado a un Sprint dado su id''' checkSprintNumber = type(sprintNumber) == int and MIN_SPRINT_NUMBER <= sprintNumber <= MAX_SPRINT_NUMBER checkidBacklog = type(idBacklog) == int and MIN_ID <= idBacklog checkidUserHistory = type(idUserHistory) == int and MIN_ID <= idUserHistory if checkSprintNumber and checkidBacklog and checkidUserHistory: oUserHistory = userHistory() history = oUserHistory.searchIdUserHistory(idUserHistory) if history != []: history[0].UH_idSprint = None history[0].UH_resume = None db.session.commit() return True return False
def historyEstimatedTime(self, idUserHistory): checkTypeId = type(idUserHistory) == int time = 0 oUserHistory = userHistory() esEpica = oUserHistory.isEpic(idUserHistory) if not esEpica: if checkTypeId: taskList = self.taskAsociatedToUserHistory(idUserHistory) if taskList != []: for task in taskList: time = time + task.HW_estimatedTime else: time = 1 return time
def asignSprintHistory(self, sprintNumber, idBacklog, idUserHistory): ''' Permite asignar a un Sprint una historia de usuario asociado al producto ''' checkSprintNumber = type( sprintNumber ) == int and MIN_SPRINT_NUMBER <= sprintNumber <= MAX_SPRINT_NUMBER checkidBacklog = type(idBacklog) == int and MIN_ID <= idBacklog checkidUserHistory = type( idUserHistory) == int and MIN_ID <= idUserHistory if checkSprintNumber and checkidBacklog and checkidUserHistory: oUserHistory = userHistory() history = oUserHistory.searchIdUserHistory(idUserHistory) sprint = self.searchIdSprint(sprintNumber, idBacklog) if history != [] and sprint != []: history[0].UH_idSprint = sprint[0].S_idSprint db.session.commit() return True return False
def testIncompleteHistoriaUsuarioNoExistenteConTareas(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.', 'ODJdbeidbww', 1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia', idFound0) search = aAcc.searchAccion('cinrohbwidia', idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1', 0, 1, idFound, idFound0, 1, True, TODAY,True, TOMORROW) searchHist = aHist.searchUserHistory('BIEEIEB1', idFound0) idFound1 = searchHist[0].UH_idUserHistory # Insertamos la categoria aCategory = category() aCategory.insertCategory('wofhweoifh', 1) # Insertamos la tarea 1 aTarea = task() aTarea.insertTask('dwidjw', 1, 1, idFound1, True, TODAY,True, TOMORROW) searchTask1 = aTarea.searchTask('dwidjw') idprimera = searchTask1[0].HW_idTask # Insertamos la tarea 2 bTarea = task() bTarea.insertTask('dfghj', 2, 2, idFound1, True, TODAY,True, TOMORROW) searchTask2 = bTarea.searchTask('dfghj') idsegunda = searchTask2[0].HW_idTask # Completamos historia badId = idFound1 + 1 self.assertEqual((aHist.incompleteHistory(badId)), False) # Eliminamos todo de la BD aTarea.deleteTask('dwidjw') bTarea.deleteTask('dfghj') aCategory.deleteCategory('wofhweoifh') aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def testCompletarHistoriaUsuarioConTareas(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idFound0) search = aAcc.searchAccion('cinrohbwidia',idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idFound, idFound0,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idFound0) idFound1 = searchHist[0].UH_idUserHistory # Insertamos la categoria aCategory = category() aCategory.insertCategory('wofhweoifh',1) # Insertamos la tarea 1 aTarea = task() aTarea.insertTask('dwidjw',1,1,idFound1,True,TODAY) searchTask1 = aTarea.searchTask('dwidjw') idprimera = searchTask1[0].HW_idTask # Insertamos la tarea 2 bTarea = task() bTarea.insertTask('dfghj',2,2,idFound1,True,TODAY) searchTask2 = bTarea.searchTask('dfghj') idsegunda = searchTask2[0].HW_idTask # Completamos historia self.assertEqual ((aHist.completeHistory(idFound1)),True) # Eliminamos todo de la BD aTarea.deleteTask('dwidjw') bTarea.deleteTask('dfghj') aCategory.deleteCategory('wofhweoifh') aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def historyWeight(self,idUserHistory): ''' Permite obtener la suma de todos los pesos de las tareas correspondientes a una historia de usuario ''' checkTypeId = type(idUserHistory) == int peso = 0 oUserHistory = userHistory() esEpica = oUserHistory.isEpic(idUserHistory) if not esEpica: if checkTypeId: taskList = self.taskAsociatedToUserHistory(idUserHistory) if taskList != []: for task in taskList: peso = peso + task.HW_weight else: peso = '' return peso
def historyWeight(self, idUserHistory): ''' Permite obtener la suma de todos los pesos de las tareas correspondientes a una historia de usuario ''' checkTypeId = type(idUserHistory) == int peso = 0 oUserHistory = userHistory() esEpica = oUserHistory.isEpic(idUserHistory) if not esEpica: if checkTypeId: taskList = self.taskAsociatedToUserHistory(idUserHistory) if taskList != []: for task in taskList: peso = peso + task.HW_weight else: peso = '' return peso
def insertAcceptanceTest(self,idUserHistory,description,urlScript): '''Permite insertar una nueva prueba de aceptacion''' checkTypeidUserHistory = type(idUserHistory) == int checkTypeDescription = type(description) == str checkTypeUrlScript = type(urlScript) == str if checkTypeidUserHistory and checkTypeDescription and checkTypeUrlScript: oUserStory = userHistory() foundUserHistory = oUserStory.searchIdUserHistory(idUserHistory) foundUrlScript = clsAcceptanceTest.query.filter_by(AT_urlScript = urlScript).first() if foundUserHistory != [] and foundUrlScript == None: newAT = clsAcceptanceTest(idUserHistory,description,urlScript) db.session.add(newAT) db.session.commit() return True return False
def deleteAssignedSprintHistory(self, sprintNumber, idBacklog, idUserHistory): ''' Permite eliminar la asignacion de una historia asociado a un Sprint dado su id''' checkSprintNumber = type( sprintNumber ) == int and MIN_SPRINT_NUMBER <= sprintNumber <= MAX_SPRINT_NUMBER checkidBacklog = type(idBacklog) == int and MIN_ID <= idBacklog checkidUserHistory = type( idUserHistory) == int and MIN_ID <= idUserHistory if checkSprintNumber and checkidBacklog and checkidUserHistory: oUserHistory = userHistory() history = oUserHistory.searchIdUserHistory(idUserHistory) if history != []: history[0].UH_idSprint = None history[0].UH_resume = None db.session.commit() return True return False
def insertAcceptanceTest(self, idUserHistory, description, urlScript): '''Permite insertar una nueva prueba de aceptacion''' checkTypeidUserHistory = type(idUserHistory) == int checkTypeDescription = type(description) == str checkTypeUrlScript = type(urlScript) == str if checkTypeidUserHistory and checkTypeDescription and checkTypeUrlScript: oUserStory = userHistory() foundUserHistory = oUserStory.searchIdUserHistory(idUserHistory) foundUrlScript = clsAcceptanceTest.query.filter_by( AT_urlScript=urlScript).first() if foundUserHistory != [] and foundUrlScript == None: newAT = clsAcceptanceTest(idUserHistory, description, urlScript) db.session.add(newAT) db.session.commit() return True return False
def testInsertPrimeraTareaNoValida(self): # Insertamos Producto aBacklog = backlog() aBacklog.insertBacklog('Podn fjdd.','ODJdbeidbww',1) searchBacklog = aBacklog.findName('Podn fjdd.') idFound0 = searchBacklog[0].BL_idBacklog # Insertamos la accion aAcc = accions() aAcc.insertAccion('cinrohbwidia',idFound0) search = aAcc.searchAccion('cinrohbwidia',idFound0) idFound = search[0].AC_idAccion # Insertamos la historia aHist = userHistory() aHist.insertUserHistory('BIEEIEB1',0, 1,idFound, idFound0,1,True,TODAY) searchHist = aHist.searchUserHistory('BIEEIEB1',idFound0) idFound1 = searchHist[0].UH_idUserHistory # Insertamos la categoria aCategory = category() aCategory.insertCategory('wofhweoifh',1) # Insertamos la tarea 1 aTarea = task() aTarea.insertTask('dwidjw',1,1,idFound1,True,TODAY) searchTask1 = aTarea.searchTask('dwidjw') idprimera = searchTask1[0].HW_idTask #Insertamos la precedencia aPrecedence = precedence() self.assertEqual ((aPrecedence.insertPrecedence(idprimera,None,idFound0)), None) # Eliminamos la precedencia, tarea, categoria, historia, accion y producto aTarea.deleteTask('dwidjw') aCategory.deleteCategory('wofhweoifh') aHist.deleteUserHistory(idFound1) aAcc.deleteAccion('cinrohbwidia', idFound0) aBacklog.deleteProduct('Podn fjdd.')
def generateDocument(idProduct,path): width, height = letter #Tipo de hoja del documento. documentName = path + "Documento-Vision.pdf" #Ruta donde se creara el documento. #----------------------- Funciones especiales ----------------------------- def header(canvas,document): '''Permite definir el encabezado del documento vision''' canvas.saveState() canvas.setLineWidth(width=1) canvas.setStrokeColor(black) #Dibujamos la tabla. rect(x, y, ancho, alto) canvas.rect(2*cm , height - 13, width - 130, 22, fill=False, stroke=True) #canvas.rect(12.3*cm, height - 13, 190 , 22, fill=False, stroke=True) canvas.rect(2*cm , height - 26, width - 130, 13, fill=False, stroke=True) canvas.rect(12.3*cm, height - 26, 190 , 13, fill=False, stroke=True) canvas.rect(2*cm , height - 39, width - 130, 13, fill=False, stroke=True) canvas.setFont('Arial',10) canvas.drawString(2.1*cm, height - 1, "Título del proyecto: ") canvas.setFont('Arial Bold',10) canvas.drawString(5.2*cm, height - 1, projectName) canvas.setFont('Arial',10) canvas.drawString(2.1*cm, height - 23, "Artefacto: ") canvas.setFont('Arial Bold',10) canvas.drawString(3.7*cm, height - 23, "Documento de Visión") canvas.setFont('Arial',10) canvas.drawString(12.4*cm, height - 23, "Fecha: ") canvas.setFont('Arial Bold',10) canvas.drawString(13.6*cm, height - 23, currentDate) canvas.setFont('Arial',10) canvas.drawString(2.1*cm, height - 36, "Método de desarrollo de Software: Scrum") canvas.restoreState() def footer(canvas,document): '''Permite definir el pie de pagina del documento vision''' canvas.saveState() canvas.setFont('Arial',10) if (document.page != 1): canvas.drawString(width - 180, 1 * cm, "Página %d" %document.page) canvas.restoreState() def insertJumpLine(statement,interval): '''Permite insertar saltos de linea en un string para que se ajuste a un espacio determinado''' split = False n = len(statement) // interval #Establecemos saltos de linea para que el contenido no se salga de la tabla. for i in range(n,0,-1): for j in range(i*interval,-1,-1): j -= 1 if statement[j] == " ": statement = statement[:j] + "\n" + statement[j+1:] break if j == 0: split = True if split: n = len(statement) acum = 0 for i in range(0,n+1,1): if i == acum: statement = statement[:i] + "\n" + statement[i:] acum += interval return statement def days_between(d1, d2): '''Permite calcular los dias transcurridos entre dos fechas dadas''' return abs((d2 - d1).days) #----------------------------- Clases a usar ------------------------------ oUser = user() oTeam = team() oBacklog = backlog() oSprint = sprints() oActor = role() oAccion = accions() oObjective = objective() oUserHistory = userHistory() oTask = task() oActUserHist = actorsUserHistory() oObjUserHist = objectivesUserHistory() oSubTeam = subEquipoClass() oDocument = visionDocument() oCategory = category() oACriteria = acceptanceCriteria() oTCriteria = acceptanceTest() #------------------------------ Fecha actual ------------------------------ i = datetime.datetime.now() day = i.day month = i.month year = i.year currentDate = str(day) + "/" + str(month) + "/" + str(year) #---------------------------- Datos del proyecto -------------------------- result = oBacklog.findIdProduct(idProduct) projectName = result.BL_name projectDescription = result.BL_description projectScaleType = result.BL_scaleType information = oDocument.searchVisionDocument(idProduct) #------------------ Datos de las historias de usuario --------------------- #Obtenemos las historias asociadas al producto. userHistoriesList = oBacklog.userHistoryAsociatedToProduct(idProduct) weights = [] userHistories = [] epics = [] options = {1:'podria ',2:'puede '} priorities = {0:'Epica',1:'Alta',2:'Media',3:'Baja'} priorities2 = {i:str(i)for i in range(1,20+1)} priorities2[0] = 'Epica' #Obtenemos primero las epicas y las almacenamos en un arreglo. for hist in userHistoriesList: if oUserHistory.isEpic(hist.UH_idUserHistory): result = oUserHistory.transformUserHistory(hist.UH_idUserHistory) result['code'] = hist.UH_codeUserHistory epics.append(result) #Obtenemos los valores de las historias de usuario y sus pesos. for hist in userHistoriesList: if not oUserHistory.isEpic(hist.UH_idUserHistory): result = oUserHistory.transformUserHistory(hist.UH_idUserHistory) result['code'] = hist.UH_codeUserHistory userHistories.append(result) if projectScaleType == 1: for hist in userHistories: hist['priority'] = priorities[hist['priority']] #--------------------- Secciones del proyecto ----------------------------- section_num = 1 section1 = ". Descripción de la metodología" section2 = ". Descripción General del Método de Desarrollo de Software" section3 = ". Personas y roles del proyecto" section4 = ". Artefactos" #--------------------- Subsecciones del proyecto -------------------------- subsection11 = "1.1 Introducción" subsection12 = "1.2 Propósito de este documento" subsection13 = "1.3 Motivación" subsection14 = "1.4 Estado del Proyecto" subsection15 = "1.5 Alcance" subsection21 = "2.1 Fundamentación" subsection22 = "2.2 Valores del equipo" subsection_num = 2 subsection41 = ".1 Pila del producto" subsection42 = ".2 Objetivos" #------------------ Personas y roles del proyecto ------------------------- teamList = oTeam.getTeam(idProduct) #--------------------- Descripcion de la metodologia ---------------------- introduction = information.VD_introduccion porpose = information.VD_proposito motivation = information.VD_motivacion projectStatus = information.VD_estado scope = information.VD_alcance #-------- Descripción General del Método de Desarrollo del Software ------- groundwork = information.VD_fundamentacion teamworkValues = information.VD_valores #-------------------- Construccion del Documento -------------------------- #========================================================================== #----------------------------- Portada ------------------------------------ story.append(Spacer(0,20)) story.append(Paragraph(projectName + ": " + projectDescription, styles['tittlePage'])) story.append(PageBreak()) #-------------------------- Introduccion ---------------------------------- story.append(Spacer(0,6)) story.append(Paragraph(str(section_num) + section1, styles['tittle'])) story.append(Spacer(0,15)) story.append(Paragraph(subsection11, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(introduction, styles['content'])) #---------------------------- Proposito ----------------------------------- story.append(Spacer(0,15)) story.append(Paragraph(subsection12, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(porpose, styles['content'])) #--------------------------- Motivacion ----------------------------------- story.append(Spacer(0,15)) story.append(Paragraph(subsection13, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(motivation, styles['content'])) #------------------------ Estado del proyecto ----------------------------- story.append(Spacer(0,15)) story.append(Paragraph(subsection14, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(projectStatus, styles['content'])) #------------------------------- Alcance ---------------------------------- story.append(Spacer(0,15)) story.append(Paragraph(subsection15, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(scope, styles['content'])) #---------------------------- Fundamentacion ------------------------------ story.append(Spacer(0,20)) section_num += 1 story.append(Paragraph(str(section_num) + section2, styles['tittle'])) story.append(Spacer(0,15)) story.append(Paragraph(subsection21, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(groundwork, styles['content'])) #------------------------------- Valores ---------------------------------- story.append(Spacer(0,15)) story.append(Paragraph(subsection22, styles['subtittle'])) story.append(Spacer(0,10)) story.append(Paragraph(teamworkValues, styles['content'])) story.append(Spacer(0,20)) #------------------- Personas y Roles del proyecto ------------------------ if teamList != []: section_num += 1 story.append(Paragraph(str(section_num) + section3, styles['tittle'])) story.append(Spacer(0,15)) #Cabecera de la tabla. t1 = Paragraph("Persona", styles['header']) t2 = Paragraph("Contacto", styles['header']) t3 = Paragraph("Rol", styles['header']) tam_colums = [6.3*cm,6.3*cm,4.2*cm] dataTable = [[t1,t2,t3]] t_roles_persons = Table(dataTable,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_roles_persons) #Mostramos los miembros del equipo asociado al producto. for e in teamList: u = oUser.searchUser(e.EQ_username) if e.EQ_rol == "Product owner": dataTable = [[u[0].U_fullname,u[0].U_email,"Dueño del Producto"]] t_roles_persons = Table(dataTable,tam_colums,style=stylesTable1,hAlign='CENTER') story.append(t_roles_persons) for e in teamList: u = oUser.searchUser(e.EQ_username) if e.EQ_rol == "Scrum master": dataTable = [[u[0].U_fullname,u[0].U_email,"Maestro Scrum"]] t_roles_persons = Table(dataTable,tam_colums,style=stylesTable1,hAlign='CENTER') story.append(t_roles_persons) story.append(Spacer(0,20)) dataTable = [[t1,t2,t3]] t_roles_persons = Table(dataTable,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_roles_persons) for e in teamList: u = oUser.searchUser(e.EQ_username) if e.EQ_rol == "Team member": dataTable = [[u[0].U_fullname,u[0].U_email,"Miembro del Equipo"]] t_roles_persons = Table(dataTable,tam_colums,style=stylesTable1,hAlign='CENTER') story.append(t_roles_persons) story.append(Spacer(0,25)) #---------------------------- Pila del producto --------------------------- #Lista donde se almacenara el orden en que fueron mostradas las historias y epicas. historiesListId = [] if userHistories != [] or epics != []: section_num += 1 story.append(Paragraph(str(section_num) + section4, styles['tittle'])) story.append(Spacer(0,10)) story.append(Paragraph(str(section_num) + subsection41, styles['subtittle'])) #Cabecera de la tabla. t1 = Paragraph("ID", styles['header']) t2 = Paragraph("Prioridad", styles['header']) t3 = Paragraph("Épicas e Historias de Usuario", styles['header']) tam_colums = [2.2*cm,2.2*cm,12.4*cm] dataTableHist = [[t1,t2,t3]] t_user_histories = Table(dataTableHist,tam_colums,style=stylesTable2,hAlign='CENTER') story.append(t_user_histories) tam_colums1 = [2.2*cm,14.6*cm] #Mostramos las epicas. for e in epics: #Construimos el enunciado. statement = "En tanto" + e['actors'] + e['actions'] + "para" + e['objectives'] historiesListId.append(e['idHistory']) #Establecemos saltos de linea para que el contenido no se salga de la tabla. statement = insertJumpLine(statement,75) dataTableHist = [[e['code'],statement]] t_user_histories = Table(dataTableHist,tam_colums1,style=stylesTable3,hAlign='CENTER') story.append(t_user_histories) #Eliminamos la epica que ya mostramos. epics.remove(e) #Obtenemos los hijos de la epica y los mostramos asociados a la epica. succesors = oUserHistory.succesors(e['idHistory']) cantSuc = len(succesors) for h in succesors: result = oUserHistory.transformUserHistory(h) result1 = oUserHistory.searchIdUserHistory(h) result['code'] = result1[0].UH_codeUserHistory if projectScaleType == 1: result['priority'] = priorities[result['priority']] #Construimos el enunciado. statement = "En tanto" + result['actors'] + result['actions'] + "para" + result['objectives'] historiesListId.append(result['idHistory']) #Establecemos saltos de linea para que el contenido no se salga de la tabla. statement = insertJumpLine(statement,65) cantSuc -= 1 dataTableHist = [[result['code'], result['priority'],statement]] if cantSuc != 1: t_user_histories = Table(dataTableHist,tam_colums,style=stylesTable4,hAlign='CENTER') else: t_user_histories = Table(dataTableHist,tam_colums,style=stylesTable5,hAlign='CENTER') story.append(t_user_histories) userHistories.remove(result) #Mostramos las historias de usuario que no son parte de una epica. for hist in userHistories: #Construimos el enunciado. statement = "En tanto" + hist['actors'] + hist['actions'] + "para" + hist['objectives'] historiesListId.append(hist['idHistory']) #Establecemos saltos de linea para que el contenido no se salga de la tabla. statement = insertJumpLine(statement,75) dataTableHist = [[hist['code'], hist['priority'],statement]] t_user_histories = Table(dataTableHist,tam_colums,style=stylesTable6,hAlign='CENTER') story.append(t_user_histories) story.append(Spacer(0,25)) #-------------------------------- Objetivos ------------------------------- #Obtenemos todos los objetivos asociados al producto. objsList = oObjective.getAllObjectives(idProduct) if objsList != []: story.append(Paragraph(str(section_num) + subsection42, styles['subtittle'])) #Cabecera de la tabla. t1 = Paragraph("ID", styles['header']) t2 = Paragraph("Objetivo", styles['header']) t3 = Paragraph("ID Historia", styles['header']) tam_colums = [2.2*cm,11.9*cm,2.7*cm] dataTableObj = [[t1,t2,t3]] t_user_obj = Table(dataTableObj,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_user_obj) #Mostramos los objetivos asociados a las historias de usuario. idObj = 0 objectivesListId = [] for h in historiesListId: hist = oUserHistory.searchIdUserHistory(h) code = hist[0].UH_codeUserHistory objs = oObjUserHist.idObjectivesAsociatedToUserHistory(h) for o in objs: obj = oObjective.searchIdObjective(o) desc = obj[0].O_descObjective + "." idObj += 1 objectivesListId.append(o) #Establecemos saltos de linea para que el contenido no se salga de la tabla. desc = insertJumpLine(desc,70) dataTableObj = [[idObj,desc,code]] t_user_obj = Table(dataTableObj,tam_colums,style=stylesTable7,hAlign='CENTER') story.append(t_user_obj) #Mostramos los objetivos transversales y los que no estan asociados a una historia. #Obtenemos solo los ids objsIdList = [] for o in objsList: objsIdList.append(o.O_idObjective) conj1 = set(objsIdList) conj2 = set(objectivesListId) conj = conj1 - conj2 remainObjects = list(conj) for o in remainObjects: obj = oObjective.searchIdObjective(o) desc = obj[0].O_descObjective + "." idObj += 1 #Establecemos saltos de linea para que el contenido no se salga de la tabla. desc = insertJumpLine(desc,70) dataTableObj = [[idObj,desc," "]] t_user_obj = Table(dataTableObj,tam_colums,style=stylesTable7,hAlign='CENTER') story.append(t_user_obj) story.append(Spacer(0,25)) #------------------------------ Pila del sprint --------------------------- #Obtenemos los sprints asociados al producto sprintsList = oSprint.getAllSprintsAsociatedToProduct(idProduct) if sprintsList != []: story.append(Paragraph("4.3 Pila del sprint", styles['subtittle'])) for s in sprintsList: #Cabecera de la tabla. t1 = Paragraph("ID", styles['header']) t2 = Paragraph("Historia de Usuario", styles['header']) t3 = Paragraph("T/E", styles['header']) #Obtenemos las historias asociadas al sprint. userHistoryList = oSprint.getAssignedSprintHistory(s.S_numero,idProduct) if userHistoryList != []: tam_colums = [2.7*cm,12.6*cm,1.5*cm] dataTableSprint = [[t1,t2,t3]] t_user_sprints = Table(dataTableSprint,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_user_sprints) t4 = Paragraph("Sprint " + str(s.S_numero),styles['subtittle']) tam_colums1 = [16.8*cm] tam_row = [0.6*cm] dataTableSprint = [[t4]] t_user_sprints = Table(dataTableSprint,tam_colums1,tam_row,style=stylesTable7,hAlign='CENTER') story.append(t_user_sprints) for uH in userHistoryList: hist = oUserHistory.transformUserHistory(uH.UH_idUserHistory) code = uH.UH_codeUserHistory statement = "En tanto" + hist['actors'] + hist['actions'] + "para" + hist['objectives'] #Establecemos saltos de linea para que el contenido no se salga de la tabla. statement = insertJumpLine(statement,77) estimatedTime = oTask.historyEstimatedTime(uH.UH_idUserHistory) dataTableSprint = [[code,statement, str(estimatedTime) + "h"]] t_user_sprints = Table(dataTableSprint,tam_colums,style=stylesTable7,hAlign='CENTER') story.append(t_user_sprints) #Obtenemos el subequipo del sprint. subTeamList = oSubTeam.getSubEquipo(s.S_idSprint) if subTeamList != []: n = len(subTeamList) memberSubTeam = "" for s in subTeamList: member = s.SEQ_username member = oUser.searchUser(member) member = member[0].U_fullname memberSubTeam += member n -= 1 if n != 0: memberSubTeam += ", " if n == 0: memberSubTeam += "." t5 = Paragraph("Responsables", styles['content']) tam_colums2 = [2.7*cm,14.1*cm] members = insertJumpLine(memberSubTeam,90) dataTableSprint = [[t5,members]] t_user_sprints = Table(dataTableSprint,tam_colums2,style=stylesTable8,hAlign='CENTER') story.append(t_user_sprints) story.append(Spacer(0,5)) story.append(Paragraph("T/E es tiempo estimado.",styles['note'])) story.append(Spacer(0,20)) #--------------------------- Sprint planificado --------------------------- #Obtenemos la lista de desarrolladores de un producto. teamMemberList = oTeam.getTeamDevs(idProduct) if sprintsList != []: story.append(Paragraph("4.4 Sprint planificado", styles['subtittle'])) for s in sprintsList: #Obtenemos las historias asociadas al sprint. userHistoryList = oSprint.getAssignedSprintHistory(s.S_numero,idProduct) #Obtenemos las tareas asociadas a cada sprint. taskList = oSprint.getAssignedSprintTask(s.S_numero,idProduct) if userHistoryList != []: fini = s.S_fechini dayIni = fini.day monthIni = fini.month yearIni = fini.year fchini = str(dayIni) + "/" + str(monthIni) + "/" + str(yearIni) ffin = s.S_fechfin dayFin = ffin.day monthFin = ffin.month yearFin = ffin.year fchfin = str(dayFin) + "/" + str(monthFin) + "/" + str(yearFin) duration = days_between(fini,ffin) #Cabecera de la tabla. t1 = Paragraph("Sprint " + str(s.S_numero), styles['subtittle']) t2 = Paragraph("Duración: " + str(duration) + " d", styles['content']) t3 = Paragraph("Inicio: " + fchini, styles['content']) t4 = Paragraph("Cierre: " + fchfin, styles['content']) tam_colums = [4.8*cm,4*cm,4*cm,4*cm] dataTableSprintPlan = [[t1,t2,t3,t4]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_user_sprintsPlan) t5 = Paragraph("Pila del Sprint", styles['header']) tam_colums1 = [16.8*cm] dataTableSprintPlan = [[t5]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums1,style=stylesTable0,hAlign='CENTER') story.append(t_user_sprintsPlan) t6 = Paragraph("ID", styles['header']) t7 = Paragraph("Tarea", styles['header']) t8 = Paragraph("Categoría", styles['header']) t9 = Paragraph("Estado", styles['header']) t10 = Paragraph("T/E", styles['header']) t11 = Paragraph("Responsable", styles['header']) tam_colums2 = [1.4*cm,6.5*cm,2.9*cm,2*cm,1*cm,3*cm] dataTableSprintPlan = [[t6,t7,t8,t9,t10,t11]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums2,style=stylesTable0,hAlign='CENTER') story.append(t_user_sprintsPlan) for h in userHistoryList: #codigo de la historia histCode = h.UH_codeUserHistory #Obtenemos todas las tareas asociadas a la historia de la que se obtuvo el codigo. taskListCurrent = [] for i in taskList: if h.UH_idUserHistory == i.HW_idUserHistory: taskListCurrent.append(i) if taskListCurrent != []: firstTask = taskListCurrent[0] #Obtenemos el estado de la realizacion de la tarea. statusCompleted = taskListCurrent[0].HW_completed statusInitiated = taskListCurrent[0].HW_iniciado status = '' if statusCompleted: status = "Culminada" elif not statusCompleted and statusInitiated: status = "Iniciada" else: status = "Por iniciar" #Buscamos la categoria asiciada a la tarea cat = oCategory.searchIdCategory(taskListCurrent[0].HW_idCategory) cat = cat[0].C_nameCate cat = insertJumpLine(cat,13) #Obtenemos el tiempo estimado de la tarea. estimatedTime = taskListCurrent[0].HW_estimatedTime #Obtenemos el miembro encargado de la tarea. memberAssigned = '' for i in teamMemberList: if i.EQ_idEquipo == taskListCurrent[0].HW_idEquipo: memberAssigned = oUser.searchUser(i.EQ_username) memberAssigned = memberAssigned[0].U_fullname memberAssigned = insertJumpLine(memberAssigned,17) descTask = taskListCurrent[0].HW_description descTask = insertJumpLine(descTask,35) dataTableSprintPlan = [[histCode,descTask,cat,status,estimatedTime,memberAssigned]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums2,style=stylesTable9,hAlign='CENTER') story.append(t_user_sprintsPlan) n = len(taskListCurrent) for t in range(1,n): statusCompleted = taskListCurrent[t].HW_completed statusInitiated = taskListCurrent[t].HW_iniciado status = '' if statusCompleted: status = "Culminada" elif not statusCompleted and statusInitiated: status = "Iniciada" else: status = "Por iniciar" #Buscamos la categoria asiciada a la tarea cat = oCategory.searchIdCategory(taskListCurrent[t].HW_idCategory) cat = cat[0].C_nameCate cat = insertJumpLine(cat,13) estimatedTime = taskListCurrent[t].HW_estimatedTime #Obtenemos el miembro asignado al desarrollo de la tarea. teamMemberList = oTeam.getTeamDevs(idProduct) memberAssigned = '' for i in teamMemberList: if i.EQ_idEquipo == taskListCurrent[t].HW_idEquipo: memberAssigned = oUser.searchUser(i.EQ_username) memberAssigned = memberAssigned[0].U_fullname memberAssigned = insertJumpLine(memberAssigned,17) descTask = taskListCurrent[t].HW_description descTask = insertJumpLine(descTask,35) dataTableSprintPlan = [["",descTask,cat,status,estimatedTime,memberAssigned]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums2,style=stylesTable10,hAlign='CENTER') story.append(t_user_sprintsPlan) num = insertJumpLine(str(oSprint.getEstimatedTime(s.S_numero,idProduct)),4) t12 = Paragraph("Total de Tiempo Estimado", styles['header']) t13 = Paragraph(num, styles['header']) tam_colums3 = [12.8*cm,4*cm] dataTableSprintPlan = [[t12,t13]] t_user_sprintsPlan = Table(dataTableSprintPlan,tam_colums3,style=stylesTable1,hAlign='CENTER') story.append(t_user_sprintsPlan) story.append(Spacer(0,20)) #------------------------------- Entregables ------------------------------ if sprintsList != []: story.append(Paragraph("4.5 Entregables", styles['subtittle'])) story.append(Spacer(0,15)) #------------------------ Criterios de Aceptacion ------------------------- if sprintsList != []: story.append(Paragraph("4.5.1 Criterios de Aceptación de los Entregables", styles['subtittle'])) story.append(Spacer(0,10)) idAceptanceCriteria = 1 for s in sprintsList: if oACriteria.aceptanceCriteriaEmpty(s.S_idSprint) != []: #Obtenemos las historias asociadas al sprint. userHistoryList = oSprint.getAssignedSprintHistory(s.S_numero,idProduct) if userHistoryList != []: t1 = Paragraph("ID", styles['header']) t2 = Paragraph("Productos", styles['header']) t3 = Paragraph("ID Historias", styles['header']) tam_colums = [2*cm,10.8*cm,4*cm] dataTableAcceptanCriteria = [[t1,t2,t3]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums,style=stylesTable0,hAlign='CENTER') story.append(t_user_acceptanCriteria) t4 = Paragraph("Sprint " + str(s.S_numero),styles['subtittle']) tam_colums1 = [16.8*cm] dataTableAcceptanCriteria = [[t4]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable0,hAlign='CENTER') story.append(t_user_acceptanCriteria) #Obtenemos primero las epicas y las almacenamos en un arreglo. epics = [] for hist in userHistoryList: if oUserHistory.isEpic(hist.UH_idUserHistory): result = oUserHistory.transformUserHistory(hist.UH_idUserHistory) result['code'] = hist.UH_codeUserHistory epics.append(result) #Obtenemos los valores de las historias de usuario. userHistories = [] for hist in userHistoryList: if not oUserHistory.isEpic(hist.UH_idUserHistory): result = oUserHistory.transformUserHistory(hist.UH_idUserHistory) result['code'] = hist.UH_codeUserHistory userHistories.append(result) n = len(epics) #Mostramos las epicas. for e in epics: #Obtenemos los criterios de aceptacion asociados a la epica. aceptanceCriteriaList = oACriteria.getAceptanceCriteriaByHistoryAndSprint(e['idHistory'],s.S_idSprint) if aceptanceCriteriaList != []: #Construimos el enunciado statement = "En tanto" + e['actors'] + e['actions'] + "para" + e['objectives'] statement = insertJumpLine(statement,67) codes = e['code'] sucessors = oUserHistory.succesors(e['idHistory']) #Obtenemos las historias hijas. for i in sucessors: result = oUserHistory.searchIdUserHistory(i) result = result[0].UH_codeUserHistory codes += ", " + result dataTableAcceptanCriteria = [[idAceptanceCriteria,statement,codes]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums,style=stylesTable9,hAlign='CENTER') story.append(t_user_acceptanCriteria) idAceptanceCriteria += 1 t5 = Paragraph("Criterios de aceptación:",styles['subtittle']) tam_colums1 = [2*cm,14.8*cm] dataTableAcceptanCriteria = [["",t5]] if n > 0: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') else: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable1,hAlign='CENTER') n -= 1 story.append(t_user_acceptanCriteria) #Mostramos los criterios de aceptacion. for c in aceptanceCriteriaList: criteria = c.HAC_enunciado criteria = insertJumpLine(criteria,80) dataTableAcceptanCriteria = [["",criteria]] if n > 0: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') else: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable11,hAlign='CENTER') print(codes,n,criteria) n -= 1 story.append(t_user_acceptanCriteria) statement = '' n = len(sucessors) #Mostramos las historias hijas. for suc in sucessors: #Obtenemos los criterios de aceptacion asociados a la historia. aceptanceCriteriaList = oACriteria.getAceptanceCriteriaByHistoryAndSprint(suc,s.S_idSprint) if aceptanceCriteriaList != []: for h in userHistories: if suc == h['idHistory']: #Construimos el enunciado statement = "En tanto" + h['actors'] + h['actions'] + "para" + h['objectives'] statement = insertJumpLine(statement,67) code = h['code'] dataTableAcceptanCriteria = [[idAceptanceCriteria,statement,code]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums,style=stylesTable9,hAlign='CENTER') story.append(t_user_acceptanCriteria) idAceptanceCriteria += 1 userHistories.remove(h) t5 = Paragraph("Criterios de aceptación:",styles['subtittle']) tam_colums1 = [2*cm,14.8*cm] dataTableAcceptanCriteria = [["",t5]] if n > 0: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') else: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable11,hAlign='CENTER') story.append(t_user_acceptanCriteria) #Mostramos los criterios de aceptacion. for c in aceptanceCriteriaList: criteria = c.HAC_enunciado criteria = insertJumpLine(criteria,80) dataTableAcceptanCriteria = [["",criteria]] if n > 0: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') else: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable11,hAlign='CENTER') n -= 1 print(code,n,criteria) story.append(t_user_acceptanCriteria) n = len(userHistories) #Mostramos las historias que no pertenenecen a ninguna epica. for h in userHistories: #Obtenemos los criterios de aceptacion asociados a la epica. aceptanceCriteriaList = oACriteria.getAceptanceCriteriaByHistoryAndSprint(h['idHistory'],s.S_idSprint) if aceptanceCriteriaList != []: #Construimos el enunciado statement = "En tanto" + h['actors'] + h['actions'] + "para" + h['objectives'] statement = insertJumpLine(statement,67) code = h['code'] dataTableAcceptanCriteria = [[idAceptanceCriteria,statement,code]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums,style=stylesTable9,hAlign='CENTER') story.append(t_user_acceptanCriteria) idAceptanceCriteria += 1 t5 = Paragraph("Criterios de aceptación:",styles['subtittle']) tam_colums1 = [2*cm,14.8*cm] dataTableAcceptanCriteria = [["",t5]] t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') story.append(t_user_acceptanCriteria) #Mostramos los criterios de aceptacion. for c in aceptanceCriteriaList: criteria = c.HAC_enunciado criteria = insertJumpLine(criteria,80) dataTableAcceptanCriteria = [["",criteria]] if n > 0: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable10,hAlign='CENTER') else: t_user_acceptanCriteria = Table(dataTableAcceptanCriteria,tam_colums1,style=stylesTable11,hAlign='CENTER') n -= 1 print(code,n,criteria) story.append(t_user_acceptanCriteria) story.append(Spacer(0,20)) #------------------------ Pruebas de Aceptacion ------------------------- if sprintsList != []: story.append(Paragraph("4.5.2 Pruebas de Aceptación de los Entregables", styles['subtittle'])) story.append(Spacer(0,10)) idTestCriteria = 1 #for s in sprintsList: #Obtenemos las pruebas de aceptacion almacenadas por historia. # if True: #Obtenemos las historias asociadas al sprint. # userHistoryList = oSprint.getAssignedSprintHistory(s.S_numero,idProduct) # if userHistoryList != []: # oTCriteria.getAllAcceptanceTestByUserHistory #--------------------------- Estructura Documento ------------------------- #========================================================================== #Frame que contendrá el contenido de una hoja. frame_page = Frame(78, 50, width - 166, 697, id="page") #Creamos el pageTemplates para header y footer. Le asignamos los frames y los canvas. PT_structure = PageTemplate(id='structure', frames=[frame_page], onPage=header, onPageEnd=footer) #Definimos el documento y de tamano carta. Creamos el DocTamplate a partir #del BaseDocTemplate. document = BaseDocTemplate(documentName,pageSize=letter, pageTemplates=[PT_structure], tittle="Documento-Vision", author="APMwSc") #Construimos el PDF document.build(story) return respond
def test_casos_prueba(self): driver = self.driver # Eliminamos los datos de prueba introducidos oBacklog = backlog() oUser = user() oActor = role() oAccion = accions() oObjective = objective() oHistory = userHistory() oCategory = category() result = oUser.deleteUser('usuario') result = oBacklog.deleteProduct('Producto 1') result = oCategory.deleteCategory('Categoria1') # Casos de prueba para registrar un usuario en la aplicacion. driver.get(self.base_url + "/#/VRegistro") driver.find_element_by_id("fUsuario_nombre").clear() driver.find_element_by_id("fUsuario_nombre").send_keys("Usuario Prueba") driver.find_element_by_id("fUsuario_usuario").clear() driver.find_element_by_id("fUsuario_usuario").send_keys("usuario") driver.find_element_by_id("fUsuario_clave").clear() driver.find_element_by_id("fUsuario_clave").send_keys("1234.ABC") driver.find_element_by_id("fUsuario_clave2").clear() driver.find_element_by_id("fUsuario_clave2").send_keys("1234.ABC") driver.find_element_by_id("fUsuario_correo").clear() driver.find_element_by_id("fUsuario_correo").send_keys("*****@*****.**") Select(driver.find_element_by_id("fUsuario_actorScrum")).select_by_visible_text("Dueño de producto") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Casos de prueba para el inicio de sesion de un usuario. driver.find_element_by_id("fLogin_usuario").clear() driver.find_element_by_id("fLogin_usuario").send_keys("usuario") driver.find_element_by_id("fLogin_clave").clear() driver.find_element_by_id("fLogin_clave").send_keys("1234.ABC") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso de prueba para Crear categorias driver.find_element_by_link_text(u"Categorías de tareas").click() driver.find_element_by_id("fCategoria_nombre").clear() driver.find_element_by_id("fCategoria_nombre").send_keys("Categoria1") driver.find_element_by_id("fCategoria_peso").clear() driver.find_element_by_id("fCategoria_peso").send_keys("2") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(3) driver.find_element_by_xpath("(//a[contains(text(),'Regresar')])").click() sleep(2) # Casos de prueba para agregar Producto driver.find_element_by_link_text("+Producto").click() driver.find_element_by_id("fPila_nombre").clear() driver.find_element_by_id("fPila_nombre").send_keys("Producto 1") driver.find_element_by_id("fPila_descripcion").clear() driver.find_element_by_id("fPila_descripcion").send_keys("Nuevo Producto") Select(driver.find_element_by_id("fPila_escala")).select_by_visible_text("Alta/Media/Baja") sleep(3) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Casos de prueba ver datos de un producto. sleep(2) driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[3]").click() sleep(2) # Caso de prueba para crear un actor. driver.find_element_by_link_text("+Actor").click() driver.find_element_by_id("fActor_nombre").clear() driver.find_element_by_id("fActor_nombre").send_keys("Actor1") sleep(3) driver.find_element_by_id("taTextElement").send_keys("Actor nuevo") driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso de prueba para ver el actor. driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[1]").click() sleep(3) # Caso de prueba para modificar el actor. driver.find_element_by_id("taTextElement").clear() driver.find_element_by_id("taTextElement").send_keys("Nuevo actor 1") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(1) # Caso de prueba para crear una accion. sleep(3) driver.find_element_by_link_text("+Accion").click() driver.find_element_by_id("fAccion_descripcion").clear() driver.find_element_by_id("fAccion_descripcion").send_keys("Accion") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso de prueba para ver la accion. driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[2]").click() sleep(3) # Caso de prueba para modificar la accion. driver.find_element_by_id("fAccion_descripcion").clear() driver.find_element_by_id("fAccion_descripcion").send_keys("Accion 1") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso de prueba para crear un objetivo. driver.find_element_by_link_text("+Objetivo").click() driver.find_element_by_id("fObjetivo_descripcion").clear() driver.find_element_by_id("fObjetivo_descripcion").send_keys("Objetivo2") sleep(2) Select(driver.find_element_by_id("fObjetivo_transversal")).select_by_visible_text("No") driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso de prueba para ver el Objetivo driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[3]").click() sleep(3) # Caso de prueba para modificar el objetivo. driver.find_element_by_id("fObjetivo_descripcion").clear() driver.find_element_by_id("fObjetivo_descripcion").send_keys("Objetivo1") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso para agregar Historia_Epica driver.find_element_by_link_text("Historias").click() sleep(2) driver.find_element_by_link_text("Crear").click() sleep(1) driver.find_element_by_id("fHistoria_codigo").clear() driver.find_element_by_id("fHistoria_codigo").send_keys("H1") sleep(1) Select(driver.find_element_by_id("fHistoria_actores")).select_by_visible_text("Actor1") sleep(1) Select(driver.find_element_by_id("fHistoria_tipo")).select_by_visible_text("Opcional") sleep(1) Select(driver.find_element_by_id("fHistoria_accion")).select_by_visible_text("Accion 1") sleep(1) Select(driver.find_element_by_id("fHistoria_objetivos")).select_by_visible_text("Objetivo1") sleep(1) Select(driver.find_element_by_id("fHistoria_prioridad")).select_by_visible_text("Alta") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso para modificar historia driver.find_element_by_link_text("Detalles").click() Select(driver.find_element_by_id("fHistoria_tipo")).select_by_visible_text("Obligatoria") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Creamos Historia driver.find_element_by_link_text("Crear").click() sleep(2) driver.find_element_by_id("fHistoria_codigo").clear() driver.find_element_by_id("fHistoria_codigo").send_keys("H2") sleep(1) Select(driver.find_element_by_id("fHistoria_super")).select_by_visible_text("H1") sleep(1) Select(driver.find_element_by_id("fHistoria_actores")).select_by_visible_text("Actor1") sleep(1) Select(driver.find_element_by_id("fHistoria_tipo")).select_by_visible_text("Obligatoria") sleep(1) Select(driver.find_element_by_id("fHistoria_accion")).select_by_visible_text("Accion 1") sleep(1) Select(driver.find_element_by_id("fHistoria_objetivos")).select_by_visible_text("Objetivo1") sleep(1) Select(driver.find_element_by_id("fHistoria_prioridad")).select_by_visible_text("Alta") sleep(1) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(3) # Caso para agregar tarea a una historia driver.find_element_by_xpath("(//a[contains(text(),'Detalles')])[2]").click() sleep(1) driver.find_element_by_link_text("+Tarea").click() sleep(1) driver.find_element_by_id("fTarea_descripcion").clear() driver.find_element_by_id("fTarea_descripcion").send_keys("Tarea1") Select(driver.find_element_by_id("fTarea_categoria")).select_by_visible_text("Categoria1 (2)") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Caso que modifica una tarea driver.find_element_by_link_text("Detalles").click() driver.find_element_by_id("fTarea_peso").clear() driver.find_element_by_id("fTarea_peso").send_keys("3") driver.find_element_by_id("fTarea_peso").click() driver.find_element_by_id("fTarea_descripcion").clear() driver.find_element_by_id("fTarea_descripcion").send_keys("Nueva tarea") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) driver.find_element_by_xpath("(//a[contains(text(),'Regresar')])").click() sleep(2) # Caso Eliminar Tarea driver.find_element_by_xpath("(//a[contains(text(),'Detalles')])[2]").click() sleep(2) driver.find_element_by_link_text("Detalles").click() sleep(2) driver.find_element_by_link_text("-Tarea").click() sleep(3) driver.find_element_by_xpath("(//a[contains(text(),'Regresar')])").click() sleep(2) # Caso Cambiar Prioridades driver.find_element_by_link_text("Cambiar prioridades").click() Select(driver.find_element_by_id("fPrioridades_prioridad")).select_by_visible_text("Baja") sleep(2) driver.find_element_by_xpath("//button[@type='submit']").click() sleep(2) # Eliminar Historia driver.find_element_by_xpath("(//a[contains(text(),'Detalles')])[2]").click() sleep(2) driver.find_element_by_link_text("-Historia").click() sleep(2) # Eliminar Historia driver.find_element_by_xpath("(//a[contains(text(),'Detalles')])[1]").click() sleep(2) driver.find_element_by_link_text("-Historia").click() sleep(2) # Regresamos a la vista de producto driver.find_element_by_xpath("(//a[contains(text(),'Regresar')])").click() sleep(2) # ver el objetivo driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[3]").click() sleep(3) # Caso de prueba para eliminar el objetivo driver.find_element_by_link_text("-Objetivo").click() sleep(2) # Ver accion driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[2]").click() sleep(3) # Caso de prueba para eliminar accion driver.find_element_by_link_text("-Accion").click() sleep(2) # Ver actor driver.find_element_by_xpath("(//a[contains(text(),'Ver')])[1]").click() sleep(3) # Caso de prueba para eliminar acctor driver.find_element_by_link_text("-Actor").click() sleep(2) # Caso de Prueba Salir driver.find_element_by_link_text("Salir").click() sleep(2) result = oBacklog.deleteProduct('Producto 1')