Introduction to Testing in Go (Golang)

所在平台: Udemy

课程主页: https://www.udemy.com/course/introduction-to-testing-in-go-golang/

课程评论:没有评论

第一个写评论        关注课程

课程简介

课程名称:Go (Golang) 测试入门 课程概述:编写单元测试和集成测试是软件开发中被忽视的一个重要方面。许多开发者在项目完成后,会发现“在我的电脑上确实可以工作”,但一旦将其移出开发环境,事情却并不如预期。精心编写的单元测试和集成测试能够有效解决这个问题,并且几乎总是会减少整体开发时间,而不会增加额外的负担。此外,经过良好测试的代码通常维护成本较低,最终产品的停机时间也会减少。 本课程着重介绍如何在现代、类型安全、编译型且极快的编程语言 Go 中编写单元和集成测试。Go 语言非常适合构建安全、可扩展且响应极快的Web应用,并且内置了强大的测试工具。 在本课程中,我们将构建四个简单的应用程序,并对其进行全面测试: 1. 一个命令行应用程序(CLI),用于判断用户输入的数字是否为质数; 2. 一个简单的Web应用程序,允许用户登录和上传个人资料图片; 3. 一个基于上述Web应用程序相同代码库构建的简单REST API,允许用户使用JWT令牌进行身份验证并对Postgres数据库进行操作,包括使用刷新令牌的完整认证过程,全面测试代码的各个方面; 4. 一个使用原生JavaScript编写的简单单页Web应用程序(SPA),展示如何在SPA中使用JWT和刷新令牌,以及如何测试这些功能。 在每个项目中,我们将学习如何为所有功能编写单元测试。具体包括: - 应用路由 - 应用处理程序 - 通过编写和使用表格测试来测试多种场景 - 数据库操作(使用仓储模式) - 应用中间件 - 用户身份验证(包含会话) - 用户身份验证(使用JWT令牌) - JWT令牌生成与验证 - 刷新令牌生成与验证 - 测试用户输入 - 向终端写入数据 - 向请求添加Cookies - 从响应中读取Cookies 通过本课程的学习,您将系统掌握如何编写有效的测试,以及如何编写可测试的代码。请注意,本课程需要您下载 Docker Desktop。若您是 Udemy Business 用户,请在下载软件前与雇主确认。

课程评论(0条)

课程详情

Writing unit tests and integration tests is one of the most-neglected aspects of software development. All too often, a developer will find him or herself say "but it works on my computer!" when a project is presumed finished, only to discover that once taken out of the development environment, things don't work as expected.Well written unit tests and integration tests help to solve this problem, and in fact almost without exception will reduce overall development time, rather than adding to it. In addition, well-tested code almost always requires less maintenance, and the end product will have less down time.This course is focused on writing unit and integration tests in Go, a modern, type safe, compiled, and extremely fast programming language. It it is ideally suited for building safe, scalable, incredibly fast web applications, and it has powerful testing tools built right in.In this course, we will build four simple applications, and thoroughly test them:A command line application (CLI) that tries to determine if a user-entered number is prime or not;A simple web application that allows a user to log in and upload a profile picture;A simple REST API built on the same code base as the web application which allows users to authenticate using JWT tokens and perform operations against a Postgres database. We'll go through the entire authentication process, including using refresh tokens, and thoroughly test all aspects of the code.A simple Single Page Web Application (SPA), written in Vanilla JavaScript, that demonstrates how to use JWT and Refresh Tokens with a SPA, and how to test that functionality.For each of these projects, we will learn how to write unit tests for all functionality. We will learn how to test (among other things):Application routesApplication handlersHow to test multiple scenarios by writing and using table testsDatabase operations (using the Repository pattern)Application middlewareUser authentication (with sessions)User authentication (with JWT tokens) JWT token generation and validationRefresh token generation and validationTesting user inputWriting to the terminalAdding cookies to a requestReading cookies from a responseBy the end of this course, you will have a solid understanding of how to write effective tests, and how to write testable code.Please note that this course requires you to download Docker Desktop from Docker. If you are a Udemy Business user, please check with your employer before downloading software.

课程标签

0人关注该课程

主题相关的课程