Iván Chillón
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # ETS-UT3-A2. Casos de prueba con prueba del camino básico ## Elementos curriculares Resultado de aprendizaje: 3. Verifica el funcionamiento de programas, diseñando y realizando pruebas. Criterios de evaluación: 3.a. Se han identificado los diferentes tipos de pruebas. 3.b. Se han definido casos de prueba. Contenidos: * Planificación de Pruebas. * Procedimientos y casos de prueba. * Pruebas de código: cubrimiento, valores límite, clases de equivalencia, etc. * Pruebas unitarias; herramientas. ## Actividad 1. Mayores de edad Obtener los casos de prueba de un programa en el que se pida primero la cantidad de datos de alumnos a leer. Si el número es 0 o negativo se mostrará un mensaje de error y se volverá a leer dicho número. Luego, para cada uno de ellos, se leerá el nombre, la edad y el curso de los mismos. Al finalizar el programa mostrará cuantos alumnos son mayores de edad y cuantos son menores de edad. Deberás entregar un programa en el que se detallen los siguientes pasos: **1. Programa en Python que realice el algoritmo solicitado** ```python n = int(input("Número de alumnmos a leer: ")) while n <= 0: print("Número debe ser > 0") n = int(input("Número de alumnmos a leer: ")) i = n_mayores = 0 while i < n: nombre = input("Nombre: ") edad = int(input("Edad: ")) curso = input("Curso: ") if edad >= 18: n_mayores += 1 i += 1 print(f"Mayores de edad: {n_mayores}, menores {n - n_mayores}") ``` **2. Diagrama de flujo del programa** ```flow op2=>operation: n = int(input('Número de alumnmos a leer: ')) cond5=>condition: while (n <= 0) sub14=>subroutine: print('Número debe ser > 0') op16=>operation: n = int(input('Número de alumnmos a leer: ')) op20=>operation: i = n_mayores = 0 cond23=>condition: while (i < n) op48=>operation: nombre = input('Nombre: ') op50=>operation: edad = int(input('Edad: ')) op52=>operation: curso = input('Curso: ') op54=>operation: i += 1 cond57=>condition: if (edad >= 18) op61=>operation: n_mayores += 1 op65=>operation: pass sub70=>subroutine: print(f'Mayores de edad: {n_mayores}, menores {(n - n_mayores)}') op2->cond5 cond5(yes)->sub14 sub14->op16 op16(left)->cond5 cond5(no)->op20 op20->cond23 cond23(yes)->op48 op48->op50 op50->op52 op52->op54 op54->cond57 cond57(yes)->op61 op61->cond23 cond57(no)->op65 op65->cond23 cond23(no)->sub70 ``` **3. Grafo de flujo del programa** ![](https://i.imgur.com/qkaXgf3.png) ![](https://i.imgur.com/JLgKmPZ.png) **4. Cálculo de la complejidad ciclomática del algoritmo usando los tres métodos posibles** Tres formas alternativas: * V(G) = R -> V(G) = 4 * V(G) = A - N + 2 = 13 - 11 + 2 = 4 * V(G) = P + 1 = 3 + 1 = 4 **5. Caminos independientes con longitudes de mayor a menor** I-1-2-3-2-4-5-6-7-8-5-9-F I-1-2-4-5-6-**7-5**-8-F I-1-2-4-5-9-F **6. Tabla con casos de prueba** | Camino | Entrada | Prueba | Salida | | ------ | ------- | ------ | ------ | | | | | | | | | | | ## Actividad 2. Salario semanal Obtener los casos de prueba de una función que calcule el salario semanal de un trabajador teniendo en cuenta que: * La función recibe como parámetro el precio por hora y el número de horas que ha trabajado a la semana. La función devuelve el salario semanal. * Para hacer el cálculo se tiene en cuenta que: * Hasta 40 horas trabajadas se pagan al precio base. * Las primeras 8 horas extras se pagan al doble * Las horas extras que pasen de 8 se pagan al triple ```python def salario(precio_hora, horas): total = 0 if horas <= 40: total = horas * precio_hora elif horas <= 48: horas_extra = horas - 40 total = 40 * precio_hora + 2 * precio_hora * horas_extra else: horas_extra_triple = horas - 48 total = 40 * precio_hora + 2 * precio_hora * 8 + 3 * precio_hora * horas_extra_triple return total ``` ` Elaborar e insertar: **2. Diagrama de flujo del programa** ```flow st3=>start: start salario io5=>inputoutput: input: precio_hora, horas op8=>operation: total = 0 cond11=>condition: if (horas <= 40) op15=>operation: total = (horas * precio_hora) io39=>inputoutput: output: total e37=>end: end function return cond20=>condition: if (horas <= 48) op24=>operation: horas_extra = (horas - 40) op26=>operation: total = ((40 * precio_hora) + ((2 * precio_hora) * horas_extra)) op30=>operation: horas_extra_triple = (horas - 48) op32=>operation: total = (((40 * precio_hora) + ((2 * precio_hora) * 8)) + ((3 * precio_hora) * horas_extra_triple)) st3->io5 io5->op8 op8->cond11 cond11(yes)->op15 op15->io39 io39->e37 cond11(no)->cond20 cond20(yes)->op24 op24->op26 op26->io39 cond20(no)->op30 op30->op32 op32->io39 ``` **3. Grafo de flujo del programa** ![](https://i.imgur.com/ezQeDc8.png) ![](https://i.imgur.com/OmqDocb.png) **4. Cálculo de la complejidad ciclomática del algoritmo usando los tres métodos posibles** * V(G) = R = 3 * V(G) = A - N + 2 = 9 - 8 + 2 = 3 * V(G) = P + 1 = 2 + 1 = 3 **5. Caminos independientes con longitudes de mayor a menor** I-1-2-5-4-F I-1-2-5-6-F I-1-2-3-F **6. Tabla con casos de prueba** | Camino | Entrada | Prueba | Salida | | ----------- | ----------------------------------------- | ------------------------ | ------ | | I-1-2-5-4-F | horas <= 40 ->False, horas <= 48 = False | p_hora = 2, n_horas = 49 | 118 | | I-1-2-5-6-F | horas <= 40 ->False, horas <= 48 = True | p_hora = 3, n_horas = 47 | 162 | | I-1-2-3-F | horas <= 40 | p_hora = 4, n_horas = 35 | 140 | ## Actividad 3. Segundo siguiente La siguiente función a la que le pasamos como parámetros la hora, minutos y segundo actual y que devuelve una lista con la hora, minutos y segundo 1 segundo despues ```python def segundo_siguiente(h, m, s): if s < 59: s += 1 elif m < 59: m += 1 s = 0 elif h < 23: h += 1 m = 0 s = 0 else: h = m = s = 0 return [h, m, s] ``` Elaborar e insertar: **2. Diagrama de flujo del programa** **3. Grafo de flujo del programa** **4. Cálculo de la complejidad ciclomática del algoritmo usando los tres métodos posibles** **5. Caminos independientes con longitudes de mayor a menor** **6. Tabla con casos de prueba** | Camino | Entrada | Prueba | Salida | | ------ | ------- | ------ | ------ | | | | | | | | | | | ## Actividad Complementaria. Tipo de interés. La siguiente función devuelve el tipo de interes a aplicar a un cliente en función del saldo que tiene en su cuenta corriente ```python def tipo_interes(saldo): if saldo <= 0: return 0 elif saldo > 0 and saldo < 1000 return 0.03 elif saldo > 1000 and saldo < 3000 return 0.05 else: return 0.07 ``` Elaborar e insertar: **2. Diagrama de flujo del programa** **3. Grafo de flujo del programa** **4. Cálculo de la complejidad ciclomática del algoritmo usando los tres métodos posibles** **5. Caminos independientes con longitudes de mayor a menor** **6. Tabla con casos de prueba** | Camino | Entrada | Prueba | Salida | | ------ | ------- | ------ | ------ | | | | | | | | | | | ## Recursos * [Prueba del camino básico - JC Mouse. Código colectivo](https://www.jc-mouse.net/ingenieria-de-sistemas/caja-blanca-prueba-del-camino-basico) ###### tags: `ets` `ut3` `actividad` `pruebas` `software` `camino básico`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully