简体   繁体   English

在flutter中编写集成测试时如何拆分测试

[英]how to split tests when writing integration test in flutter

I'm trying to write an integration test with flutter.我正在尝试用颤振编写集成测试。 In some cases I need to repeat the same process.在某些情况下,我需要重复相同的过程。 such as adding a new line I want to make these new line insertion codes as a separate method and call them wherever I want in the test.例如添加一个新行我想将这些新行插入代码作为一个单独的方法并在测试中我想要的任何地方调用它们。 but I couldn't find how to do但我找不到怎么做

How can I make some test lines a method in the integration test and call it like a method in the test case I want?如何使一些测试行成为集成测试中的方法,并像我想要的测试用例中的方法一样调用它?

this is the solution i was looking for:这是我正在寻找的解决方案:

class HomeRobot {
  const HomeRobot(this.tester);
  final WidgetTester tester;
  Future<void> findTitle() async {}
  Future<void> scrollThePage({bool scrollUp = false}) async {}           
  Future<void> clickFirstButton() async {}
  Future<void> clickSecondButton() async {}
}

https://medium.com/flutter-community/integration-testing-in-flutter-b25c62ec287c https://medium.com/flutter-community/integration-testing-in-flutter-b25c62ec287c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM