writing avocado tests(写avocado测试用例)
2016-09-18 23:20
633 查看
翻译如下网站
http://avocado-framework.readthedocs.io/en/latest/WritingTests.html
【so-called 号称的,所谓的】
Writing Avocado Tests
We are going to write an Avocado test in Python and we are going to inherit from avocado.Test. This makes this test a so-called instrumented test.
我们打算写一个用python写一个avocado测试,而且这个测试类继承自avocado.Test,这让这个测试成为一个所谓的工具测试。
What is an Avocado Test
As can be seen in the example above, an Avocado test is a method that starts with test in a class that inherits from avocado.Test.
however,UTS test don’t inherits from avocado, it inherits from unittest,but there always are similar.
Since an Avocado test inherits from unittest.TestCase, you can use all the assertion methods that its parent.
assertEqual()
assertNotEqual()
assertTrue()
http://avocado-framework.readthedocs.io/en/latest/WritingTests.html
【so-called 号称的,所谓的】
Writing Avocado Tests
We are going to write an Avocado test in Python and we are going to inherit from avocado.Test. This makes this test a so-called instrumented test.
我们打算写一个用python写一个avocado测试,而且这个测试类继承自avocado.Test,这让这个测试成为一个所谓的工具测试。
import time from avocado import Test class SleepTest(Test): def test(self): sleep_length = self.params.get('sleep_length', default=1) self.log.debug("Sleeping for %.2f seconds", sleep_length) time.sleep(sleep_length)
What is an Avocado Test
As can be seen in the example above, an Avocado test is a method that starts with test in a class that inherits from avocado.Test.
however,UTS test don’t inherits from avocado, it inherits from unittest,but there always are similar.
Since an Avocado test inherits from unittest.TestCase, you can use all the assertion methods that its parent.
assertEqual()
assertNotEqual()
assertTrue()
相关文章推荐
- Writing Layout Tests for DumpRenderTree – WebKit
- What I Learned as a Junior Developer Writing Tests for Legacy Code(转载)
- Writing Layout Tests for DumpRenderTree – WebKit
- JUnit Test Infected: Programmers Love Writing Tests (zz)
- Writing Maintainable Automated Acceptance Tests
- Writing Clean Tests
- Writing Maintainable Automated Acceptance Tests
- 《ImageEffects(屏幕特效)官方文档翻译》——编写屏幕特效【Writing Image Effects】
- IELTS Writing Tips
- Writing Text Files On The Client in Oracle Forms 10g
- Error writing temporary file. Make sure your temp folder is valid
- vi 新建编辑文件时报错 E212 can’t open file for writing
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test]解决办法
- XCode 8.3 工程的Tests模块,编译提示Apple Mach-O Linker (Id) Errors错误
- Writing DynamicTableEntity to Azure Storage Table
- [翻译]Django1.11 Writing your first Django app, part 1
- [转]csharp:Microsoft.Ink 手写识别(HandWriting Recognition)
- webSocket多线程推送出错[TEXT_PARTIAL_WRITING]
- no output in console for unittests in pycharm 2017
- java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=findAll], {ExactMatcher:fDi