2

我有通过 Chutzpah 上下文菜单扩展(运行 JS 测试)运行的茉莉花测试。但是测试资源管理器没有发现它们,当我右键单击并选择运行测试时,“测试”的输出给了我这个:

System.ArgumentException: The directory name  is invalid.
   at System.IO.FileSystemWatcher..ctor(String path, String filter)
   at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.

这也是我的 chutzpah.json 文件:

{
    "Framework": "jasmine",
    "FrameworkVersion": "2",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "References": [
        { "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
        { "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
        { "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
        { "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
        { "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
        { "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/core.js" },

        { "Path": "prepare.js" },
        { "Path": "engine.js" }
    ],

    "Tests": [
        { "Path": "tests" }
    ],

    "CodeCoverageIncludes": [],
    "CodeCoverageExcludes": []
}

Solution structure:
DIB.MemberCatalog
  -Testing
    - DIB.MemberCatalog.Tests.JS
      - data
      - lib
        - jasmine-2.0.0
          - (jasmine files, boot, console, jasmine)
      - tests
        - testfiles.js
      - chutzpah.json
  -DIB.MemberCatalog
    - (more...)

我搜索了互联网,找不到解决方案。

4

1 回答 1

1

通过将我的测试项目名称从 DIB.MemberCatalog.Tests.JS 更改为 DIB.MemberCatalog.Tests.Client 来解决。当项目在项目名称的末尾有 javascript 文件扩展名时,就会发生混淆。

于 2015-01-12T21:39:04.653 回答