ia-tecnicas de pruebas
DESCRIPTION
Pruebas de softwareTRANSCRIPT
![Page 1: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/1.jpg)
Técnicas de PruebasEjemplos prácticos
![Page 2: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/2.jpg)
Contenidos
n Partición de Equivalencias y Análisis de Valores Límite
n Prueba Estructural
![Page 3: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/3.jpg)
Partición de equivalencias y Análisis de valores límite
Ie
Input test data
OeOutput test results
System
Inputs causinganomalousbehaviour
Outputs which revealthe presence ofdefects
![Page 4: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/4.jpg)
Partición de equivalencias y Análisis de valores límite
n De caja negran Los datos de entrada y de salida de un
programa normalmente pertenecen a diferentes clases
n Cada clase es un conjunto de valores en donde el programa se comporta de manera similar para cada elemento de dicho conjunto --> Partición equivalente
n Los casos de pruebas deberían ser elegidos desde cada partición
n Los datos de prueba se deben tomar en los límites de cada partición y en algún valor no límite
![Page 5: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/5.jpg)
Partición de equivalencias y Análisis de valores límite
Pasos:1. Para cada entrada y cada
salida, determinar las clases de equivalencias
2. Para cada clase de equivalencia, seleccionar los valores que se encuentran en los límites de las mismas y uno no en el límiteEj.: clase (0..100) èprobar –1, 0, 1, 50, 99, 100 y 101
3. Ejecutar la prueba
![Page 6: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/6.jpg)
Partición de equivalencias y Análisis de valores límite
Reglas prácticas. Si la entrada es un
uRango èFUna clase válida (valores en el
rango)FDos clases inválidas (valores
inferiores y superiores al rango)
uMiembro de un conjunto èFUna clase válida (el conjunto)FUna inválida (el complemento)
![Page 7: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/7.jpg)
Partición de equivalencias y Análisis de valores límite
Reglas prácticas. Si la entrada es un
uValor específico èFUna válida (el valor específico)FDos inválidas (valores menores y
mayores al valor específico)
![Page 8: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/8.jpg)
Partición de equivalencias y Análisis de valores límite
Reglas prácticas. Si la entrada es un
uValor numéricoFUna clase válidaFDos clases inválidas
uValor booleanoèFUna clase válidaFUna clase inválida
![Page 9: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/9.jpg)
Partición de equivalencias y Análisis de valores límite
Reglas prácticas. Si la entrada es un
uValor tipo stringèFValor:
• Una clase válida• Una clase inválida
FLongitud:• Una clase válida• Dos clases inválidas
uValor tipo charFUna clase válidaFUna clase inválida
![Page 10: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/10.jpg)
Partición de equivalencias y Análisis de valores límite
Reglas prácticas. Si la entrada es un
uValor tipo arrayèFValor:
• Depende del tipo de variable que almacene el array
FLongitud• Una clase válida• Dos clases inválidas
![Page 11: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/11.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
Función de cáluclo del seno de un ánguloentero entre 0 y 360º.
Precisión de salida: 3 decimales.
uEntrada: número enterouSalida: número real
1. Si entrada >= 0 y <= 360, se debedevolver el resultado
2. Si la entrada < 0 o >360, se debemostrar el mensaje “Error“
![Page 12: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/12.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
Entrada à variable numérican Clase válida: 0 <= entrada <= 360
u Probar: 0, 1, 180, 359 y 360n Clase inválida 1: entrada < 0
u Probar: -1n Clase inválida 2: entrada > 360
u Probar: 361
Salida à variable numérican Clase válida: -1 <= salida <= 1
u Probar: -1, -0.999, 0, 0.999, 1n Clase inválida 1: entrada < -1
u Probar: -1.001Clase inválida 2: entrada > 1u Probar: 1.001
![Page 13: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/13.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
V 0 - 0,000V 1 - 0,017V 180 - 0,000V 359 - -0,017V 360 - 0,000I -1 - "Error"I 361 - "Error"- 270 V -1,000- 272 V -0,999- 0 V 0,000- 88 V 0,999- 90 V 1,000- - I -1,001
"Error"- - I 1,001
"Error"
Resultado de la Prueba
Entrada 1 Salida Res.Esperado
Pasó / Falló
Resultado obtenido
![Page 14: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/14.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
V 0 - 0,000V 1 - 0,017V 180 - 0,000V 359 - -0,017V 360 - 0,000I -1 - "Error"I 361 - "Error"- 270 V -1,000- 272 V -0,999- 0 V 0,000- 88 V 0,999- 90 V 1,000- - I -1,001
"Error"- - I 1,001
"Error"
Resultado de la Prueba
Entrada 1 Salida Res.Esperado
Pasó / Falló
Resultado obtenido
![Page 15: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/15.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
V 0 - 0,000V 1 - 0,017V 180 - 0,000V 359 - -0,017V 360 - 0,000I -1 - "Error"I 361 - "Error"- 270 V -1,000- 272 V -0,999- 88 V 0,999- 90 V 1,000- - I -1,001
"Error"- - I 1,001
"Error"
Resultado de la Prueba
Entrada 1 Salida Res.Esperado
Pasó / Falló
Resultado obtenido
![Page 16: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/16.jpg)
Partición de equivalencias y Análisis de valores límite. Ejemplo
V 0 - 0,000 0,000 PasóV 1 - 0,017 0,017 PasóV 180 - 0,000 0,000 PasóV 359 - -0,017 -0,017 PasóV 360 - 0,000 0,000 PasóI -1 - "Error" "Error" PasóI 361 - "Error" "Error" Pasó- 270 V -1,000 -1,000 Pasó- 272 V -0,999 -0,999 Pasó- 88 V 0,999 0,999 Pasó- 90 V 1,000 1,000 Pasó
Resultado de la Prueba Pasó
Entrada 1 Salida Res.Esperado
Pasó / Falló
Resultado obtenido
![Page 17: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/17.jpg)
Prueba Estructural
n De caja blancan Se derivan casos de pruebas a
partir de la estructura del programan Se deben ejercitar todas las
instrucciones del programan Utiliza la medida de complejidad
ciclomática para identificar la cantidad de casos de pruebas
![Page 18: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/18.jpg)
Prueba Estructuraln Pasos:
1. Examinar el módulo de software a probar
2. Derivar el grafo de flujo de control y calcular la complejidad ciclomática
3. Seleccionar un conjunto de caminos básicos a probar (método de línea base)
4. Determinar los datos de entrada que van a ejercitar cada camino
5. Ejecutar la prueba
![Page 19: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/19.jpg)
Prueba Estructural. Ejemplo. Paso 11 N0 main()2 {3 FILE *cfPtr;4 struct clientData client;
5 N1 if ((cfPtr = fOpen("credit.dat", "r")) == NULL)6 N2 printf("File could not be opened. \n");7 N3 else {8 N4 printf(%-6s%-25s%10s\n", "Acct", "Name", "Balance");
9 N5 while (!eof(cfPtr)) {10 N6 fread(&client, sizeof(struct clientData), 1, cfPtr);
11 N7 if (client.balance > 0)12 N8 printf("%-6d%-25s%10,2f\n",
client.acctNum, client.Name, client.balance);13 N9 }14 N10 }
15 N11 fclose(cfPtr);
16 N12 }
![Page 20: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/20.jpg)
1 N0 main()2 {3 FILE *cfPtr;4 struct clientData client;
5 N1 if ((cfPtr = fOpen("credit.dat", "r")) == NULL)6 N2 printf("File could not be opened. \n");7 N3 else {8 N4 printf(%-6s%-25s%10s\n", "Acct", "Name", "Balance");
9 N5 while (!eof(cfPtr)) {10 N6 fread(&client, sizeof(struct clientData), 1, cfPtr);
11 N7 if (client.balance > 0)12 N8 printf("%-6d%-25s%10,2f\n",
client.acctNum, client.Name, client.balance);13 N9 }14 N10 }
15 N11 fclose(cfPtr);
16 N12 }
Prueba Estructural. Ejemplo. Paso 2N0
N1
N3 N2
N4
N5
N6
N7
N8
N9
N10
N11
N12
![Page 21: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/21.jpg)
1 N0 main()2 {3 FILE *cfPtr;4 struct clientData client;
5 N1 if ((cfPtr = fOpen("credit.dat", "r")) == NULL)6 N2 printf("File could not be opened. \n");7 N3 else {8 printf(%-6s%-25s%10s\n", "Acct", "Name", "Balance");
9 N5 while (!eof(cfPtr)) {10 fread(&client, sizeof(struct clientData), 1, cfPtr);
11 N7 if (client.balance > 0)12 N8 printf("%-6d%-25s%10,2f\n",
client.acctNum, client.Name, client.balance);13 N9 }14 N10 }
15 fclose(cfPtr);
16 N12 }
Prueba Estructural. Ejemplo. Paso 2N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
![Page 22: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/22.jpg)
Prueba Estructural. Ejemplo. Paso 2
V(G) = 4
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
![Page 23: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/23.jpg)
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
Prueba Estructural. Ejemplo. Paso 3
TRUEFALSE
TRUEFALSE
FALSETRUE
V(G) = 4
4 caminos a probar
![Page 24: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/24.jpg)
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
Prueba Estructural. Ejemplo. Paso 3
FALSE
TRUE
TRUE
Camino 1 (baseline):N0, N1, N3, N5, N7, N8, N9, N5, N10, N12
5(N1): if ((cfPtr = fOpen("credit.dat", "r")) == NULL) è FALSE
9(N5): while (!eof(cfPtr)) è TRUE
11(N7): if (client.balance > 0) è TRUE
9(N5): while (!eof(cfPtr)) è FALSE
Probar con:
FALSE
1 Gómez, Javier 100credit.dat
![Page 25: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/25.jpg)
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
Prueba Estructural. Ejemplo. Paso 3Camino 2:N0, N1, N2, N10, N12
5(N1): if ((cfPtr = fOpen("credit.dat", "r")) == NULL) è TRUE
Probar con:
Archivo inexistente
TRUE
![Page 26: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/26.jpg)
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
Prueba Estructural. Ejemplo. Paso 3
FALSE
FALSE
Camino 3:N0, N1, N3, N5, N10, N12
5(N1): if ((cfPtr = fOpen("credit.dat", "r")) == NULL) è FALSE
9(N5): while (!eof(cfPtr)) è FALSE
Probar con:
credit.dat
![Page 27: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/27.jpg)
N0
N1
N2
N5
N7
N8
N9
N10N10
N3
N12
Prueba Estructural. Ejemplo. Paso 3
FALSE
FALSE
TRUE
Camino 4:N0, N1, N3, N5, N7, N9, N5, N10, N12
5(N1): if ((cfPtr = fOpen("credit.dat", "r")) == NULL) è FALSE
9(N5): while (!eof(cfPtr)) è TRUE
11(N7): if (client.balance > 0) è FALSE
9(N5): while (!eof(cfPtr)) è FALSE
Probar con:
FALSE
2 Morales, Sergio -200credit.dat
![Page 28: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/28.jpg)
Prueba Estructural. Ejemplo. Paso 4
Camino Entrada (Archivo)1 1|Gómez, Javier|100 "Acct Balance"Name Balance"
" 1 Gómez, Javier 100"2 Archivo inexistente "File could not be opened."3 Archivo sin datos "Acct Balance"Name Balance"4 2|Morales, Sergio|-200 "Acct Balance"Name Balance"
Resultado Esperado
![Page 29: IA-Tecnicas de Pruebas](https://reader033.vdocuments.co/reader033/viewer/2022052513/577c85c41a28abe054be6905/html5/thumbnails/29.jpg)
Prueba Estructural. Ejemplo. Paso 5
CaminoPasó / Falló
1 "Acct Name Balance" Pasó" 1 Gómez, Javier 100"
2 "File could not be opened." Pasó3 "Acct Name Balance" Pasó4 "Acct Name Balance" Pasó
Pasó
Resultado Obtenido
Resultado de la prueba