[英]Visual Studio: Can I export parameter values from debug flow to unit test data inputs?
For instance, I've got a complex function Foo(ObjectA a, ObjectB b)
where a
and b
take a substantial amount of time to compose (because they're coming from a non-local server that cannot be localized for testing purposes), I'd love to be able to snatch these guys up in Visual Studio debug and say, here, make me a unit test or something where I can quickly load these values up again statically. 例如,我有一个复杂的函数
Foo(ObjectA a, ObjectB b)
,其中a
和b
需要花费大量时间来编写(因为它们来自非本地服务器,该本地服务器无法进行测试) ,我很希望能够在Visual Studio调试中抢这些家伙,然后说,在这里,让我进行单元测试,或者可以快速地再次静态地加载这些值的东西。
Thanks! 谢谢!
--edit-- we're definitely assuming that the a and b are serializable or something, where they'll be stored off in some persistent data storage file, and retrieved when the unit test starts up. --edit--我们绝对假设a和b是可序列化的或类似的东西,它们将被存储在一些持久数据存储文件中,并在单元测试启动时被检索。
Just a workaround I could provide: 我可以提供一种解决方法:
You could export the object value during debugging with certain extension tool like Object Exporter, and then read the file with database or others in your unit test(data driven unit test). 您可以在调试过程中使用某些扩展工具(例如Object Exporter)导出对象值,然后在单元测试(数据驱动的单元测试)中与数据库或其他文件一起读取文件。
https://marketplace.visualstudio.com/items?itemName=OmarElabd.ObjectExporter https://marketplace.visualstudio.com/items?itemName=OmarElabd.ObjectExporter
But whether the saved value was refreshed before the unit test calls the saving file, it would be a testing issue. 但是,是否在单元测试调用保存文件之前刷新保存的值,这将是一个测试问题。 Hope it could provide a path for you.
希望它可以为您提供一条道路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.