![](/img/trans.png)
[英]how do I unit test with multiple expect
當有3個期望時,我在下面編寫的單元測試不起作用,我該如何重寫下面的單元測試: ...
[英]how do I unit test with multiple expect
當有3個期望時,我在下面編寫的單元測試不起作用,我該如何重寫下面的單元測試: ...
[英]How to unit test a stream that is returned from a function?
我有以下設置: 我收到此錯誤: 如何正確測試上述流? ...
[英]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()方法,然后運行相同的測試集。 目前,我的代碼如下所示: 如何合並此代碼? ...
[英]How to debug browser tests with the new test package
瀏覽器測試需要從命令行運行,如pub run test -pdartium 。 有沒有辦法調試這樣的測試。 ...
[英]Dart - How run a function after or before each test?
我正在使用Dart測試包: https : //pub.dartlang.org/packages/test 通常,我想在測試文件中的每個測試之前或之后運行一些函數。 測試包是否為此提供了一些東西? ...
[英]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 with test api, run/debug error
我使用的是WebStorm IDE和之前稱為unittest的 測試 api。 使用以下命令測試工作正常: 發布運行測試:test test / sample.dart /test/sample.dart 但是當我嘗試使用WebStorm DartUnit運行/調試測 ...
[英]Failed to load dartium when running test
我正在使用測試庫運行dart測試。 當執行此命令時,我得到以下錯誤,我已經下載了dartium和dart sdk並且在系統路徑中。 ...
[英]The built-in library 'dart:html' is not available on the stand-alone VM
我希望能夠對我的定制聚合物元素進行單元測試。 給定lib / web_components中的一個組件: 和test / web_components中的測試: 運行測試會導致標題中提到的錯誤。 我怎樣才能避免這個錯誤? 編輯: 所以我嘗試在客戶端測試文件的頂 ...
[英]How can I make test inside a then statement in Dart
我想對某些功能進行一些單元測試,但是我需要在Future完成后執行所有測試。 為了解決我的問題,這里是我想做的一個例子: registerToServer(contentOfRequest).then((id){ test('test function1', () { fun ...
[英]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 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 test a method using a Future in Dart?
我想測試一個在另一台服務器上執行POST的方法: Future executePost() { _client.post("http://localhost/path", body : '${data}').then((response) { _logger.info("Respo ...
[英]How to mock server response - client on server side
我正在嘗試飛鏢,我正在服務器端編寫一個客戶端: new HttpClient().post(InternetAddress.LOOPBACK_IP_V4.host, 7474, '/path').then((HttpClientRequest request) { request.header ...
[英]Write unittest and save in the separate folder
我正在為我的班級寫一個單元測試。 首先,我安裝包unittest並創建一個spec文件夾來保存我的所有unittest文件。 然后我創建一個測試dart文件,其中包含以下內容: library i18n_test; import 'package:unittest/unittest.da ...