{"id":3301,"date":"2022-06-27T00:02:10","date_gmt":"2022-06-27T03:02:10","guid":{"rendered":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/?p=3301"},"modified":"2025-09-02T14:30:59","modified_gmt":"2025-09-02T17:30:59","slug":"introducao-a-automatizacao-de-testes","status":"publish","type":"post","link":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/2022\/06\/27\/introducao-a-automatizacao-de-testes","title":{"rendered":"Introdu\u00e7\u00e3o a automatiza\u00e7\u00e3o de testes"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3301\" class=\"elementor elementor-3301\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9bbccc9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9bbccc9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5e89a97\" data-id=\"5e89a97\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e9bd245 elementor-widget elementor-widget-text-editor\" data-id=\"e9bd245\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Fala pessoal, no PET Reda\u00e7\u00e3o deste m\u00eas iremos abordar e entender melhor sobre um dos conhecimentos que t\u00eam sido cobrados nas vagas do mercado de desenvolvimento de software, os testes e, principalmente, a automatiza\u00e7\u00e3o deles.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">O que \u00e9 automatiza\u00e7\u00e3o de testes de software?&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Primeiramente, \u00e9 importante entender melhor o que \u00e9 automatiza\u00e7\u00e3o de testes. Por mais que a resposta pare\u00e7a um pouco \u00f3bvia, \u00e9 necess\u00e1rio entender o processo de um teste durante um desenvolvimento de software. Por exemplo, pode-se testar um c\u00f3digo manualmente rodando ele, comparando resultados e analisando poss\u00edveis bugs, por\u00e9m o pr\u00f3prio teste manual est\u00e1 sujeito a erros e quando trata-se de um sistema mais complexo, uma API, etc. realizar testes automatizados \u00e9 mais crucial ainda.&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Um teste automatizado consiste em desenvolver outra parte de c\u00f3digo que realize um teste, que seria feito manualmente, de forma autom\u00e1tica.<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">O processo de um teste \u00e9 simples: existe um c\u00f3digo ou uma fun\u00e7\u00e3o, existe um retorno esperado dessa aplica\u00e7\u00e3o e um resultado se o foi bem sucedido ou resultou em uma falha. Baseado nisso, pode-se alterar o c\u00f3digo e fazer corre\u00e7\u00f5es de bugs ou implementar novos testes.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Por que implementar testes?<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Outro t\u00f3pico importante para entrar \u00e9 o porqu\u00ea da implementa\u00e7\u00e3o de testes automatizados. O primeiro ponto \u00e9 o tempo, pois, apesar de a automatiza\u00e7\u00e3o de testes ter um tempo de desenvolvimento, a longo prazo o programador perder\u00e1 menos tempo testando manualmente.&nbsp;&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Outro ponto \u00e9 a facilidade de encontrar novos <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">bugs<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, j\u00e1 que al\u00e9m dos pr\u00f3prios testes automatizados j\u00e1 fazerem isso, o pr\u00f3prio desenvolvedor, quando est\u00e1 implementando os testes, consegue visualizar melhor o que pode ocasionar em um <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">bug<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> futuramente.&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Por \u00faltimo, muitos projetos maiores e mais complexos utilizam os testes automatizados para melhorar o fluxo de trabalho. Por exemplo, quando \u00e9 feito um <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">commit <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">em um reposit\u00f3rio do Github e uma aplica\u00e7\u00e3o para testar testar \u00e9 rodada antes de fazer o deploy da aplica\u00e7\u00e3o na produ\u00e7\u00e3o, n\u00e3o permitindo que bugs e erros cheguem no ambiente de produ\u00e7\u00e3o e cause problemas ao sistema que est\u00e1 online.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Tipos de teste<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora, pode-se entrar nos tipos de testes. Existem diversos tipos de testes de software, por\u00e9m vamos focar nos testes mais comuns de serem desenvolvidos em aplica\u00e7\u00f5es: teste unit\u00e1rios e testes de integra\u00e7\u00e3o.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<ul style=\"margin-top: 0;margin-bottom: 0\">\n<li style=\"list-style-type: disc;font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Testes Unit\u00e1rios<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 72pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Testam unidades menores de uma aplica\u00e7\u00e3o, de forma isolada, para ver se cada unidade do software est\u00e1 funcionando adequadamente. Desse modo, testes unit\u00e1rios podem ser implementados rapidamente e normalmente j\u00e1 auxiliam durante o desenvolvimento de uma fun\u00e7\u00e3o, um m\u00e9todo, etc.<\/span><\/p>\n<ul style=\"margin-top: 0;margin-bottom: 0\">\n<li style=\"list-style-type: disc;font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\" role=\"presentation\"><span style=\"font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Testes de Integra\u00e7\u00e3o<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38;margin-left: 72pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Testam diversas unidades que possuem depend\u00eancia entre si, para ver se a aplica\u00e7\u00e3o funciona de forma integrada. Esses testes s\u00e3o realizados mesmo se todos os testes unit\u00e1rios passaram.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Implementa\u00e7\u00e3o<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Passado a parte te\u00f3rica, pode-se entrar na parte pr\u00e1tica. Para desenvolver nosso c\u00f3digo e nossos testes vamos utilizar Javascript e a IDE Visual Studio Code. Para isso, ser\u00e1 necess\u00e1rio instalar o Node.js, que est\u00e1 dispon\u00edvel neste <\/span><a style=\"text-decoration: none\" href=\"https:\/\/nodejs.org\/en\/download\/\"><span style=\"font-size: 11pt;font-family: Arial;color: #1155cc;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: underline;vertical-align: baseline\">link<\/span><\/a><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. Para realizar nossos testes, vamos utilizar um framework chamado Jest, que possui diversas fun\u00e7\u00f5es para automatizar os testes de forma simples.<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Ap\u00f3s instalar o Node.Js, crie uma pasta para conter o projeto Node. Para iniciar um projeto Node, utiliza-se o gerenciador de pacotes do Node.Js, o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. No terminal do Visual Studio Code, acesse a pasta que deve ser criado o projeto e rode o seguinte comando:<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm init &#8211; y<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Esse comando vai criar um arquivo chamado <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">package.json<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, tem algumas informa\u00e7\u00f5es do nosso projeto, alguns scripts que ser\u00e3o necess\u00e1rios futuramente e as depend\u00eancias do projeto, que s\u00e3o os frameworks, bibliotecas que podemos instalar nessa aplica\u00e7\u00e3o.&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Ainda utilizando o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, instale o Jest utilizando o seguinte comando:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\">\n<\/p><p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm install jest<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora, no <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">package.json <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">\u00e9 poss\u00edvel visualizar o Jest como uma depend\u00eancia do projeto. Para rodar os testes da nossa aplica\u00e7\u00e3o futuramente, deve-se alterar o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">script test<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> para <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">jest<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> no <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">package.json<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, ficando assim:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><em><span style=\"background-color: var(--bs-body-bg);text-align: var(--bs-body-text-align)\">scripts&#8221;: {<\/span><\/em><\/p>\n<p><em>&nbsp; &nbsp;&#8220;test&#8221;: &#8220;jest&#8221;<\/em><\/p>\n<p><em>&nbsp;}<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Finalizado todas as configura\u00e7\u00f5es de ambiente, iremos criar um arquivo <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.js<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> para implementar as fun\u00e7\u00f5es que ser\u00e3o testadas. A primeira ser\u00e1 uma simples fun\u00e7\u00e3o que retorna a soma de dois n\u00fameros. Como no c\u00f3digo abaixo:&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-indent: 36pt;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;<\/span><\/p>\n<p><em>function soma (n1, n2) {<\/em><\/p>\n<p><em>&nbsp; &nbsp;return n1 + n2;<\/em><\/p>\n<p><em>}<\/em><\/p>\n<p><em>module.exports = { soma };<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Na primeira parte do c\u00f3digo, foi implementado o c\u00f3digo, depois h\u00e1 um <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">module.exports, <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">que \u00e9 utilizado para exportar a fun\u00e7\u00e3o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">soma <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">para usar ela dentro dos testes.&nbsp;<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora, para implementar o primeiro teste unit\u00e1rio, deve-se criar um arquivo <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.test.js<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. A parte de <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">.test <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">&nbsp;no nome do arquivo serve para o Jest identificar que o arquivo \u00e9 um teste e execut\u00e1-lo. Dentro do arquivo ter\u00e1 o seguinte c\u00f3digo:<\/span><\/p>\n<p dir=\"ltr\">\n<\/p><p><em>const { soma } = require(&#8216;.\/app&#8217;);<\/em><\/p>\n<p><em>test(&#8216;Deve somar dois n\u00fameros&#8217;, () =&gt; {<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;const resultado = soma(10, 15);<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;expect(resultado).toBe(25);<\/em><br><em>});<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Na primeira linha \u00e9 feita a importa\u00e7\u00e3o da fun\u00e7\u00e3o soma do arquivo <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.ts<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. Ap\u00f3s isso, usamos uma fun\u00e7\u00e3o padr\u00e3o do Jest, chamada <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">test<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, para criar um teste. Dentro dessa fun\u00e7\u00e3o, o primeiro par\u00e2metro \u00e9 a descri\u00e7\u00e3o do teste, nesse caso \u201cDeve somar dois n\u00fameros\u201d. J\u00e1 o segundo par\u00e2metro \u00e9 um fun\u00e7\u00e3o, que \u00e9 o teste em si, contendo uma <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">const <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">que recebe o resultado da soma e uma outra fun\u00e7\u00e3o do Jest chamada <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">expect<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, que, basicamente, faz uma compara\u00e7\u00e3o do retorno da fun\u00e7\u00e3o soma com um valor informado. Essa parte pode ser traduzida como: Espera-se que <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">resultado<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> seja 25. Para rodar esse teste, deve-se utilizar o comando abaixo, que foi atualizado anteriormente:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\">\n<\/p><p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm test<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Caso tudo tenha sido implementado corretamente, o teste deve ter um status de <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">passed<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. Como na imagem abaixo:<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><span style=\"border: none;overflow: hidden;width: 360px;height: 181px\"><img fetchpriority=\"high\" decoding=\"async\" style=\"margin-left: 0px;margin-top: 0px\" src=\"https:\/\/lh3.googleusercontent.com\/fl8cbSqGsqCGj5mI4tjnwqaHsyfusnYiFSj3-BZsqoJdyvw901X_gabmtq-LgMm-LI_yJv3XEGdRX0pB-NNwh-T8by7tZ3dvXpCWb_BW4WY_8dTcjfIwseutcmWo68L2JaTi-MIwnxfyupWmvw\" width=\"360\" height=\"181\"><\/span><\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora, iremos implementar outra fun\u00e7\u00e3o dentro do <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.js<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, para realizar a valida\u00e7\u00e3o de dois par\u00e2metros, que depois ser\u00e1 utilizada dentro da fun\u00e7\u00e3o soma para transform\u00e1-la em&nbsp; um teste de integra\u00e7\u00e3o. O arquivo <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.js<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> deve ficar assim:<\/span><\/p>\n<p dir=\"ltr\">\n<\/p><p><em>function validacao(n1, n2) {<\/em><br><em>&nbsp;&nbsp;&nbsp;if(!n1 || !n2 || isNaN(n1) || isNaN(n2)) {<\/em><br><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<\/em><br><em>&nbsp;&nbsp;&nbsp;}<\/em><br><em>&nbsp;&nbsp;&nbsp;return true;<\/em><\/p>\n<p><em>}<\/em><\/p>\n<p><em>function soma (n1, n2) {<\/em><br><em>&nbsp;&nbsp;&nbsp;return n1 + n2;<\/em><br><em>}<\/em><\/p>\n<p><em>module.exports = { soma, validacao };<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">A fun\u00e7\u00e3o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">validacao<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> possui um if que vai retornar <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">false<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, caso seja passado algum valor vazio ou n\u00e3o seja um n\u00famero, sen\u00e3o retorna <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">true<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. A partir disso, pode-se implementar um teste unit\u00e1rio para testar os dois casos. Desenvolvendo o teste no arquivo <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">app.test.js<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, ficar\u00e1 assim:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p><em>const { soma, validacao } = require(&#8216;.\/app&#8217;);<\/em><\/p>\n<p><em>test(&#8216;Deve somar dois n\u00fameros&#8217;, () =&gt; {<\/em><br><em>&nbsp;&nbsp;&nbsp;const resultado = soma(10, 15);<\/em><br><em>&nbsp;&nbsp;&nbsp;expect(resultado).toBe(25);<\/em><br><em>});<\/em><\/p>\n<p><em>test(&#8216;Deve retornar a valida\u00e7\u00e3o correta&#8217;, () =&gt; {<\/em><br><em>&nbsp;&nbsp;&nbsp;\/\/ retorna falso por que possui valor vazio<\/em><br><em>&nbsp;&nbsp;&nbsp;expect(validacao(3, null)).toBe(false);<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;\/\/ retorna falso por que possui valor n\u00e3o num\u00e9rico<\/em><br><em>&nbsp;&nbsp;&nbsp;expect(validacao(3, &#8220;a&#8221;)).toBe(false);<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;expect(validacao(10, 15)).toBe(true);<\/em><br><em>});<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Dentro do teste de valida\u00e7\u00e3o h\u00e1 3 chamadas para testar todos os casos poss\u00edveis. No primeiro caso, passamos um valor <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">null<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> para a fun\u00e7\u00e3o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">validacao<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, esperando que retorne <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">false<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. No segundo caso, enviamos um car\u00e1cter para a fun\u00e7\u00e3o <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">validacao<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, esperando que retorne<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\"> false<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> tamb\u00e9m. No \u00faltimo caso, enviamos valores corretos para a fun\u00e7\u00e3o, esperando que ela retorne <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">true<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> dessa vez. Rodando <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">npm test<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> novamente, pode-se visualizar que os dois testes resultar\u00e3o em <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">passed<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">, igual na imagem abaixo:<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><span style=\"border: none;overflow: hidden;width: 381px;height: 195px\"><img decoding=\"async\" style=\"margin-left: 0px;margin-top: 0px\" src=\"https:\/\/lh5.googleusercontent.com\/tDhucgJk17dkXNGXidMpzXuRM9t-8e52B1pFEyBSk26c2O83awyYPeKNCPHRFWY2s4wBbDLDp1QSwXtZXGNdB-7pvlnXIHqx4lxH8pL5xwM-5uTM0PVWg-7X2kMoc_h4uoJ43Zq08IbaqBFcQA\" width=\"381\" height=\"195\"><\/span><\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Depois de implementar dois testes de integra\u00e7\u00e3o, vamos transformar o teste de soma em um teste de integra\u00e7\u00e3o, a partir da adi\u00e7\u00e3o da fun\u00e7\u00e3o de valida\u00e7\u00e3o dentro da fun\u00e7\u00e3o de soma. Dessa forma:<\/span><\/p>\n<p dir=\"ltr\">\n<\/p><p><em>function soma (n1, n2) {<\/em><br><em>&nbsp;&nbsp;&nbsp;if(!validacao(n1, n2))<\/em><br><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw &#8220;Valores Inv\u00e1lidos&#8221;;<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;return n1 + n2;<\/em><br><em>}<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Agora, caso seja passado valores inv\u00e1lidos, o programa vai gerar um erro a partir do <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">throw<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">. Dessa forma, a fun\u00e7\u00e3o soma possui depend\u00eancia de outra fun\u00e7\u00e3o, logo o primeiro teste que implementamos virou um teste de integra\u00e7\u00e3o. Por\u00e9m, ainda pode ser feito algumas altera\u00e7\u00f5es no teste de soma para testar caso seja passado valores inv\u00e1lidos. O teste de soma ficar\u00e1 assim:<\/span><\/p>\n<p dir=\"ltr\">\n<\/p><p><em>test(&#8216;Deve somar dois n\u00fameros&#8217;, () =&gt; {<\/em><br><em>&nbsp;&nbsp;&nbsp;const resultado = soma(10, 15);<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;expect(resultado).toBe(25);<\/em><\/p>\n<p><em>&nbsp;&nbsp;&nbsp;expect(() =&gt; {<\/em><br><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;soma(3, &#8220;a&#8221;)<\/em><br><em>&nbsp;&nbsp;&nbsp;}).toThrow(&#8220;Valores Inv\u00e1lidos&#8221;);<\/em><br><em>});<\/em><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Nesse caso, adicionamos outro <\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: italic;font-variant: normal;text-decoration: none;vertical-align: baseline\">expect<\/span><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"> passando valores inv\u00e1lidos, esperando que seja retornado um erro. Rodando npm test, pode-se ver que o teste ainda est\u00e1 passando, como na imagem abaixo:<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: center;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\"><span style=\"border: none;overflow: hidden;width: 359px;height: 197px\"><img decoding=\"async\" style=\"margin-left: 0px;margin-top: 0px\" src=\"https:\/\/lh4.googleusercontent.com\/c53chmkXkjosiS-mQJDFfGGijsBBzkdGvpf3kEvVrZbovmV70TJDUUF-500Rjph50BuSiG-W2W3gmBZ1UgQZlHUXMwFqeu84CXUGXvNoM7ZmpPMYdPgWVrSgxz-7tJv1dihB3pkoeEBxLSVjug\" width=\"359\" height=\"197\"><\/span><\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Conclus\u00e3o<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Com isso, foi poss\u00edvel compreender mais sobre testes, o porqu\u00ea de implement\u00e1-los e como coloc\u00e1-los em pr\u00e1tica com a implementa\u00e7\u00e3o do projeto com Javascript, Node.js e Jest. Nos links abaixo est\u00e3o alguns materiais e v\u00eddeos utilizados para escrever a reda\u00e7\u00e3o, al\u00e9m de outros testes que n\u00e3o foram mencionados.<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 13.999999999999998pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Refer\u00eancias<\/span><\/p>\n<p><b style=\"font-weight: normal\">&nbsp;<\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><a style=\"text-decoration: none\" href=\"https:\/\/www.youtube.com\/watch?v=r9HdJ8P6GQI\"><span style=\"font-size: 11pt;font-family: Arial;color: #1155cc;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: underline;vertical-align: baseline\">Unit tests, Integration tests &amp; e2e tests<\/span><\/a><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><a style=\"text-decoration: none\" href=\"https:\/\/www.youtube.com\/watch?v=2G_mWfG0DZE\"><span style=\"font-size: 11pt;font-family: Arial;color: #1155cc;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: underline;vertical-align: baseline\">Testes no NodeJS aplicando TDD com Jest<\/span><\/a><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: justify;margin-top: 0pt;margin-bottom: 0pt\"><a style=\"text-decoration: none\" href=\"https:\/\/blog.onedaytesting.com.br\/teste-de-software\/\"><span style=\"font-size: 11pt;font-family: Arial;color: #1155cc;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: underline;vertical-align: baseline\">Teste de software: Introdu\u00e7\u00e3o, Conceitos B\u00e1sicos e Tipos de Testes<\/span><\/a><\/p>\n<p><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38;text-align: right;margin-top: 0pt;margin-bottom: 0pt\"><span style=\"font-size: 11pt;font-family: Arial;color: #000000;background-color: transparent;font-weight: 400;font-style: normal;font-variant: normal;text-decoration: none;vertical-align: baseline\">Francisco Palermo<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Fala pessoal, no PET Reda\u00e7\u00e3o deste m\u00eas iremos abordar e entender melhor sobre um dos conhecimentos que t\u00eam sido cobrados nas vagas do mercado de desenvolvimento de software, os testes e, principalmente, a automatiza\u00e7\u00e3o deles. &nbsp; O que \u00e9 automatiza\u00e7\u00e3o de testes de software?&nbsp; Primeiramente, \u00e9 importante entender melhor o que \u00e9 automatiza\u00e7\u00e3o de testes. [&hellip;]<\/p>\n","protected":false},"author":3802,"featured_media":3302,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,112],"tags":[189,149],"class_list":["post-3301","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-destaques","category-redacao","tag-automacao-e-testes","tag-redacao"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts\/3301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/users\/3802"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/comments?post=3301"}],"version-history":[{"count":0,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/posts\/3301\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/media\/3302"}],"wp:attachment":[{"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/media?parent=3301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/categories?post=3301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ufsm.br\/pet\/sistemas-de-informacao\/wp-json\/wp\/v2\/tags?post=3301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}