我有一个Angular JS项目,我正在尝试为其编写一些测试脚本。我安装了Chutzpah,项目模板随Jasmine一起安装,并附带了一些测试脚本。当我运行Chutzpah来发现并执行测试时,我遇到了错误,并且不是测试专家(这是我第一次来),我不知道是什么原因引起的。任何帮助将不胜感激。
我的chutzpah配置文件是:
{
"Framework": "jasmine",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"Paths": [
{
"SourcePath": "../",
"OutputPath": "../"
}
]
},
"References": [
{
"Path": "./ClientApp" ,
"Includes": [ "*.ts" ],
"Excludes": [ "*.d.ts", "*.spec.ts"]
}
],
"Tests": [
{
"Path": "./ClientApp",
"Includes": [ "*.spec.ts" ]
}
]
}
我的项目的董事结构如下。 -表示一个文件夹并与其父文件夹对齐 没有破折号-文件-与其父文件夹对齐
.
--ClientApp
--test
boot-tests.ts
karma.conf.js
--app
--services
userservice.spec.ts
--components
--user
user.component.spec.ts
chutzpah.json
我在以下方面遇到错误:
[04/08/2019 5:42:11 AM Error] Chutzpah Error: System.IO.FileNotFoundException: Couldn't find generated path for c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\ClientApp\app\components\user\user.component.ts at c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\components\user\user.component.js or at c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\ClientApp\app\components\user\user.component.js
File name: 'c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\components\user\user.component.js'
While Running:c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\components\user\user.component.js
[04/08/2019 5:42:11 AM Error] Chutzpah Error: System.IO.FileNotFoundException: Couldn't find generated path for c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\ClientApp\app\Services\userService.service.ts at c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\Services\userService.service.js or at c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\ClientApp\app\Services\userService.service.js
File name: 'c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\Services\userService.service.js'
While Running:c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\..\bcr\ClientApp\app\Services\userService.service.js
[04/08/2019 5:42:13 AM Warning] No test is available in c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\components\user\user.component.spec.ts c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\services\userservice.spec.ts. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[04/08/2019 5:42:13 AM Informational] ========== Run test finished: 0 run (0:00:03.4786403) ==========
[04/08/2019 5:42:13 AM Informational] ------ Discover test started ------
[04/08/2019 5:42:14 AM Warning] Could not find file c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\services\_chutzpah.9218dcf4b6b4b472673c0bcd0684288e0938c13f.test.html.
[04/08/2019 5:42:14 AM Warning] None of the specified source(s) 'c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\services\_chutzpah.9218dcf4b6b4b472673c0bcd0684288e0938c13f.test.html' is valid. Fix the above errors/warnings and then try again.
[04/08/2019 5:42:15 AM Informational] ========== Discover test finished: 0 found (0:00:01.5145558) ==========
[04/08/2019 5:42:15 AM Informational] ------ Discover test started ------
[04/08/2019 5:42:16 AM Warning] Could not find file c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\components\user\_chutzpah.a7f7aff0f8ea850fa62fa9f9049e8c0bca8fd4d2.test.html.
[04/08/2019 5:42:16 AM Warning] None of the specified source(s) 'c:\users\brian\desktop\bcr\mobileapps\bcr\bcr\clientapp\app\components\user\_chutzpah.a7f7aff0f8ea850fa62fa9f9049e8c0bca8fd4d2.test.html' is valid. Fix the above errors/warnings and then try again.
[04/08/2019 5:42:16 AM Informational] ========== Discover test finished: 0 found (0:00:01.2250503) ==========
由于我以前没有使用过测试工具,所以对发生的事情一无所知。任何帮助/指针都将不胜感激。