mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-13 06:42:42 +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);
|
||||
_testRailSelectorWindow.setModal(true);
|
||||
|
||||
////_testRailSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||
_testRailSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
||||
////_testRailSelectorWindow.setUser("@highfidelity.io");
|
||||
_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
||||
_testRailSelectorWindow.setURL("https://highfidelity.testrail.net");
|
||||
////_testRailSelectorWindow.setURL("https://nissimhadar.testrail.io");
|
||||
_testRailSelectorWindow.setUser("@highfidelity.io");
|
||||
////_testRailSelectorWindow.setUser("nissim.hadar@gmail.com");
|
||||
|
||||
// 24 is the HighFidelity Interface project id in TestRail
|
||||
////_testRailSelectorWindow.setProject(24);
|
||||
_testRailSelectorWindow.setProject(1);
|
||||
_testRailSelectorWindow.setProjectID(INTERFACE_PROJECT_ID);
|
||||
////_testRailSelectorWindow.setProject(1);
|
||||
|
||||
_testRailSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
||||
}
|
||||
|
||||
QString TestRailInterface::getObject(const QString& path) {
|
||||
|
@ -197,9 +198,10 @@ void TestRailInterface::requestTestRailDataFromUser() {
|
|||
|
||||
_url = _testRailSelectorWindow.getURL() + "/";
|
||||
_user = _testRailSelectorWindow.getUser();
|
||||
////_password = _testRailSelectorWindow.getPassword();
|
||||
_password = "tutKA76";
|
||||
_project = QString::number(_testRailSelectorWindow.getProject());
|
||||
_password = _testRailSelectorWindow.getPassword();
|
||||
////_password = "tutKA76";
|
||||
_projectID = QString::number(_testRailSelectorWindow.getProjectID());
|
||||
_suiteID = QString::number(_testRailSelectorWindow.getSuiteID());
|
||||
}
|
||||
|
||||
bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
||||
|
@ -218,7 +220,8 @@ bool TestRailInterface::isAValidTestDirectory(const QString& directory) {
|
|||
void TestRailInterface::processDirectoryPython(const QString& directory,
|
||||
QTextStream& stream,
|
||||
const QString& userGitHub,
|
||||
const QString& branchGitHub) {
|
||||
const QString& branchGitHub
|
||||
) {
|
||||
// Loop over all entries in directory
|
||||
QDirIterator it(directory.toStdString().c_str());
|
||||
while (it.hasNext()) {
|
||||
|
@ -229,9 +232,9 @@ void TestRailInterface::processDirectoryPython(const QString& directory,
|
|||
if (isAValidTestDirectory(nextDirectory)) {
|
||||
// The name of the section is the directory at the end of the path
|
||||
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
|
||||
stream << "parent_ids.push(section['id'])\n\n";
|
||||
|
@ -254,8 +257,8 @@ void TestRailInterface::processDirectoryPython(const QString& directory,
|
|||
//
|
||||
void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirectory,
|
||||
const QString& userGitHub,
|
||||
const QString& branchGitHub) {
|
||||
|
||||
const QString& branchGitHub
|
||||
) {
|
||||
QString filename = _outputDirectory + "/addTestCases.py";
|
||||
if (QFile::exists(filename)) {
|
||||
QFile::remove(filename);
|
||||
|
@ -281,9 +284,10 @@ void TestRailInterface::createAddTestCasesPythonScript(const QString& testDirect
|
|||
|
||||
// top-level section
|
||||
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
|
||||
stream << "parent_ids.push(section['id'])\n\n";
|
||||
|
@ -382,7 +386,7 @@ void TestRailInterface::getMilestonesFromTestRail() {
|
|||
|
||||
// Print the list of uncompleted milestones
|
||||
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 << "\tif milestone['is_completed'] == False:\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()]];
|
||||
|
||||
stream << "data = {\n\t"
|
||||
<< "'title': '" << title << "',\n\t"
|
||||
<< "'template_id': 2,\n\t"
|
||||
<< "'milestone_id': " << milestone_id << ",\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"
|
||||
stream << "data = {\n"
|
||||
<< "\t'title': '" << title << "',\n"
|
||||
<< "\t'template_id': 2,\n"
|
||||
<< "\t'milestone_id': " << milestone_id << ",\n"
|
||||
<< "\t'custom_tester_count': 1,\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";
|
||||
|
||||
stream << "case = client.send_post('add_case/' + str(section_id), data)\n";
|
||||
|
|
|
@ -70,6 +70,12 @@ public:
|
|||
void updateMilestonesComboData(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
// HighFidelity Interface project ID in TestRail
|
||||
const int INTERFACE_PROJECT_ID{ 24 };
|
||||
|
||||
// Rendering suite ID
|
||||
const int INTERFACE_SUITE_ID{ 1147 };
|
||||
|
||||
QDomDocument _document;
|
||||
|
||||
BusyWindow _busyWindow;
|
||||
|
@ -78,7 +84,8 @@ private:
|
|||
QString _url;
|
||||
QString _user;
|
||||
QString _password;
|
||||
QString _project;
|
||||
QString _projectID;
|
||||
QString _suiteID;
|
||||
|
||||
QString _testDirectory;
|
||||
QString _outputDirectory;
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
TestRailSelectorWindow::TestRailSelectorWindow(QWidget *parent) {
|
||||
setupUi(this);
|
||||
|
||||
projectLineEdit->setValidator(new QIntValidator(1, 999, this));
|
||||
projectIDLineEdit->setValidator(new QIntValidator(1, 999, this));
|
||||
}
|
||||
|
||||
void TestRailSelectorWindow::on_acceptButton_clicked() {
|
||||
urlLineEdit->setDisabled(true);
|
||||
userLineEdit->setDisabled(true);
|
||||
passwordLineEdit->setDisabled(true);
|
||||
projectLineEdit->setDisabled(true);
|
||||
projectIDLineEdit->setDisabled(true);
|
||||
|
||||
OKButton->setDisabled(false);
|
||||
milestoneComboBox->setDisabled(false);
|
||||
|
@ -64,12 +64,20 @@ QString TestRailSelectorWindow::getPassword() {
|
|||
return passwordLineEdit->text();
|
||||
}
|
||||
|
||||
void TestRailSelectorWindow::setProject(const int project) {
|
||||
projectLineEdit->setText(QString::number(project));
|
||||
void TestRailSelectorWindow::setProjectID(const int project) {
|
||||
projectIDLineEdit->setText(QString::number(project));
|
||||
}
|
||||
|
||||
int TestRailSelectorWindow::getProject() {
|
||||
return projectLineEdit->text().toInt();
|
||||
int TestRailSelectorWindow::getProjectID() {
|
||||
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) {
|
||||
|
|
|
@ -28,8 +28,11 @@ public:
|
|||
|
||||
QString getPassword();
|
||||
|
||||
void setProject(const int project);
|
||||
int getProject();
|
||||
void setProjectID(const int project);
|
||||
int getProjectID();
|
||||
|
||||
void setSuiteID(const int project);
|
||||
int getSuiteID();
|
||||
|
||||
bool userCancelled{ false };
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>489</width>
|
||||
<height>415</height>
|
||||
<height>474</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -74,7 +74,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>350</y>
|
||||
<y>420</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
|
@ -87,7 +87,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>350</y>
|
||||
<y>420</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<string>TestRail User</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="projectLineEdit">
|
||||
<widget class="QLineEdit" name="projectIDLineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
|
@ -155,14 +155,14 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TestRail Project</string>
|
||||
<string>TestRail Project ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="acceptButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>220</y>
|
||||
<y>270</y>
|
||||
<width>231</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
|
@ -178,7 +178,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>280</y>
|
||||
<y>350</y>
|
||||
<width>161</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
|
@ -191,7 +191,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>280</y>
|
||||
<y>350</y>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
|
@ -231,8 +231,50 @@
|
|||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</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>
|
||||
<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/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Reference in a new issue