如何重命名tSQLt测试类? [英] How do I rename a tSQLt test class?

查看:128
本文介绍了如何重命名tSQLt测试类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Red Gate SQL Developer 开发数据库工具. SQL测试,它是运行tSQLt的SSMS加载项测试,缺少重命名测试类的方法.

I'm developing a database using the Red Gate SQL Developer tools. SQL Test, the SSMS add-in that runs tSQLt tests, lacks a way to rename test classes.

我有一个名为[BackendLayerCustomerAdministrationTests].[test uspMaintainCustomerPermissions throws error when PermissionValue is missing or empty]的测试.

名称太长了,以致破坏了Deployment Manager

2013-12-05 18:48:40 +00:00错误指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名称必须少于248个字符.

2013-12-05 18:48:40 +00:00 ERROR The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

此类中还有其他不必要的测试名称,因此我想从缩短类名称开始.

There are other unwieldly test names in this class, so I want to start by shortening the class name.

一个更简洁的类名是CustomerTests.

sp_rename 在这里没有帮助.

EXECUTE sys.sp_rename
  @objname = N'BackendLayerCustomerAdministrationTests',
  @newname = N'CustomerTests';

消息15225,第11级,状态1,过程sp_rename,第374行 假设@itemtype输入为'(null)',则在当前数据库'ApiServices'中找不到名称为'BackendLayerCustomerAdministrationTests'的项目.

Msg 15225, Level 11, State 1, Procedure sp_rename, Line 374 No item by the name of 'BackendLayerCustomerAdministrationTests' could be found in the current database 'ApiServices', given that @itemtype was input as '(null)'.

如何更改?

推荐答案

抱歉,这么晚了!我是从事SQL测试的开发人员.

Sorry to come into this so late! I'm a developer who's working on SQL Test.

我们刚刚在最新版本的SQL Test中添加了重命名测试类的功能.

We've just added the ability to rename test classes to the latest version of SQL Test.

http://www.red-gate.com/产品/sql-development/sql-test/

现在,只需在测试类的上下文菜单上单击鼠标右键,或按 F2 :

It's now as simple as right clicking on the context menu for a test class, or pressing F2:

请记住,此选项对于旧版本的tSQLt不会出现.要升级,请右键单击数据库以卸载该框架,然后执行添加数据库... 以重新添加它(窗口中最右边的按钮):

Please bear in mind that this option will not appear for old versions of tSQLt. To upgrade, right click on the database to uninstall the framework, then do Add database... to re-add it (the right-most button in the window):

或者,您可以在tSQLt中调用名为tSQLt.RenameClass的新过程,这就是SQL Test在后台调用的过程.

Alternatively, you could just call a new procedure in tSQLt called tSQLt.RenameClass, which is what SQL Test calls behind the scenes.

如果您对此有任何疑问,请告诉我们!

Please let us know if you have any issues with this!

大卫

这篇关于如何重命名tSQLt测试类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆