用于测试Python代码和JavaScript的自动化工具
有没有人知道有什么免费的自动化测试工具,可以用来测试Python代码和JavaScript代码的单元测试?
3 个回答
0
试试使用 https://replit.com,这是一个基于网页的Python编程环境。
0
可以试试nose这个工具,链接是 http://code.google.com/p/python-nose/。
1
你可能会想把几个测试框架组合在一起。我们的团队使用 nose,正如 @Arbie 提到的那样,链接在这里:http://code.google.com/p/python-nose/。
我们还用 nose 来运行 selenium 测试,链接在这里:http://seleniumhq.org/,这是我知道的唯一有效测试操作 DOM 的 JavaScript 的方法。虽然我对 selenium 2 中的 WebDriver 很有期待,希望它能稳定下来。使用 selenium 的时候,我们不得不对 python 驱动进行一些修改,让它更符合 Python 的风格。我们把 python-selenium 驱动包装成这样:
selenium.doCommand('waitForElementPresent', 'selector')
变成:
selenium.wait_for_element_present('selector')
这样你就可以用 nose 和 selenium 来运行 QUnit 测试,链接在这里:http://docs.jquery.com/Qunit,如果你只是想测试一些基本的 JavaScript 函数,而这些函数不一定会改变 DOM。
下面是一个 selenium 集成的例子:
def setUp(self):
self.test_url = "http://your_domain"
self.selenium = selenium("localhost", 4444, "*firefox3", self.test_url)
self.selenium.start()
def tearDown(self):
self.selenium.stop()