csp cop
SQL unit testing is rising in popularity amongst database developers. The importance of Code Quality in Software Development has increased over the period of time. Everyone wants to follow coding standards and write clean code. However, to timely deliver a product to Business we end up in violating design principles, writing fewer unit tests, increasing code complexity and breaching best practices. This increases the overall Technical Debt of the application and has the potential to halt future development work by creating unplanned work.
SQL单元测试在数据库开发人员中越来越受欢迎。 一段时间以来, 代码质量在软件开发中的重要性日益提高。 每个人都希望遵循编码标准并编写简洁的代码。 但是,为了及时向企业交付产品,我们最终违反了设计原则,编写了更少的单元测试,增加了代码复杂性并违反了最佳实践。 这增加了应用程序的整体技术负担,并有可能通过创建计划外的工作来停止将来的开发工作。
There are a lot of tools available which can help you to build high-quality software by identifying vulnerabilities at an early stage. Application developers use tools like SonarQube and Analyzers to continuously inspect code quality. But what about database development? Wouldn’t it be awesome to have similar toolset available which can inspect your database code and identify problems with design, performance and security?
有很多可用的工具可以帮助您通过尽早发现漏洞来构建高质量的软件。 应用程序开发人员使用SonarQube和分析器之类的工具来连续检查代码质量。 但是数据库开发呢? 拥有可用的类似工具集来检查您的数据库代码并识别设计,性能和安全性问题是否很棒?
In this article, we will learn about SQL Unit Testing, Database Static Code Analysis, the benefits of using it in Database Development, SQL Cop and how to use it to identify anti-patterns in your database.
在本文中,我们将学习SQL单元测试,数据库静态代码分析,在数据库开发中使用它的好处,SQL Cop以及如何使用它来识别数据库中的反模式。
什么是SQL单元测试? (What is SQL Unit Testing?)
Unit Tests helps you to independently verify a small functionality of your application – be it front end code or database code. Writing SQL Unit Tests is an integral part of the database lifecycle and gives more confidence to developers to push a change to Production.
单元测试可帮助您独立验证应用程序的一小部分功能 -前端代码还是数据库代码。 编写SQL单元测试是数据库生命周期不可或缺的一部分,它使开发人员更有信心将更改推向生产。
When you write Unit Tests for a stored procedure or function, it should just verify that discrete unit of code. They should be isolated and not be impacted by other tests. The Unit Test suite should confirm that all functionalities work individually.
当您为存储过程或函数编写单元测试时,应仅验证该离散代码单元。 它们应该隔离,并且不受其他测试的影响。 单元测试套件应确认所有功能均单独工作。
为什么需要SQL单元测试? (Why is SQL Unit Testing required?)
Data is hard to manage and databases are hard to test. Database deployments are far more complicated than application deployment, since you cannot redeploy your code from scratch every time. It cannot be wiped off and recreated during deployments. Having Unit Tests gives you a lot of confidence in making a functionality change and getting an immediate feedback.
数据很难管理,数据库很难测试。 数据库部署比应用程序部署复杂得多,因为您不能每次都从头开始重新部署代码。 在部署期间无法擦除和重新创建它。 进行单元测试可以使您在更改功能和获得即时反馈方面充满信心。
数据库生命周期管理概述 (Database Lifecycle Management Overview)
Database Lifecycle Management is a systematic approach to make database changes more reliable and respond quickly to business demands. With the right set of tools and processes, developers can make complex database changes and deploy them to Production confidently. It is more about identifying defects earlier in the process, preferably prior to code check-in to source control. This is cost-effective and reduces the overhead of handling bugs later in the process. Debugging, Unit Testing and Static Code Analysis empowers a developer towards a smooth delivery.
数据库生命周期管理是一种系统的方法,可以使数据库更改更可靠,并快速响应业务需求 。 借助正确的工具和流程,开发人员可以进行复杂的数据库更改并将其放心地部署到生产中。 它更多地是关于在过程中更早地识别缺陷,最好是在代码签入源代码控制之前。 这具有成本效益,并减少了稍后在过程中处理错误的开销。 调试,单元测试和静态代码分析使开发人员能够顺利交付。
什么是静态代码分析? (What is Static Code Analysis?)
Static Code Analysis is a collection of rules to analyze your source code at compile time to identify potential vulnerabilities, bugs, anti-patterns, refactoring and poor coding practices. It is a great way to automate y