Skip to content

Commit

Permalink
Merge pull request #6 from WilliamYinwei/32bit
Browse files Browse the repository at this point in the history
增加对C++测试用例的支持
  • Loading branch information
WilliamYinwei authored May 25, 2020
2 parents cf5a401 + 2ad9599 commit 56d362f
Show file tree
Hide file tree
Showing 124 changed files with 2,910 additions and 949 deletions.
6 changes: 6 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
2、登录TreeATE的默认用户名/密码: admin/123
3、加载Example中的测试工程,点击Play(测试)

V2.0.0
-------------------
1、变更TreeATE的License为LGPL v3
2、保留TreeATEDev的License为GPL v3
3、增加对C++测试用例的支持

V1.2.2
-------------------
1、让TreeATE Dev支持多工程的编辑;
Expand Down
3 changes: 2 additions & 1 deletion Example/Example.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TEMPLATE = subdirs

SUBDIRS += \
LocalSqlite
LocalSqlite \
TestCppDemo
6 changes: 3 additions & 3 deletions Example/LocalSqlite/localsqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/// @brief demo of the output to database model
/// @author David Yin 2018-12 willage.yin@163.com
///
/// @license GNU GPL v3
/// @license GNU LGPL v3
///
/// Distributed under the GNU GPL v3 License
/// Distributed under the GNU LGPL v3 License
/// (See accompanying file LICENSE or copy at
/// http://www.gnu.org/licenses/gpl.html)
/// http://www.gnu.org/licenses/lgpl-3.0.html)
///

#include "localsqlite.h"
Expand Down
6 changes: 3 additions & 3 deletions Example/LocalSqlite/localsqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/// @brief demo of the output to database model
/// @author David Yin 2018-12 willage.yin@163.com
///
/// @license GNU GPL v3
/// @license GNU LGPL v3
///
/// Distributed under the GNU GPL v3 License
/// Distributed under the GNU LGPL v3 License
/// (See accompanying file LICENSE or copy at
/// http://www.gnu.org/licenses/gpl.html)
/// http://www.gnu.org/licenses/lgpl-3.0.html)
///

#ifndef LOCALSQLITE_H
Expand Down
7 changes: 7 additions & 0 deletions Example/TestCppDemo/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# TestCppDemo
C++测试用例样例

# 注意事项
* 与Python和JavaScript的测试工程一样,测试用例组件需要与后缀tp和tpx同文件名;
* 编译TestCppDemo时依赖了TACppBase.lib
* 开发完成生成TestCppDemo.dll后,发布时需要依赖DevLangCpp.dll,删除该测试工程的源代码;
Binary file added Example/TestCppDemo/TestCppDemo.dll
Binary file not shown.
28 changes: 28 additions & 0 deletions Example/TestCppDemo/TestCppDemo.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#-------------------------------------------------
#
# Project created by QtCreator 2020-05-03T17:30:11
#
#-------------------------------------------------

QT -= gui

TARGET = TestCppDemo
TEMPLATE = lib

DEFINES += TESTCPPDEMO_LIBRARY

CONFIG(release, debug|release): DESTDIR = ../../bin
CONFIG(debug, debug|release): DESTDIR = ../../bind

INCLUDEPATH += ../../Libs/TACppBase
LIBS += -L$$DESTDIR/libs/ -lTACppBase

SOURCES += testcppdemo.cpp

HEADERS += testcppdemo.h\
testcppdemo_global.h

unix {
target.path = /usr/lib
INSTALLS += target
}
92 changes: 92 additions & 0 deletions Example/TestCppDemo/TestCppDemo.tp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"Desc": "demo",
"Name": "testdemo",
"Parameter": {
"Name1": "gfedcba",
"Name2": "abcdefg"
},
"Public": {
"Models": [
{
"Com": "TA_MsgBox.dll",
"Obj": "ta"
},
{
"Com": "Sleep.js",
"Obj": "bb"
}
],
"Parameter": [
{
"Desc": "asd",
"Name": "Gabc",
"Value": "123"
},
{
"Desc": "111",
"Name": "Gdd",
"Value": "111"
},
{
"Desc": "all of this",
"Name": "Gall",
"Value": "22.3"
}
]
},
"TestSuite": [
{
"Desc": "suite2 test",
"Name": "suite2",
"Parameter": {
"Name1": "2",
"Name2": "2"
},
"TestCase": [
{
"Desc": "描述2",
"Name": "test2",
"Parameter": {
"Name1": "1",
"Name2": "2"
}
},
{
"Desc": "描述1",
"Name": "test1",
"Parameter": {
"Name1": "1",
"Name2": "2"
}
}
]
},
{
"Desc": "suite1描述",
"Name": "suite1",
"Parameter": {
"Name1": "2",
"Name2": "2"
},
"TestCase": [
{
"Desc": "描述1",
"Name": "test1",
"Parameter": {
"Name1": "1",
"Name2": "2"
}
},
{
"Desc": "描述2",
"Name": "test2",
"Parameter": {
"Name1": "1",
"Name2": "2"
}
}
]
}
],
"Ver": "1.1.0"
}
79 changes: 79 additions & 0 deletions Example/TestCppDemo/TestCppDemo.tpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"BarCodeReg": "abc\\d{1}",
"Desc": "It's demo test",
"GUIPlugins": [
{
"Com": "GUI_TA_MsgBox.dll",
"Name": "msg"
}
],
"Instance": [
{
"File": "TestCppDemo.tp",
"Name": "Demo11",
"Parameter": [
{
"Desc": "asd",
"Name": "Gabc",
"Value": "123"
},
{
"Desc": "111",
"Name": "Gdd",
"Value": "111"
},
{
"Desc": "all of this",
"Name": "Gall",
"Value": "22.3"
}
]
},
{
"File": "TestCppDemo.tp",
"Name": "Demo2",
"Parameter": [
{
"Desc": "asd",
"Name": "Gabc",
"Value": "123"
},
{
"Desc": "111",
"Name": "Gdd",
"Value": "111"
},
{
"Desc": "all of this",
"Name": "Gall",
"Value": "22.3"
}
]
},
{
"File": "TestCppDemo.tp",
"Name": "Demo3",
"Parameter": [
{
"Desc": "asd",
"Name": "Gabc",
"Value": "123"
},
{
"Desc": "111",
"Name": "Gdd",
"Value": "111"
},
{
"Desc": "all of this",
"Name": "Gall",
"Value": "22.3"
}
]
}
],
"LoopCount": 1,
"Name": "TestDemos",
"failedToStop": false,
"stoppedForLoop": false
}
Binary file added Example/TestCppDemo/libs/GUI_TA_MsgBox.dll
Binary file not shown.
Binary file added Example/TestCppDemo/libs/TA_MsgBox.dll
Binary file not shown.
95 changes: 95 additions & 0 deletions Example/TestCppDemo/testcppdemo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
///
/// @project TreeATE
/// @brief This is test item sample class for cpp language
/// @author David Yin 2020-05 willage.yin@163.com
///
/// @license GNU LGPL v3
///
/// Distributed under the GNU LGPL v3 License
/// (See accompanying file LICENSE or copy at
/// http://www.gnu.org/licenses/lgpl-3.0.html)
///
#include "testcppdemo.h"
#include <QThread>

void* CreateTestInst(const char *strValue)
{
Q_UNUSED(strValue)
return new TestCppDemo();
}

TestCppDemo::TestCppDemo()
{
}

int TestCppDemo::setup_testdemo()
{
OutputError("setup_testdemo中文");

QString name = GetProjectName();
OutputError("GetProjectName:" + name);
QString ver = GetProjectVer();
OutputError("GetProjectVer:" + ver);
return 0;
}

int TestCppDemo::teardown_testdemo()
{
OutputError("teardown_testdemo");
return 0;
}

int TestCppDemo::setup_suite1()
{
OutputError("setup_suite1");
QString ret = GetUserName();
OutputError("GetUserName:" + ret);
return 0;
}

int TestCppDemo::teardown_suite1()
{
OutputError("teardown_suite1");
QString ret = GetWorkLine();
OutputError("GetWorkLine:" + ret);
ret = GetWorkStation();
OutputError("GetWorkStation:" + ret);
return 0;
}

int TestCppDemo::setup_suite2()
{
OutputError("setup_suite2");
QString ret = GetProjectBarcode();
OutputError("GetProjectBarcode:" + ret);
return 0;
}

int TestCppDemo::teardown_suite2()
{
OutputError("teardown_suite2");
QString ret = GetProjectDesc();
OutputError("GetProjectDesc:" + ret);
QString rst = GetTotalRst();
OutputError("GetTotalRst:" + rst);
return 0;
}

int TestCppDemo::test_test1()
{
OutputError("test_test1");

for(int i = 0; i < 100; i++) {
QThread::msleep(300);
if(IsStopped()) {
break;
}
}
OutputRst(getParaValue("Name2"), getParaValue("Gabc"), "0");
return 0;
}

int TestCppDemo::test_test2()
{
return 0;
}
37 changes: 37 additions & 0 deletions Example/TestCppDemo/testcppdemo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
///
/// @project TreeATE
/// @brief This is test item sample class for cpp language
/// @author David Yin 2020-05 willage.yin@163.com
///
/// @license GNU LGPL v3
///
/// Distributed under the GNU LGPL v3 License
/// (See accompanying file LICENSE or copy at
/// http://www.gnu.org/licenses/lgpl-3.0.html)
///
#ifndef TESTCPPDEMO_H
#define TESTCPPDEMO_H

#include "testcppdemo_global.h"
#include "tacppbase.h"

extern "C" TESTCPPDEMOSHARED_EXPORT void* CreateTestInst(const char *strValue);

class TESTCPPDEMOSHARED_EXPORT TestCppDemo : public TACppBase
{
Q_OBJECT
public:
TestCppDemo();

public slots:
int setup_testdemo();
int teardown_testdemo();
int setup_suite1();
int teardown_suite1();
int setup_suite2();
int teardown_suite2();
int test_test1();
int test_test2();
};

#endif // TESTCPPDEMO_H
Loading

0 comments on commit 56d362f

Please sign in to comment.