cost 101 ms
如何為包含子字符串的字符串創建匹配器,同時忽略大小寫

[英]How can make a matcher for a string containing a substring, while ignoring case

我正在使用 mockito 編寫一個單元測試來模擬依賴項並檢查我們是否使用正確的參數調用它。 我們應該傳入一個字符串,因此我嘗試匹配該函數參數,但不會對整個字符串進行斷言,以防我們更改措辭。 所以我只想匹配消息中的一個詞,但該詞可能位於句子的開頭或中間,因此它可能以大寫開頭。 dart 匹配器具 ...

兩種不同的設置方法用於相同的測試

[英]Two different setUp methods for the same tests

我目前有兩組測試,除了setUp()方法調用外,它們在每種方式上都是相同的。 我想簡化代碼,以使測試集僅定義一次,但是每個組都運行自己的setUp()方法,然后運行相同的測試集。 目前,我的代碼如下所示: 如何合並此代碼? ...

Dart - 每次測試之后或之前如何運行函數?

[英]Dart - How run a function after or before each test?

我正在使用Dart測試包: https : //pub.dartlang.org/packages/test 通常,我想在測試文件中的每個測試之前或之后運行一些函數。 測試包是否為此提供了一些東西? ...

Dart-如何針對調用exit()的函數編寫測試?

[英]Dart - How do you write a test against a function that calls exit()?

我想測試一個調用exit的函數。 基本上,我有一個控制台應用程序,詢問用戶是否確定要覆蓋目錄。 用戶回答“否”時,目錄不會被覆蓋,程序應退出。 因此,我想測試一下,如果用戶回答“否”,則該程序確實退出了。 但是,如果我對此進行測試,則我的測試跑步者將退出。 在python ...

如何使用服務范圍編寫測試

[英]How to write tests using the service scope

我的應用程序從服務范圍的訪問對象( package:gcloud/service_scope.dart ),像storageService和我把域內提供更多服務ss.register() 現在,我要對訪問此范圍的函數進行單元測試,並使用要放入服務范圍的模擬對象。 這樣做的唯一方法是為 ...

測試包中是否有正則表達式匹配器

[英]Is there a regex matcher in the test package

我有一個像<span class="percent-complete-bar" style="width: 85%; background: green;"></span>這樣的元素,我想檢查style屬性是否包含width: xx%; 正則表達式如r'width: \ ...

WebStorm DartUnit與測試API,運行/調試錯誤

[英]WebStorm DartUnit with test api, run/debug error

我使用的是WebStorm IDE和之前稱為unittest的 測試 api。 使用以下命令測試工作正常: 發布運行測試:test test / sample.dart /test/sample.dart 但是當我嘗試使用WebStorm DartUnit運行/調試測 ...

運行測試時無法加載dartium

[英]Failed to load dartium when running test

我正在使用測試庫運行dart測試。 當執行此命令時,我得到以下錯誤,我已經下載了dartium和dart sdk並且在系統路徑中。 ...

內置庫'dart:html'在獨立VM上不可用

[英]The built-in library 'dart:html' is not available on the stand-alone VM

我希望能夠對我的定制聚合物元素進行單元測試。 給定lib / web_components中的一個組件: 和test / web_components中的測試: 運行測試會導致標題中提到的錯誤。 我怎樣才能避免這個錯誤? 編輯: 所以我嘗試在客戶端測試文件的頂 ...

即使滿足期望,測試仍會失敗

[英]Test is failing even though expectations are met

我有一個看起來像這樣的測試: test('should throw error if threshold is null', (){ final findEngine = new FindEngine<Foo>(); expect(findEngine.streamResu ...

Dart事件隊列:如何調試事件隊列?

[英]Dart Event Queue: How to debug event queue?

我正在編寫一些集成測試,它們使用HttpServer ,一堆Directory().watch() ',以及可能的其他未來/流監聽代碼。 我正在使用以下測試配置: class LaserServerTestConfiguration extends SimpleConfiguration ...

飛鏢單元測試-始終通過

[英]Dart Unit Test - Always passing

所有, 這是用於檢查集合大小的單元測試 main() { test("Resource Manager Image Load", () { ResourceManager rm = new ResourceManager(); int WRONG_SIZE = 100 ...

如何模擬服務器響應 - 服務器端的客戶端

[英]How to mock server response - client on server side

我正在嘗試飛鏢,我正在服務器端編寫一個客戶端: new HttpClient().post(InternetAddress.LOOPBACK_IP_V4.host, 7474, '/path').then((HttpClientRequest request) { request.header ...

編寫unittest並保存在單獨的文件夾中

[英]Write unittest and save in the separate folder

我正在為我的班級寫一個單元測試。 首先,我安裝包unittest並創建一個spec文件夾來保存我的所有unittest文件。 然后我創建一個測試dart文件,其中包含以下內容: library i18n_test; import 'package:unittest/unittest.da ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM