我可以跳过JUnit测试,如果其他测试失败? [英] Can I Skip Junit Tests if other tests fail?

查看:337
本文介绍了我可以跳过JUnit测试,如果其他测试失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的的Junit 与运行测试的 Seleniun的webdriver 。我想我的测试分成功能区更好的错误报告。我创建了测试,以测试页面加载/移动文件到其他工作流。如果一个页面加载测试失败,或者工作流移动将失败我想跳过后续页/工作流程测试。

I'm using Junit to run tests with Seleniun WebDriver. I'm trying to split up my tests into function area for better error reporting. I've created tests to test Page load/moving documents to other workflows. If a page load test fails, or a workflow move fails I want to skip the subsequent page/workflow tests.

如果测试A出现故障我如何在B类跳过无论是在类中的测试和运行测试的休息吗?

if a Test A fails how can I skip either the rest of the tests in the class or running tests in Class B?

注意:
我知道什么,我问的是坏实践*为的单元测试的,但实际上,我使用JUnit进行的集成的和/或自动化测试。(根据您的定义。)
我已经找到 @ Suite.SuiteClasses @FixMethodOrder 命令我的测试类和测试方法。我试图责令其逻辑运行,测试页面加载,第一,那么每个页面的功能作为一个单独的测试。一些特点,移动信息到其他页面,meanining其他类。我班1可以在半小时才能完成。如果pre-REQ测试失败,我想简短circuite的依赖的测试中,为了得到我的结果/报告越快。

NOTE: I realize what I'm asking is "bad Practice* for UNIT TESTS. However, I'm actually using Junit for Integration and/or Automation Testing. (Depending on your definition.) I've already found @Suite.SuiteClasses, and @FixMethodOrder to order my test classes and test methods. I'm trying to order them to run logically, testing the page load, first, then each feature of the page as a seperate test. Some of the features, move the information to other pages, meanining other classes. 1 of my classes can take over 1/2 hour to finish. If the pre-req tests fail, I'd like to short circuite the "Dependent" tests, in order to get my results/report sooner.

推荐答案

我建议你切换到TestNG的。检查的出来。

I suggest you switching to TestNG. Check this out.

BTW:当我使用与Java工作 - 几乎是一年前 - 我没有找到的JUnit这样的解决方案

Btw:When I used to work with Java - almost one year ago - I didn't find such a solution for JUnit.

这篇关于我可以跳过JUnit测试,如果其他测试失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆