diff --git a/01_creation_departement_test.py b/01_creation_departement_test.py index 5785951..6392558 100644 --- a/01_creation_departement_test.py +++ b/01_creation_departement_test.py @@ -2,6 +2,7 @@ import unittest import time import subprocess +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -82,4 +83,4 @@ if __name__ == "__main__": cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, "TESTCREATEDPT"] process = subprocess.Popen(cmdProcess) process.wait() - unittest.main() \ No newline at end of file + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) \ No newline at end of file diff --git a/02_creation_formation_test.py b/02_creation_formation_test.py index 2ac140a..b676be2 100644 --- a/02_creation_formation_test.py +++ b/02_creation_formation_test.py @@ -2,6 +2,7 @@ import unittest import time import subprocess +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -118,17 +119,14 @@ class PythonOrgSearch(unittest.TestCase): driver.find_element_by_id(idTitre).click() self.wait.until(EC.url_changes(URL)) driver.find_element_by_xpath("//a[contains(@href,'ue_create?')]").click() - driver.find_element_by_id('tf_titre').send_keys("UE TEST") - driver.find_element_by_id('tf_acronyme').send_keys("TEST") - driver.find_element_by_id('tf_submit').click() + driver.find_element_by_id("tf_titre").send_keys("UE TEST") + driver.find_element_by_id("tf_acronyme").send_keys("TEST") + driver.find_element_by_id("tf_submit").click() time.sleep(1) driver.get(URL) driver.find_element_by_id(idTitre).click() self.wait.until(EC.url_changes(URL)) - self.assertTrue( - "TEST UE TEST" - in driver.page_source - ) + self.assertTrue("TEST UE TEST" in driver.page_source) driver.get(URL) self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source) @@ -140,16 +138,19 @@ class PythonOrgSearch(unittest.TestCase): global URL nomMat = "unematieretest" driver.get(URL) + time.sleep(3) idTitre = "titre_" + ACRONYME_FORMATION driver.find_element_by_id(idTitre).click() self.wait.until(EC.url_changes(URL)) + time.sleep(3) driver.find_element_by_xpath("//a[contains(@href,'matiere_create?')]").click() - driver.find_element_by_id('tf_titre').send_keys(nomMat) - driver.find_element_by_id('tf_numero').send_keys("1") - driver.find_element_by_id('tf_submit').click() - time.sleep(1) + driver.find_element_by_id("tf_titre").send_keys(nomMat) + driver.find_element_by_id("tf_numero").send_keys("1") + driver.find_element_by_id("tf_submit").click() + time.sleep(3) driver.get(URL) driver.find_element_by_id(idTitre).click() + time.sleep(3) self.wait.until(EC.url_changes(URL)) elements = driver.find_elements_by_xpath("//a[contains(@href,'matiere_edit?')]") matIsPresent = False @@ -180,6 +181,7 @@ class PythonOrgSearch(unittest.TestCase): driver.get(URL) self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source) + # Test : Dupplique une formation sous une nouvelle version # @expected : La formation est dupliquée et à la version "2" def test_017_creer_nouvelle_version_formation(self): @@ -190,16 +192,19 @@ class PythonOrgSearch(unittest.TestCase): driver.find_element_by_id(idTitre).click() self.wait.until(EC.url_changes(URL)) tmpurl = driver.current_url - driver.find_element_by_xpath("//a[contains(@href,'formation_create_new_version?')]").click() + driver.find_element_by_xpath( + "//a[contains(@href,'formation_create_new_version?')]" + ).click() self.wait.until(EC.url_changes(tmpurl)) self.assertTrue("Nouvelle version !" in driver.page_source) - driver.get(URL) + driver.get(URL) elements = driver.find_elements_by_class_name("version") versionIsPresent = False for element in elements: - if element.text == '2': + if element.text == "2": versionIsPresent = True self.assertTrue(versionIsPresent) + # Test : Supprime une formation après avoir supprimé les semestres qui y sont rattachés # @expected : La formation n'apparait plus dans le tableau des formations def test_020_delete_formation(self): @@ -247,10 +252,10 @@ class PythonOrgSearch(unittest.TestCase): if __name__ == "__main__": - cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT] - process = subprocess.Popen(cmdProcess) - process.wait() - unittest.main() cmdProcess = ["./scriptDeleteDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT] process = subprocess.Popen(cmdProcess) process.wait() + cmdProcess = ["./scriptCreationDepartement.sh", LINK_SCODOC_SERVER, NOM_DPT] + process = subprocess.Popen(cmdProcess) + process.wait() + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) diff --git a/03_etudiant_test.py b/03_etudiant_test.py index 6a0ea67..618e844 100644 --- a/03_etudiant_test.py +++ b/03_etudiant_test.py @@ -1,5 +1,6 @@ import unittest import time +import HtmlTestRunner import subprocess from setting import ( SCODOC_ADMIN_ID, @@ -186,4 +187,4 @@ if __name__ == "__main__": ] process = subprocess.Popen(cmdProcess) process.wait() - unittest.main() \ No newline at end of file + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) \ No newline at end of file diff --git a/04_creation_absence_test.py b/04_creation_absence_test.py index d80cdc8..b479091 100644 --- a/04_creation_absence_test.py +++ b/04_creation_absence_test.py @@ -2,6 +2,7 @@ import unittest import time import urllib.parse as urlparse import subprocess +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -161,4 +162,4 @@ if __name__ == "__main__": ] process = subprocess.Popen(cmdProcess) process.wait() - unittest.main() \ No newline at end of file + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) \ No newline at end of file diff --git a/05_saisie_note_test.py b/05_saisie_note_test.py index 20c865b..62e5835 100644 --- a/05_saisie_note_test.py +++ b/05_saisie_note_test.py @@ -2,6 +2,7 @@ import unittest import time import subprocess import urllib.parse as urlparse +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -388,4 +389,4 @@ if __name__ == "__main__": driver.find_element_by_id("tf_submit").click() driver.find_element_by_id("utilisateurs_Vue").click() driver.close() - unittest.main(warnings="ignore") + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) diff --git a/06_test_moyenne.py b/06_test_moyenne.py index 16de343..6273397 100644 --- a/06_test_moyenne.py +++ b/06_test_moyenne.py @@ -2,6 +2,7 @@ import unittest import time import subprocess import urllib.parse as urlparse +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -442,4 +443,4 @@ if __name__ == "__main__": ] process = subprocess.Popen(cmdProcess) process.wait() - unittest.main(warnings="ignore") \ No newline at end of file + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) \ No newline at end of file diff --git a/07_test_admission.py b/07_test_admission.py index 2b6e77f..94fd5e9 100644 --- a/07_test_admission.py +++ b/07_test_admission.py @@ -2,6 +2,7 @@ import unittest import time import subprocess import urllib.parse as urlparse +import HtmlTestRunner from setting import ( SCODOC_ADMIN_ID, SCODOC_ADMIN_PASS, @@ -229,4 +230,4 @@ if __name__ == "__main__": ] process = subprocess.Popen(cmdProcess) process.wait() - unittest.main(warnings="ignore") \ No newline at end of file + unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="./output")) \ No newline at end of file diff --git a/UserStoryNew.yaml b/UserStoryNew.yaml index 6edd429..1155ba8 100644 --- a/UserStoryNew.yaml +++ b/UserStoryNew.yaml @@ -589,28 +589,22 @@ test48: page: *Notes champsModifie: null champsInteractions: - [ - id:tf_titre, - id:tf_acronyme, - id:tf_submit, - link:ue_create - ] + [id:tf_titre, id:tf_acronyme, id:tf_submit, link:ue_create] role: *AdminDPT createur: Aurélien test49: - intitulé: Ajout d'une matière à l'UE créée + intitulé: Ajout d'une matière à la formation créée operation: Soumettre le formulaire d'ajout de matière - resultat: La page sur laquelle on est dirigée contient la classe notes_matiere_list et un de ses enfants contient Systeme + resultat: La page sur laquelle on est dirigée contient la classe notes_matiere_list et l'intitulé de la matière est présent etat: *MatiereCreated page: *Notes champsModifie: null - champsInteractions: - [ + champsInteractions: [ id:tf_titre, id:tf_acronyme, id:tf_submit, link:matiere_create - link:matiere_edit + link:matiere_edit, ] role: *AdminDPT createur: Aurélien diff --git a/output/TestResults___main__.PythonOrgSearch_2021-06-23_13-51-43.html b/output/TestResults___main__.PythonOrgSearch_2021-06-23_13-51-43.html new file mode 100644 index 0000000..d938943 --- /dev/null +++ b/output/TestResults___main__.PythonOrgSearch_2021-06-23_13-51-43.html @@ -0,0 +1,142 @@ + + + + Unittest Results + + + + + +
+
+
+

Unittest Results

+

Start Time: 2021-06-23 13:51:43

+

Duration: 137.89 s

+

Summary: Total: 8, Pass: 6, Fail: 2

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
__main__.PythonOrgSearchStatus
test_011_create_formation + Pass + +
test_012_change_name_formation + Pass + +
test_013_same_name_formation + Pass + +
test_014_ajout_UE + Fail + + +

AssertionError: False is not true

Traceback (most recent call last): + File "/home/aurelien/Bureau/pythonSelenium/02_creation_formation_test.py", line 132, in test_014_ajout_UE + self.assertTrue((NOM_DPT.upper() + "-" + "DUT" + "--") in driver.page_source) +AssertionError: False is not true +

+
test_015_ajout_matiere + Pass + +
test_016_ajout_Semestre + Pass + +
test_017_creer_nouvelle_version_formation + Pass + +
test_020_delete_formation + Fail + + +

AssertionError: False is not true

Traceback (most recent call last): + File "/home/aurelien/Bureau/pythonSelenium/02_creation_formation_test.py", line 241, in test_020_delete_formation + self.assertTrue(False) +AssertionError: False is not true +

+
+ Total: 8, Pass: 6, Fail: 2 -- Duration: 137.89 s +
+
+
+
+ + + + + + + Unittest Results + + + + + +
+
+
+

Unittest Results

+

Start Time: 2021-06-23 14:11:52

+

Duration: 56.95 s

+

Summary: Total: 3, Pass: 3

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
__main__.PythonOrgSearchStatus
test_connexion_admin + Pass + +
test_create_departement + Pass + +
test_delete_departement + Pass + +
+ Total: 3, Pass: 3 -- Duration: 56.95 s +
+
+
+
+ + + +