Flutter:测试,如何推断部分UI

时间:2018-11-26 16:58:21

标签: testing widget flutter

我有类似的东西:

class _RootPageState extends State<RootPage> {

@override
  Widget build(BuildContext context) {
    return StreamBuilder(
      key: Key("rootStreamBuilder"),
        stream: _bloc.loadRootPage,
        builder: (context, snapshot) {
          if (snapshot.hasData) {
                  ...

        });

我要测试此StreamBuilder,如何从此类中推断?这样我可以做类似的事情:

 testWidgets("test", (WidgetTester tester) async {


     await tester.pumpWidget(new MaterialApp(
       home: StreamBuilder
              ...

0 个答案:

没有答案