mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 18:10:37 +02:00
Problem = last test is created twice.
This commit is contained in:
parent
3402d7836a
commit
c98d43bb32
5 changed files with 108 additions and 41 deletions
|
@ -22,14 +22,15 @@ TestRailInterface::TestRailInterface() {
|
||||||
_busyWindow.setModal(true);
|
_busyWindow.setModal(true);
|
||||||
_testRailSelectorWindow.setModal(true);
|
_testRailSelectorWindow.setModal(true);
|
||||||
|
|
||||||
////_testRailSelectorWindow.setURL("https://highfidelity.testrail.net");
|
_testRailSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||||
_testRailSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
////_testRailSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
||||||
////_testRailSelectorWindow.setUser("@highfidelity.io");
|
_testRailSelectorWindow.setUser("@highfidelity.io");
|
||||||
_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
////_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
||||||
|
|
||||||
// 24 is the HighFidelity Interface project id in TestRail
|
_testRailSelectorWindow.setProjectID(INTERFACE_PROJECT_ID);
|
||||||
////_testRailSelectorWindow.setProject(24);
|
////_testRailSelectorWindow.setProject(1);
|
||||||
_testRailSelectorWindow.setProject(1);
|
|
||||||
|
_testRailSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TestRailInterface::getObject(const QString& path) {
|
QString TestRailInterface::getObject(const QString& path) {
|
||||||
|
@ -197,9 +198,10 @@ void TestRailInterface::requestTestRailDataFromUser() {
|
||||||
|
|
||||||
_url = _testRailSelectorWindow.getURL() + "/";
|
_url = _testRailSelectorWindow.getURL() + "/";
|
||||||
_user = _testRailSelectorWindow.getUser();
|
_user = _testRailSelectorWindow.getUser();
|
||||||
////_password = _testRailSelectorWindow.getPassword();
|
_password = _testRailSelectorWindow.getPassword();
|
||||||
_password = "tutKA76";
|
////_password = "tutKA76";
|
||||||
_project = QString::number(_testRailSelectorWindow.getProject());
|
_projectID = QString::number(_testRailSelectorWindow.getProjectID());
|
||||||
|
_suiteID = QString::number(_testRailSelectorWindow.getSuiteID());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
||||||
|
@ -218,7 +220,8 @@ bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
||||||
void TestRailInterface::processDirectoryPython(const QString& directory,
|
void TestRailInterface::processDirectoryPython(const QString& directory,
|
||||||
QTextStream& stream,
|
QTextStream& stream,
|
||||||
const QString& userGitHub,
|
const QString& userGitHub,
|
||||||
const QString& branchGitHub) {
|
const QString& branchGitHub
|
||||||
|
) {
|
||||||
// Loop over all entries in directory
|
// Loop over all entries in directory
|
||||||
QDirIterator it(directory.toStdString().c_str());
|
QDirIterator it(directory.toStdString().c_str());
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -229,9 +232,9 @@ void TestRailInterface::processDirectoryPython(const QString& directory,
|
||||||
if (isAValidTestDirectory(nextDirectory)) {
|
if (isAValidTestDirectory(nextDirectory)) {
|
||||||
// The name of the section is the directory at the end of the path
|
// The name of the section is the directory at the end of the path
|
||||||
stream << "parent_id = parent_ids.peek()\n";
|
stream << "parent_id = parent_ids.peek()\n";
|
||||||
stream << "data = { 'name': '" << objectName << "', 'parent_id': parent_id }\n";
|
stream << "data = { 'name': '" << objectName << "', 'suite_id': " + _suiteID + ", 'parent_id': parent_id }\n";
|
||||||
|
|
||||||
stream << "section = client.send_post('add_section/' + str(" << _project << "), data)\n";
|
stream << "section = client.send_post('add_section/' + str(" << _projectID << "), data)\n";
|
||||||
|
|
||||||
// Now we push the parent_id, and recursively process each directory
|
// Now we push the parent_id, and recursively process each directory
|
||||||
stream << "parent_ids.push(section['id'])\n\n";
|
stream << "parent_ids.push(section['id'])\n\n";
|
||||||
|
@ -254,8 +257,8 @@ void TestRailInterface::processDirectoryPython(const QString& directory,
|
||||||
//
|
//
|
||||||
void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirectory,
|
void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirectory,
|
||||||
const QString& userGitHub,
|
const QString& userGitHub,
|
||||||
const QString& branchGitHub) {
|
const QString& branchGitHub
|
||||||
|
) {
|
||||||
QString filename = _outputDirectory + "/addTestCases.py";
|
QString filename = _outputDirectory + "/addTestCases.py";
|
||||||
if (QFile::exists(filename)) {
|
if (QFile::exists(filename)) {
|
||||||
QFile::remove(filename);
|
QFile::remove(filename);
|
||||||
|
@ -281,9 +284,10 @@ void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirect
|
||||||
|
|
||||||
// top-level section
|
// top-level section
|
||||||
stream << "data = { 'name': '"
|
stream << "data = { 'name': '"
|
||||||
<< "Test Suite - " << QDateTime::currentDateTime().toString("yyyy-MM-ddTHH:mm") << "'}\n";
|
<< "Test Suite - " << QDateTime::currentDateTime().toString("yyyy-MM-ddTHH:mm") + "', "
|
||||||
|
<< "'suite_id': " + _suiteID + "}\n";
|
||||||
|
|
||||||
stream << "section = client.send_post('add_section/' + str(" << _project << "), data)\n";
|
stream << "section = client.send_post('add_section/' + str(" << _projectID << "), data)\n";
|
||||||
|
|
||||||
// Now we push the parent_id, and recursively process each directory
|
// Now we push the parent_id, and recursively process each directory
|
||||||
stream << "parent_ids.push(section['id'])\n\n";
|
stream << "parent_ids.push(section['id'])\n\n";
|
||||||
|
@ -382,7 +386,7 @@ void TestRailInterface::getMilestonesFromTestRail() {
|
||||||
|
|
||||||
// Print the list of uncompleted milestones
|
// Print the list of uncompleted milestones
|
||||||
stream << "file = open('" + _outputDirectory + "/milestones.txt', 'w')\n\n";
|
stream << "file = open('" + _outputDirectory + "/milestones.txt', 'w')\n\n";
|
||||||
stream << "milestones = client.send_get('get_milestones/" + _project + "')\n";
|
stream << "milestones = client.send_get('get_milestones/" + _projectID + "')\n";
|
||||||
stream << "for milestone in milestones:\n";
|
stream << "for milestone in milestones:\n";
|
||||||
stream << "\tif milestone['is_completed'] == False:\n";
|
stream << "\tif milestone['is_completed'] == False:\n";
|
||||||
stream << "\t\tfile.write(milestone['name'] + ' ' + str(milestone['id']) + '\\n')\n\n";
|
stream << "\t\tfile.write(milestone['name'] + ' ' + str(milestone['id']) + '\\n')\n\n";
|
||||||
|
@ -665,12 +669,15 @@ void TestRailInterface::processTestPython(const QString& fullDirectory,
|
||||||
|
|
||||||
int milestone_id = _milestones[_milestoneNames[_testRailSelectorWindow.getMilestoneID()]];
|
int milestone_id = _milestones[_milestoneNames[_testRailSelectorWindow.getMilestoneID()]];
|
||||||
|
|
||||||
stream << "data = {\n\t"
|
stream << "data = {\n"
|
||||||
<< "'title': '" << title << "',\n\t"
|
<< "\t'title': '" << title << "',\n"
|
||||||
<< "'template_id': 2,\n\t"
|
<< "\t'template_id': 2,\n"
|
||||||
<< "'milestone_id': " << milestone_id << ",\n\t"
|
<< "\t'milestone_id': " << milestone_id << ",\n"
|
||||||
<< "'custom_preconds': " << "'Tester is in an empty region of a domain in which they have edit rights\\n\\n*Note: Press \\'n\\' to advance test script',\n\t"
|
<< "\t'custom_tester_count': 1,\n"
|
||||||
<< "'custom_steps_separated': " << "[\n\t\t{\n\t\t\t'content': '" << testContent << "',\n\t\t\t'expected': '" << testExpected << "'\n\t\t}\n\t]\n"
|
<< "\t'custom_domain_bot_load': 1,\n"
|
||||||
|
<< "\t'custom_added_to_release': 4,\n"
|
||||||
|
<< "\t'custom_preconds': " << "'Tester is in an empty region of a domain in which they have edit rights\\n\\n*Note: Press \\'n\\' to advance test script',\n"
|
||||||
|
<< "\t'custom_steps_separated': " << "[\n\t\t{\n\t\t\t'content': '" << testContent << "',\n\t\t\t'expected': '" << testExpected << "'\n\t\t}\n\t]\n"
|
||||||
<< "}\n";
|
<< "}\n";
|
||||||
|
|
||||||
stream << "case = client.send_post('add_case/' + str(section_id), data)\n";
|
stream << "case = client.send_post('add_case/' + str(section_id), data)\n";
|
||||||
|
|
|
@ -70,6 +70,12 @@ public:
|
||||||
void updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus);
|
void updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// HighFidelity Interface project ID in TestRail
|
||||||
|
const int INTERFACE_PROJECT_ID{ 24 };
|
||||||
|
|
||||||
|
// Rendering suite ID
|
||||||
|
const int INTERFACE_SUITE_ID{ 1147 };
|
||||||
|
|
||||||
QDomDocument _document;
|
QDomDocument _document;
|
||||||
|
|
||||||
BusyWindow _busyWindow;
|
BusyWindow _busyWindow;
|
||||||
|
@ -78,7 +84,8 @@ private:
|
||||||
QString _url;
|
QString _url;
|
||||||
QString _user;
|
QString _user;
|
||||||
QString _password;
|
QString _password;
|
||||||
QString _project;
|
QString _projectID;
|
||||||
|
QString _suiteID;
|
||||||
|
|
||||||
QString _testDirectory;
|
QString _testDirectory;
|
||||||
QString _outputDirectory;
|
QString _outputDirectory;
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
TestRailSelectorWindow::TestRailSelectorWindow(QWidget *parent) {
|
TestRailSelectorWindow::TestRailSelectorWindow(QWidget *parent) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
projectLineEdit->setValidator(new QIntValidator(1, 999, this));
|
projectIDLineEdit->setValidator(new QIntValidator(1, 999, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRailSelectorWindow::on_acceptButton_clicked() {
|
void TestRailSelectorWindow::on_acceptButton_clicked() {
|
||||||
urlLineEdit->setDisabled(true);
|
urlLineEdit->setDisabled(true);
|
||||||
userLineEdit->setDisabled(true);
|
userLineEdit->setDisabled(true);
|
||||||
passwordLineEdit->setDisabled(true);
|
passwordLineEdit->setDisabled(true);
|
||||||
projectLineEdit->setDisabled(true);
|
projectIDLineEdit->setDisabled(true);
|
||||||
|
|
||||||
OKButton->setDisabled(false);
|
OKButton->setDisabled(false);
|
||||||
milestoneComboBox->setDisabled(false);
|
milestoneComboBox->setDisabled(false);
|
||||||
|
@ -64,12 +64,20 @@ QString TestRailSelectorWindow::getPassword() {
|
||||||
return passwordLineEdit->text();
|
return passwordLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRailSelectorWindow::setProject(const int project) {
|
void TestRailSelectorWindow::setProjectID(const int project) {
|
||||||
projectLineEdit->setText(QString::number(project));
|
projectIDLineEdit->setText(QString::number(project));
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestRailSelectorWindow::getProject() {
|
int TestRailSelectorWindow::getProjectID() {
|
||||||
return projectLineEdit->text().toInt();
|
return projectIDLineEdit->text().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRailSelectorWindow::setSuiteID(const int project) {
|
||||||
|
suiteIDLineEdit->setText(QString::number(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
int TestRailSelectorWindow::getSuiteID() {
|
||||||
|
return suiteIDLineEdit->text().toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRailSelectorWindow::updateMilestoneComboBoxData(QStringList data) {
|
void TestRailSelectorWindow::updateMilestoneComboBoxData(QStringList data) {
|
||||||
|
|
|
@ -28,8 +28,11 @@ public:
|
||||||
|
|
||||||
QString getPassword();
|
QString getPassword();
|
||||||
|
|
||||||
void setProject(const int project);
|
void setProjectID(const int project);
|
||||||
int getProject();
|
int getProjectID();
|
||||||
|
|
||||||
|
void setSuiteID(const int project);
|
||||||
|
int getSuiteID();
|
||||||
|
|
||||||
bool userCancelled{ false };
|
bool userCancelled{ false };
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>489</width>
|
<width>489</width>
|
||||||
<height>415</height>
|
<height>474</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>120</x>
|
<x>120</x>
|
||||||
<y>350</y>
|
<y>420</y>
|
||||||
<width>93</width>
|
<width>93</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>280</x>
|
<x>280</x>
|
||||||
<y>350</y>
|
<y>420</y>
|
||||||
<width>93</width>
|
<width>93</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
<string>TestRail User</string>
|
<string>TestRail User</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="projectLineEdit">
|
<widget class="QLineEdit" name="projectIDLineEdit">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>200</x>
|
<x>200</x>
|
||||||
|
@ -155,14 +155,14 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TestRail Project</string>
|
<string>TestRail Project ID</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="acceptButton">
|
<widget class="QPushButton" name="acceptButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>200</x>
|
<x>200</x>
|
||||||
<y>220</y>
|
<y>270</y>
|
||||||
<width>231</width>
|
<width>231</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -178,7 +178,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>270</x>
|
<x>270</x>
|
||||||
<y>280</y>
|
<y>350</y>
|
||||||
<width>161</width>
|
<width>161</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>140</x>
|
<x>140</x>
|
||||||
<y>280</y>
|
<y>350</y>
|
||||||
<width>121</width>
|
<width>121</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -231,8 +231,50 @@
|
||||||
<enum>QLineEdit::Normal</enum>
|
<enum>QLineEdit::Normal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="suiteIDLineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>200</x>
|
||||||
|
<y>215</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TestRail Suite ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>urlLineEdit</tabstop>
|
||||||
|
<tabstop>userLineEdit</tabstop>
|
||||||
|
<tabstop>passwordLineEdit</tabstop>
|
||||||
|
<tabstop>projectIDLineEdit</tabstop>
|
||||||
|
<tabstop>suiteIDLineEdit</tabstop>
|
||||||
|
<tabstop>acceptButton</tabstop>
|
||||||
|
<tabstop>milestoneComboBox</tabstop>
|
||||||
|
<tabstop>OKButton</tabstop>
|
||||||
|
<tabstop>cancelButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Reference in a new issue