Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我正在尝试使用 Robotium for Android 编写自动化测试我有一个与我的 LoginPage 相关的测试套件,问题是 setUp 和 tearDown 在每次测试之前和之后都会被调用,所以它会在每个测试用例上关闭并打开应用程序。
是否有可能以某种方式避免这种情况,以便为每个测试套装调用一次设置和拆卸?
编辑:
我正在使用 ActivityInstrumentationTestCase2
请改用 SingleLaunchActivityTestCase。
我不确定Robotium,但是junit具有@BeforeClass和@AfterClass注释,您可以将其应用于方法,以便在测试套件实例化之前或之后仅调用一次。在此处查看更多信息:
http://junit.sourceforge.net/doc/faq/faq.htm#organize_3