禅道ZTF发布2.3版本,优化用例描述格式。

原创
陈琦
2021-05-10 09:00:00
3933

2019年11月发布2.0版本之后,ZTF受到了禅道新老用户以及自动化测试人员的广泛关注。近年来,持续集成和DevOps在行业中的运用越发广泛,二者在缩短测试周期、提高测试效率和产品发布质量方面,起到了日益重要的作用。

为了更好地服务于用户,我们在2.2版本中,支持了单元、自动化测试有关框架和工具;这次发布2.3版本,主要优化了用例描述的格式,修复了一些小的问题。


ZTF支持与禅道无缝集成,可将禅道用例和测试脚本进行同步,执行结果可自动提交到禅道并生成测试报告,执行失败的用例可通过命令在禅道中创建Bug。ZTF自动化测试框架实现了与Jenkins持续集成功能的打通。用户发起Jenkins构建后,通过ZTF调度执行测试脚本,结束后把单元和功能测试的结果回传给禅道,二者合作打通了持续集成的闭环。


欢迎大家下载试用,并提出宝贵建议。

一、2.3版本更新记录:

  1. 更好支持主流的AutoIT、Selenium、Appium、RobotFramework和Cypress自动化测试工具,轻松完成自动化测试执行调度,并将结果和缺陷提交到禅道
  2. 支持 JUnit, TestNG, PHPUnit, PyTest, Jest, CppUnit, GTest, QTest 8种单元测试框架,ZTF执行单元测试、解析测试输出、提交到禅道生成测试报告和缺陷;
  3. 优化用例描述格式,用户编写测试用例的步骤和期待结果时更为方便;
  4. 新增expect命令,用于执行测试、生成独立的测试结果.exp文件;
  5. 修复了一些小的问题。

二、下载地址:

三、帮助文档

  1. Jenkins持续集成文档
  2. 自动化测试文档
  3. 单元测试文档

四、界面展示

Jenkins集成配置:

注:第1-4行,根据禅道传过来的参数,签出对应tag或revision的代码。具体请参考 禅道集成版本库和Jenkins进行构建

       第5行,为使用ZTF执行JUnit单元测试的样例,更多测试框架的调用方法,请参考 本手册5.9 - 5.10小节


Jenkins自动化测试结果:

禅道自动化测试报告展示:

支持AutoIT、Selenium、Appium、RobotFramework和Cypress自动化测试,内嵌PHP运行时和Selenium Driver。相关代码可参考demo目录和这里

Selenium自动化测试样例:


#!/usr/bin/env php
<?php
/**
title=use ztf to run selenium test
cid=0
pid=0
1. check webpage title >> 禅道_百度搜索
*/
namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Chrome\ChromeOptions;
include 'vendor/autoload.php';
// launch build-in selenium driver to test
if (isWindows())
{
	$command = 'start ' . dirname(__FILE__, 3) . '\runtime\selenium\chrome80.exe >log.txt 2>&1';
    //	exec("CHCP 936");
} else // for no-windows system, pls download chrome driver from https://chromedriver.storage.googleapis.com/index.html
{
    $command = 'nohup ' . dirname(__FILE__, 3) . '/runtime/selenium/chrome80 >log.txt 2>&1 &';
}
pclose(popen($command, 'r'));
$host = 'http://127.0.0.1:9515';
$options = new ChromeOptions();
$options->addArguments(['--no-sandbox']); // ['--headless', '--no-sandbox']
$desiredCapabilities = DesiredCapabilities::chrome();
$desiredCapabilities->setCapability(ChromeOptions::CAPABILITY, $options);
$driver = RemoteWebDriver::create($host, $desiredCapabilities);
$driver->get("https://www.baidu.com");
$html= $driver->getPageSource();
// print_r("$html \n");
$keywordsInput = $driver->findElement(WebDriverBy::id('kw'));
$keywordsInput->clear();
$keywordsInput->sendKeys("禅道");
$submitButton = $driver->findElement(WebDriverBy::id('su'));
$submitButton->click();
$driver-> wait(10, 500)-> until(WebDriverExpectedCondition::titleContains('禅道'));
$title = $driver->getTitle();
//if (isWindows()) $title = iconv("UTF-8","GB2312", $title);
print("$title\n");
$driver->close();
if (isWindows())
{
    exec('taskkill /F /im chrome80.exe');
} else
{
    exec('ps -ef | grep chrome80 | grep -v grep | xargs kill -9 2>/dev/null');
}
function  isWindows()
{
    return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}


文章分类
联系我们

联系人:

电话:

Email:

QQ:

地址:青岛市黄岛区长江西路118号青铁广场18楼

云禅道

云端的项目管理软件

尊享禅道项目软件收费版功能

无需维护,随时随地协同办公

内置subversion和git源码管理

每天备份,随时转为私有部署

免费试用