{"id":100,"date":"2026-08-19T20:00:00","date_gmt":"2026-08-19T20:00:00","guid":{"rendered":"https:\/\/telapreta.dev.br\/blog\/?p=100"},"modified":"2026-08-17T16:44:42","modified_gmt":"2026-08-17T19:44:42","slug":"geracao-de-testes-unitarios-automatizados-copilot-tests","status":"publish","type":"post","link":"https:\/\/telapreta.dev.br\/blog\/index.php\/geracao-de-testes-unitarios-automatizados-copilot-tests\/","title":{"rendered":"Gera\u00e7\u00e3o de Testes Unit\u00e1rios Automatizados com `\/tests` no GitHub Copilot"},"content":{"rendered":"<div class=\"telapreta-post-body\" style=\"line-height: 1.8;font-size: 1.05rem;color: #e2e8f0\">\n<p><em>Chega de adiar a cria\u00e7\u00e3o de testes! Veja como gerar su\u00edtes completas de testes unit\u00e1rios com Jest, PyTest e JUnit usando o comando <code>\/tests<\/code>. Por <strong>Fabio Silva<\/strong>.<\/em><\/p>\n<hr style=\"border-color: #1e293b;margin: 30px 0\" \/>\n<h2 style=\"color: #10b981;margin-top: 30px\">\ud83e\uddea Como Funciona o Comando `\/tests`<\/h2>\n<p>Selecione uma fun\u00e7\u00e3o ou classe no seu editor de c\u00f3digo, abra o Copilot Chat (<code>Ctrl + Alt + I<\/code> ou <code>Cmd + Option + I<\/code>) e digite <code>\/tests<\/code>. O Copilot analisar\u00e1 os caminhos de execu\u00e7\u00e3o feliz (happy path), casos de borda (edge cases) e exce\u00e7\u00f5es.<\/p>\n<hr style=\"border-color: #1e293b;margin: 35px 0\" \/>\n<p style=\"color: #94a3b8;font-size: 0.95rem\"><em>S\u00e9rie Especial GitHub Copilot \u2014 Artigo por <strong>Fabio Silva<\/strong> (Arquiteto de Solu\u00e7\u00f5es em Cloud &amp; IA Generativa).<\/em><\/p>\n<\/div>\n<div class=\"vscode-window-mockup\" style=\"background: #1e1e1e;border-radius: 10px;border: 1px solid #3c3c3c;overflow: hidden;margin: 30px 0;font-family: monospace\">\n<div style=\"background: #252526;padding: 8px 15px;display: flex;align-items: center;justify-content: space-between;border-bottom: 1px solid #333\">\n<div style=\"display: flex;gap: 8px\">      <span style=\"width: 12px;height: 12px;border-radius: 50%;background: #ff5f56;display: inline-block\"><\/span>      <span style=\"width: 12px;height: 12px;border-radius: 50%;background: #ffbd2e;display: inline-block\"><\/span>      <span style=\"width: 12px;height: 12px;border-radius: 50%;background: #27c93f;display: inline-block\"><\/span>    <\/div>\n<div style=\"color: #cccccc;font-size: 12px;font-weight: 500\">      <span>\ud83d\udcc4 test_auth.py \u2014 Visual Studio Code [Linux x64]<\/span>    <\/div>\n<div style=\"color: #10b981;font-size: 11px;font-weight: bold\">Copilot Enabled \ud83e\udd16<\/div>\n<\/p><\/div>\n<div style=\"background: #2d2d2d;display: flex;border-bottom: 1px solid #1e1e1e;font-size: 13px\">\n<div style=\"background: #1e1e1e;color: #ffffff;padding: 6px 16px;border-right: 1px solid #252526;border-top: 2px solid #10b981;display: flex;align-items: center;gap: 8px\">      <span style=\"color: #10b981\">\u26a1<\/span> test_auth.py    <\/div>\n<\/p><\/div>\n<div style=\"padding: 18px;font-size: 13px;line-height: 1.6;color: #d4d4d4;background: #1e1e1e\">\n<pre style=\"margin: 0;background: transparent;padding: 0;border: none;color: inherit;font-family: monospace\"><span style=\"color: #569cd6\">def<\/span> <span style=\"color: #dcdcaa\">test_jwt_authentication_success<\/span>():\r\n    token = generate_token(user_id=<span style=\"color: #b5cea8\">101<\/span>)\r\n    assert validate_token(token) == <span style=\"color: #569cd6\">True<\/span><\/pre>\n<\/p><\/div>\n<div style=\"background: #181818;border-top: 1px solid #2b2b2b;padding: 12px 16px;font-size: 12px;color: #cccccc\">\n<div style=\"color: #10b981;font-weight: bold;margin-bottom: 6px;display: flex;align-items: center;gap: 8px\">      <span>\ud83d\udda5\ufe0f TERMINAL (bash)<\/span> <span style=\"color: #666;font-weight: normal\">\u2014 ubuntu@telapreta-server:~<\/span>    <\/div>\n<div style=\"color: #4ec9b0;font-family: monospace\">      <span style=\"color: #10b981\">fabio@ubuntu-linux<\/span>:<span style=\"color: #569cd6\">~\/projects<\/span>$ <span style=\"color: #ce9178\">pytest test_auth.py &#8211;verbose<\/span>    <\/div>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Chega de adiar a cria\u00e7\u00e3o de testes! Veja como gerar su\u00edtes completas de testes unit\u00e1rios com Jest, PyTest e JUnit usando o comando \/tests. Por Fabio Silva. \ud83e\uddea Como Funciona o Comando `\/tests` Selecione uma fun\u00e7\u00e3o ou classe no seu editor de c\u00f3digo, abra o Copilot Chat (Ctrl + Alt + I ou Cmd + &#8230; <a title=\"Gera\u00e7\u00e3o de Testes Unit\u00e1rios Automatizados com `\/tests` no GitHub Copilot\" class=\"read-more\" href=\"https:\/\/telapreta.dev.br\/blog\/index.php\/geracao-de-testes-unitarios-automatizados-copilot-tests\/\" aria-label=\"Read more about Gera\u00e7\u00e3o de Testes Unit\u00e1rios Automatizados com `\/tests` no GitHub Copilot\">Ler mais<\/a><\/p>\n","protected":false},"author":1,"featured_media":139,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,3],"tags":[],"class_list":["post-100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desenvolvimento","category-ia-agentes"],"_links":{"self":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":4,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":215,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions\/215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/media\/139"}],"wp:attachment":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}