简体   繁体   English

Flutter集成测试,如何确保用户退出? (冲洗状态)

[英]Flutter integration test, how to ensure user is signed out? (flushed state)

I'm writing my first Flutter integrations tests, and noticed that when the app starts up, the user is already signed in and lands on the page after sign in. I don't know why this happens, maybe because the app has been running previously on the same device in development mode with a signed in user?我正在编写我的第一个 Flutter 集成测试,并注意到当应用程序启动时,用户已经登录并在登录后登陆页面。我不知道为什么会发生这种情况,可能是因为应用程序一直在运行以前在开发模式下使用登录用户在同一设备上?

Is there a way to start the tests with no previous state, no sessions, etc?有没有办法在没有以前的 state、没有会话等的情况下开始测试? I can't find anything in the documentation for this.我在文档中找不到任何内容。

Use setUp and tearDown to set/clear state before/after each test.在每次测试之前/之后,使用setUptearDown设置/清除 state。

setUp(() async {
  // TODO
});

tearDown(() async {
  // TODO
});

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

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