草庐IT

power_unit

全部标签

unit-testing - 如何测试在 Flutter 中使用 package_info 的方法?

我正在编写一个Flutter插件,用于检查PlayStore或AppStore以确定应用是否需要更新。我正在使用package_info包来确定用户拥有的应用程序版本。我的代码如下所示:getVersionStatus(){PackageInfopackageInfo=awaitPackageInfo.fromPlatform();localVersion=packageInfo.version;...}我想测试这个方法,但如果它作为单元测试运行它,fromPlatform调用就会挂起并使测试超时。有没有比传入testingbool值更优雅的方法来解决这个问题?即:if(testing

unit-testing - Flutter: 'package:shared_preferences/shared_preferences.dart':断言失败:第 33 行 pos 16: 'key.startsWith(_prefix)':不正确

我正在对共享首选项运行一些单元测试。我正在制作一个帮助程序类,这样我们就不必一遍又一遍地编写相同的代码。无论我尝试什么,我总是一遍又一遍地得到同样的错误。您将找到我正在测试的类、测试类和堆栈跟踪。我希望这是我忘记的蠢事。我尝试了这些资源:https://pub.dartlang.org/packages/shared_preferencesunittestingflutterhttps://flutter.dev/docs/cookbook/persistence/key-valueshared_preferences_helper_test.dart:import'package:f

unit-testing - Flutter: 'package:shared_preferences/shared_preferences.dart':断言失败:第 33 行 pos 16: 'key.startsWith(_prefix)':不正确

我正在对共享首选项运行一些单元测试。我正在制作一个帮助程序类,这样我们就不必一遍又一遍地编写相同的代码。无论我尝试什么,我总是一遍又一遍地得到同样的错误。您将找到我正在测试的类、测试类和堆栈跟踪。我希望这是我忘记的蠢事。我尝试了这些资源:https://pub.dartlang.org/packages/shared_preferencesunittestingflutterhttps://flutter.dev/docs/cookbook/persistence/key-valueshared_preferences_helper_test.dart:import'package:f

unit-testing - 测试框架意外退出 - Mac 上的 Dart 项目

我正在尝试为我的Flutter项目开发一个Dart包。它仅包含Dart(因此没有Flutter)代码。尝试使用AndroidStudio或IntelliJ运行我的单元测试时,出现以下错误:测试框架意外退出在输出窗口中,我收到以下消息:Testingstartedat21:38.../Users//development/flutter/bin/cache/dart-sdk/bin/pubruntest-rjson/Users//Projects/personal//Observatorylisteningonhttp://127.0.0.1:57505/Couldnotfindafil

unit-testing - 测试框架意外退出 - Mac 上的 Dart 项目

我正在尝试为我的Flutter项目开发一个Dart包。它仅包含Dart(因此没有Flutter)代码。尝试使用AndroidStudio或IntelliJ运行我的单元测试时,出现以下错误:测试框架意外退出在输出窗口中,我收到以下消息:Testingstartedat21:38.../Users//development/flutter/bin/cache/dart-sdk/bin/pubruntest-rjson/Users//Projects/personal//Observatorylisteningonhttp://127.0.0.1:57505/Couldnotfindafil

unit-testing - Fluent NHibernate - HiLo 方案的 PersistenceSpecification

不确定我问的问题是否正确,所以请多多包涵!一点NHibernate新手。我们正在使用FluentNH并且所有表都有以下id生成方案publicclassIdGenerationConvention:IIdConvention{publicvoidApply(IIdentityInstanceinstance){varwhere=string.Format("TableKey='{0}'",instance.EntityType.Name);instance.GeneratedBy.HiLo("HiloPrimaryKeys","NextHighValue","1000",x=>x.Ad

unit-testing - Fluent NHibernate - HiLo 方案的 PersistenceSpecification

不确定我问的问题是否正确,所以请多多包涵!一点NHibernate新手。我们正在使用FluentNH并且所有表都有以下id生成方案publicclassIdGenerationConvention:IIdConvention{publicvoidApply(IIdentityInstanceinstance){varwhere=string.Format("TableKey='{0}'",instance.EntityType.Name);instance.GeneratedBy.HiLo("HiloPrimaryKeys","NextHighValue","1000",x=>x.Ad

unit-testing - FluentNhibernate 和 SQLite

我无法让SQLite驱动程序在我的session工厂中工作。我从http://sqlite.phxsoftware.com/下载了SQLite1.0.48我在我的测试项目中添加了对System.Data.SQLite的引用。publicstaticIPersistenceConfigurerGetSqlLiteConfigurer(){try{returnSQLiteConfiguration.Standard.InMemory();}catch(Exceptionex){throwex;}}这就是我生成配置器的方式问题是当我构建session工厂时出现以下错误:NHibernate.

unit-testing - FluentNhibernate 和 SQLite

我无法让SQLite驱动程序在我的session工厂中工作。我从http://sqlite.phxsoftware.com/下载了SQLite1.0.48我在我的测试项目中添加了对System.Data.SQLite的引用。publicstaticIPersistenceConfigurerGetSqlLiteConfigurer(){try{returnSQLiteConfiguration.Standard.InMemory();}catch(Exceptionex){throwex;}}这就是我生成配置器的方式问题是当我构建session工厂时出现以下错误:NHibernate.

sqlite - Symfony2 : Unit testing with sqlite

我在Symfony2中使用phpunit。我决定使用sqlite进行测试。我遇到的问题是外键约束被忽略了。我知道我必须执行以下查询才能使用外键:PRAGMAforeign_keys=ON)。我的问题是:有没有办法在使用sqlite创建数据库模式时始终使用外键?谢谢! 最佳答案 不幸的是,这是不可能的。根据SQLitedocumentation:Assumingthelibraryiscompiledwithforeignkeyconstraintsenabled,itmuststillbeenabledbytheapplicatio