Skip to content

Commit

Permalink
* [fix] update usage message show
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed Aug 26, 2024
1 parent db8427a commit 56421d8
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG.md

## 3.3.0-beta.3 (2024-08-26)

- 优化部分异常情况下错误提示
- 新增login子命令排查ztf命令行与禅道通信问题
- 修复部分错误表述信息
- 更新demo示例,统一使用新格式用例
- 新增`ZTF_DEBUG`环境变量,用于调试模式

## 3.3.0-beta.2 (2024-08-14)

- 修复启动客户端异常
Expand Down
4 changes: 2 additions & 2 deletions cmd/test/cli/cli_run_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ func (s *RunUnitSuit) TestRunTestng(t provider.T) {
testngDir := fmt.Sprintf("%scmd/test/demo/ci_test_testng", constTestHelper.RootPath)
t.ID("5432")
t.Title("执行TestNG单元测试")
cloneGit("https://gitee.com/ngtesting/ci_test_testng.git", testngDir)
cloneGit("https://github.com/easysoft/ci_test_testng.git", testngDir)
t.Require().Equal("Success", testRunUnitTest("mvn clean package test", testngDir, regexp.MustCompile(`Tests run\: 3, Failures\: 0, Errors\: 0, Skipped\: 0`)))
}

func (s *RunUnitSuit) TestRunPytest(t provider.T) {
pytestDir := fmt.Sprintf(".%scmd/test/demo/ci_test_pytest", constTestHelper.RootPath)
t.ID("5435")
t.Title("执行PyTest单元测试")
cloneGit("https://gitee.com/ngtesting/ci_test_pytest.git", pytestDir)
cloneGit("https://github.com/easysoft/ci_test_pytest.git", pytestDir)

t.Require().Equal("Success", testRunUnitTest("pytest --junitxml=testresults.xml", pytestDir, regexp.MustCompile("1 failed, 1 passed")))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/test/ui/ui_run_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func RunTestNG(t provider.T) {
testngDir := filepath.Join(constTestHelper.RootPath, "cmd", "test", "demo", "ci_test_testng")
workspaceName := "testng工作目录"

commonTestHelper.CloneGit("https://gitee.com/ngtesting/ci_test_testng.git", testngDir)
commonTestHelper.CloneGit("https://github.com/easysoft/ci_test_testng.git", testngDir)
shellUtils.ExeShellWithOutputInDir("mvn clean package test", testngDir)

t.ID("5432")
Expand Down
4 changes: 2 additions & 2 deletions internal/command/action/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func PrintUsage() {

usageData, _ := resUtils.ReadRes(usageFile)
exeFile := commConsts.App
if !zos.IsUnix() {
if zos.NotUnix() {
exeFile += ".exe"
}
usage := fmt.Sprintf(string(usageData), exeFile)
Expand All @@ -36,7 +36,7 @@ func PrintUsage() {

sampleData, _ := resUtils.ReadRes(sampleFile)
sample := string(sampleData)
if !zos.IsUnix() {
if zos.IsUnix() {
regx, _ := regexp.Compile(`\\`)
sample = regx.ReplaceAllString(sample, "/")

Expand Down
5 changes: 4 additions & 1 deletion internal/pkg/helper/zentao/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"

"github.com/davecgh/go-spew/spew"
"github.com/ergoapi/util/environ"
"github.com/fatih/color"

commDomain "github.com/easysoft/zentaoatf/internal/pkg/domain"
Expand Down Expand Up @@ -80,7 +81,9 @@ func CheckIn(productId string, cases []string, config commDomain.WorkspaceConf,

steps := scriptHelper.GetStepAndExpectMap(cs)
script, _ := scriptHelper.GetScriptContent(cs, -1)
spew.Dump(steps)
if environ.GetEnv("ZTF_DEBUG", "fasle") == "true" {
spew.Dump(steps)
}
err = CommitCase(productId, caseId, title, steps, script, config, noNeedConfirm, withCode)

if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion res/doc/sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $>ztf.exe run demo\demo -p 1 -t task1 -cr -cb 执行目录demo下的脚
$>ztf.exe run demo\autoit 执行ZTF自带AutoIT脚本。
$>ztf.exe run demo\selenium\chrome.php --interp runtime\php\php7\php.exe 执行ZTF自带Selenium脚本,使用指定PHP解释器。
$>ztf.exe run demo\appium\android.php --interp runtime\php\php7\php.exe 执行ZTF自带Appium脚本,使用指定PHP解释器。
$>ztf.exe junit -p 1 mvn clean package test 执行junit单元测试脚本,更多请参照https://www.ztesting.net/book/ztf-doc/junit-33.html
$>ztf.exe junit -p 1 mvn clean package test 执行junit单元测试脚本,更多请参照https://ztf.im/book/ztf-doc/junit-33.html
$>ztf.exe expect demo\sample\1_simple.php 在脚本1_simple.php的同目录下,生成.exp期待结果文件。
$>ztf.exe extract demo\sample\8_extract_desc.php 提取脚本中的注释,生成用例步骤和期待结果。
$>ztf.exe ci product01\tc-1.py 将脚本里修改的用例信息,同步到禅道系统。
Expand Down
3 changes: 2 additions & 1 deletion res/doc/usage.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
help -h 查看帮助信息。
set -s 设置语言、禅道系统同步参数。用户对当前目录需要有写权限。
login -l 仅用于验证当前配置可否登录到禅道系统。
co checkout 导出禅道系统中的用例,已存在的将更新标题和步骤描述。可指定产品、套件、测试单编号。
run -r 执行用例。可指定目录、套件、脚本、结果文件路径,以及套件和任务编号,多个文件间用空格隔开。
junit|testng 执行JUnit、TestNG、PHPUnit、PyTest、JTest、CppUnit、GTest、QTest单元测试脚本
Expand All @@ -15,4 +16,4 @@ version --version 查看应用版本
--verbose 增加此参数,用于显示详细日志,如Http请求、响应、错误等信息。

为了方便在任意目录中执行%s命令,建议将其加入环境变量中,具体方法参照以下地址。
https://www.ztesting.net/book/ztf-doc/add-to-path-46.html
https://ztf.im/book/ztf-doc/add-to-path-46.html
2 changes: 1 addition & 1 deletion res/server/zh/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@
},
{
"id": "only_test_auth_login",
"translation": "使用账号 %s 测试 %s登录接口是否正常"
"translation": "使用账号 %s 测试禅道 %s 通信是否正常"
},
{
"id": "login_success",
Expand Down

0 comments on commit 56421d8

Please sign in to comment.