diff --git a/README.md b/README.md index db7f00d..951d195 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,25 @@ # Python-Test-Automation-Framework -Description -============= -Test Automation Framework using selenium and Python with the below features: +# Description -* Framework is based on page object model. -* Reporting using Allure report. -* Reading locators from JSON file. -* Reading test data from JSON file. -* Integrated with TestRail to update test cases status after each run. -* Framework can integrate with CodeShip. +Test Automation Framework using selenium and Python with the below features: +- Framework is based on page object model. +- Reporting using Allure report. +- Reading locators from JSON file. +- Reading test data from JSON file. +- Integrated with TestRail to update test cases status after each run. +- Framework can integrate with CodeShip. -Install dependences -===================== -* Install the depended packages in ``requirements.txt`` using ``pip install -r requirements.txt`` +# Install dependences +- Install the depended packages in `requirements.txt` using `pip install -r requirements.txt` -Create new test case -===================== +# Create new test case In order to create a new test case using the **Framework**, you have to follow the below steps: -* In **locators module**, create a new locator for the element you would like to use, as below: +- In **locators module**, create a new locator for the element you would like to use, as below: [{ @@ -32,7 +29,7 @@ In order to create a new test case using the **Framework**, you have to follow t "locator": "//a[contains(text(),'Log In')]" }] -* In **test data module**, add the test data needed for your test case, as below: +- In **test data module**, add the test data needed for your test case, as below: { "environment": "https://learn.letskodeit.com/", @@ -41,26 +38,25 @@ In order to create a new test case using the **Framework**, you have to follow t "password": "abcabc" } - * If the element exist in more than one page (**Navigation element**), use **navigation module** to create a script for that navigation bar and add your navigation action to that element, as below: def goToLoginPage(self): self.elementClick(*self.locator(self.homePage_locators, 'link_login')) -* If the element exists in only one page, go to **page module** and create a new script for that page e.g: ``login_page.py`` and add all the actions in that page, as below: +* If the element exists in only one page, go to **page module** and create a new script for that page e.g: `login_page.py` and add all the actions in that page, as below: def login(self, email, password): self.sendKeys(email, *self.locator(self.loginPage_locators, 'input_email')) self.sendKeys(password, *self.locator(self.loginPage_locators, 'input_password')) self.elementClick(*self.locator(self.loginPage_locators, 'btn_login')) -* Then, in **test module**, create a new script for your test case(s) e.g: ``test_login.py`` and add your test case, as below: +* Then, in **test module**, create a new script for your test case(s) e.g: `test_login.py` and add your test case, as below: @allure.story('epic_1') # story of the test case @allure.severity(allure.severity_level.MINOR) # severity of the test case @pytestrail.case('C48') # test case id on test rail def test_login_successfully(self): - + with allure.step('Navigate to login page'): # name of the test step self.homeNavigation.goToLoginPage() self.ts.markFinal(self.loginPage.isAt, "navigation to login page failed") # check if the navigation to login page occurs successfully @@ -69,39 +65,35 @@ In order to create a new test case using the **Framework**, you have to follow t self.loginPage.login(email=td.testData("email"), password=td.testData("password")) self.ts.markFinal(self.dashboardPage.isAt, "login failed") # check if login successfully - **Notes:** - * use ``@allure.story('[epic name]')`` decorator before each test case to define the related epic / story. - * use ``@allure.severity(allure.severity_level.[severity])`` decorator before each test case to define the severity of the test case Minor/Major/Critical/Blocker. - * use ``@pytestrail.case('[test case id on testrail]')`` decorator before each test case to defione the related test case id on test rail to make the script update run status on test rail. +- use `@allure.story('[epic name]')` decorator before each test case to define the related epic / story. +- use `@allure.severity(allure.severity_level.[severity])` decorator before each test case to define the severity of the test case Minor/Major/Critical/Blocker. +- use `@pytestrail.case('[test case id on testrail]')` decorator before each test case to defione the related test case id on test rail to make the script update run status on test rail. -Run the test case -================== +# Run the test case In order to run the test case after creation, use on of the below commands: -* To run the test case and create allure report but without update the status run on TestRail: - -``py.test --alluredir=allure_report tests/test_login.py`` +- To run the test case and create allure report but without update the status run on TestRail: -``allure serve allure_report`` +`py.test --alluredir=allure_report tests/test_login.py` +`allure serve allure_report` -* To run the test case, create allure report and update the status of run on TestRail: +- To run the test case, create allure report and update the status of run on TestRail: -``py.test --alluredir=allure_report tests/test_login.py --testrail`` +`py.test --alluredir=allure_report tests/test_login.py --testrail` -``allure serve allure_report`` +`allure serve allure_report` **Note:** - * There are other options of run that you can search for them, as running all the test cases for specific epic/story or with specific severity +- There are other options of run that you can search for them, as running all the test cases for specific epic/story or with specific severity -Integration with TestRail -========================= +# Integration with TestRail -In order to setup the integration with TestRail, edit ``testrail.cfg`` with your testrail domain and credentials, as below: +In order to setup the integration with TestRail, edit `testrail.cfg` with your testrail domain and credentials, as below: [API] url = https://[your testrail domain].testrail.io @@ -110,3 +102,5 @@ In order to setup the integration with TestRail, edit ``testrail.cfg`` with your [TESTRUN] project_id = [project id] + +======================== diff --git a/_mac/keymap.xml b/_mac/keymap.xml deleted file mode 100644 index 4ada508..0000000 --- a/_mac/keymap.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/_mac/laf.xml b/_mac/laf.xml deleted file mode 100644 index dbf49b4..0000000 --- a/_mac/laf.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/codestyles/Default.xml b/codestyles/Default.xml deleted file mode 100644 index e94f32a..0000000 --- a/codestyles/Default.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/debugger.xml b/debugger.xml deleted file mode 100644 index 16f98b3..0000000 --- a/debugger.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/filetypes.xml b/filetypes.xml deleted file mode 100644 index d0f4d90..0000000 --- a/filetypes.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ide.general.xml b/ide.general.xml deleted file mode 100644 index a4827a0..0000000 --- a/ide.general.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/log_highlighting.xml b/log_highlighting.xml deleted file mode 100644 index dddc99e..0000000 --- a/log_highlighting.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - 4 - 3 - - \ No newline at end of file