diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index fa79395..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,13 +0,0 @@ -# These are supported funding model platforms - -github: [vivifyhealthcare] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: vivifyhealthcare # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea7..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/Playwright_API_Testing.iml b/.idea/Playwright_API_Testing.iml deleted file mode 100644 index d27d2cf..0000000 --- a/.idea/Playwright_API_Testing.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 8b03da6..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 6b12f5d..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3e4973f..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/POC/POC/__pycache__/__init__.cpython-310.pyc b/POC/POC/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index f4b1235..0000000 Binary files a/POC/POC/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/POC/POC/__pycache__/settings.cpython-310.pyc b/POC/POC/__pycache__/settings.cpython-310.pyc deleted file mode 100644 index f55d8c6..0000000 Binary files a/POC/POC/__pycache__/settings.cpython-310.pyc and /dev/null differ diff --git a/POC/POC/__pycache__/urls.cpython-310.pyc b/POC/POC/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index 31eef85..0000000 Binary files a/POC/POC/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/POC/POC/__pycache__/wsgi.cpython-310.pyc b/POC/POC/__pycache__/wsgi.cpython-310.pyc deleted file mode 100644 index 7e33fa6..0000000 Binary files a/POC/POC/__pycache__/wsgi.cpython-310.pyc and /dev/null differ diff --git a/POC/__pycache__/database.cpython-310.pyc b/POC/__pycache__/database.cpython-310.pyc deleted file mode 100644 index f1b2d14..0000000 Binary files a/POC/__pycache__/database.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/__init__.cpython-310.pyc b/POC/poc_automation/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 995cd18..0000000 Binary files a/POC/poc_automation/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/admin.cpython-310.pyc b/POC/poc_automation/__pycache__/admin.cpython-310.pyc deleted file mode 100644 index a0c3d2a..0000000 Binary files a/POC/poc_automation/__pycache__/admin.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/apps.cpython-310.pyc b/POC/poc_automation/__pycache__/apps.cpython-310.pyc deleted file mode 100644 index 2b55b22..0000000 Binary files a/POC/poc_automation/__pycache__/apps.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/models.cpython-310.pyc b/POC/poc_automation/__pycache__/models.cpython-310.pyc deleted file mode 100644 index 07550bd..0000000 Binary files a/POC/poc_automation/__pycache__/models.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/serializers.cpython-310.pyc b/POC/poc_automation/__pycache__/serializers.cpython-310.pyc deleted file mode 100644 index 41effa2..0000000 Binary files a/POC/poc_automation/__pycache__/serializers.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/test_sample_testcases.cpython-310-pytest-7.2.2.pyc b/POC/poc_automation/__pycache__/test_sample_testcases.cpython-310-pytest-7.2.2.pyc deleted file mode 100644 index cad2299..0000000 Binary files a/POC/poc_automation/__pycache__/test_sample_testcases.cpython-310-pytest-7.2.2.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/urls.cpython-310.pyc b/POC/poc_automation/__pycache__/urls.cpython-310.pyc deleted file mode 100644 index 88ac1ec..0000000 Binary files a/POC/poc_automation/__pycache__/urls.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/__pycache__/views.cpython-310.pyc b/POC/poc_automation/__pycache__/views.cpython-310.pyc deleted file mode 100644 index 86a6a4b..0000000 Binary files a/POC/poc_automation/__pycache__/views.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/conftest.py b/POC/poc_automation/conftest.py new file mode 100644 index 0000000..e315012 --- /dev/null +++ b/POC/poc_automation/conftest.py @@ -0,0 +1,7 @@ +# conftest.py + +import pytest + +def pytest_configure(config): + config.addinivalue_line("markers", "IvinPro_test: Marker for test cases related to Lifeeazy product.") + config.addinivalue_line("markers", "Lifeeazy_test: Marker for test cases related to Ivin_Pro product.") \ No newline at end of file diff --git a/POC/poc_automation/data.html b/POC/poc_automation/data.html new file mode 100644 index 0000000..d2f7b43 --- /dev/null +++ b/POC/poc_automation/data.html @@ -0,0 +1,554 @@ + Test Report
Test Report

Summary

12
6 failed 6 passed

Tests

test_testcases.py 66 0:00:09.739287

FAILED test_lifeeazypost 0:00:02.210582

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/Allergies/' status=400 status_text='Bad Request'>.ok

Setup

Captured stdout setup
6 entries
+

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC1744DF0>
+
+    @pytest.mark.Lifeeazy_test
+    def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None:
+        ab = list1
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'POST' and Test == 'Allergies Post':
+                cleaned_string = url.replace("\u200B", "")
+                post_todo = api_lifeeazy.post(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = post_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "1",
+                                "Pre condition": "Post",
+                                "Flow ": "Post Register",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                "TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                "TestCase Version": Testcase_Version,
+                                "Project Name": Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1), "mani")
+                        # for j in list1:
+                        #     print(j['url'])
+                    else:
+                        data = {"Test Case-Id": "1",
+                                "Pre condition": "Enter the valid details",
+                                "Flow ": "Post Register",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1),"mani")
+                        # for j in list1:
+                        #     print(j['url'])
+    
+                except Exception as e:
+                    data = {"Test Case-Id": "1",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "Post Register",
+                            "App Name": "Lifeeazy",
+                            "Expected Output": '404',
+                            "Actual Output": str(post_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "User",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection2.insert_one(data)
+                    # if values in list1:
+                    #     list1.remove(values)
+                    #     print(len(list1), "mani")
+                    # for j in list1:
+                    #     print(j['url'])
+>               assert post_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/Allergies/' status=400 status_text='Bad Request'>.ok
+
+test_testcases.py:156: AssertionError

Teardown

PASSED test_lifeeazyget 0:00:00.300156

Setup

Call

Teardown

FAILED test_lifeeazyupdate 0:00:00.634519

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/UserAddressUpdate/133/' status=500 status_text='Internal Server Error'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC1744DF0>
+
+    @pytest.mark.Lifeeazy_test
+    def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None:
+        ab = list1
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'PUT' and Test == 'Address Put':
+                cleaned_string = url.replace("\u200B", "")
+                put_todo = api_lifeeazy.put(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = put_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "3",
+                                "Pre condition": "Updating Vitals by using VitalsId",
+                                "Flow ": "Update Vitals",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                " TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1), "mani")
+                        # for j in list1:
+                        #     print(j['url'])
+                    else:
+                        data = {"Test Case-Id": "3",
+                                "Pre condition": "Enter the valid details",
+                                "Flow ": "Update Vitals",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1), "mani")
+                        # for j in list1:
+                        #     print(j['url'])
+                except Exception as e:
+                    data = {"Test Case-Id": "3",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "Update Vitals",
+                            "App Name": "Lifeeazy",
+                            "Expected Output": '404',
+                            "Actual Output": str(put_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "User",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection2.insert_one(data)
+                    # if values in list1:
+                    #     list1.remove(values)
+                    #     print(len(list1), "mani")
+                    # for j in list1:
+                    #     print(j['url'])
+>               assert put_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/UserAddressUpdate/133/' status=500 status_text='Internal Server Error'>.ok
+
+test_testcases.py:347: AssertionError

Teardown

FAILED test_lifeeazydelete 0:00:00.348559

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/RemoveUserApi/291/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC1744DF0>
+
+    @pytest.mark.Lifeeazy_test
+    def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None:
+        ab = list1
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'DELETE' and Test == 'User Delete':
+                cleaned_string = url.replace("\u200B", "")
+                delete_todo = api_lifeeazy.delete(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = delete_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "4",
+                                "Pre condition": "We can delete User by using UserId(id)",
+                                "Flow ": "Delete User details",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                " TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1), "mani")
+                        # for j in list1:
+                        #     print(j['url'])
+                    else:
+                        data = {"Test Case-Id": "4",
+                                "Pre condition": "Enter the valid id",
+                                "Flow ": "Delete User details",
+                                "App Name": "Lifeeazy",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "User",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection2.insert_one(data)
+                        # if values in list1:
+                        #     list1.remove(values)
+                        #     print(len(list1), "mani")
+                        # for j in list1:
+                        #     print(j['url'])
+                except Exception as e:
+                    data = {"Test Case-Id": "4",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "Delete User details",
+                            "App Name": "Lifeeazy",
+                            "Expected Output": '404',
+                            "Actual Output": str(delete_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "User",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection2.insert_one(data)
+                    # if values in list1:
+                    #     list1.remove(values)
+                    #     print(len(list1), "mani")
+                    # for j in list1:
+                    #     print(j['url'])
+>               assert delete_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/RemoveUserApi/291/' status=400 status_text='Bad Request'>.ok
+
+test_testcases.py:441: AssertionError

Teardown

PASSED test_lifeeazyanthrobyfamid 0:00:00.474084

Setup

Call

Teardown

PASSED test_lifeeazyanthrobyuserid 0:00:00.529161

Setup

Call

Teardown

FAILED test_ivinpost 0:00:00.155112

AssertionError: assert False
+ +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/SocialmediaView/' status=400 status_text='Bad Request'>.ok

Setup

Captured stdout setup
6 entries
+

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC2A59450>
+
+    @pytest.mark.IvinPro_test
+    def test_ivinpost(api_ivin: APIRequestContext) -> None:
+        ab = list2
+        print(ab)
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'POST' and Test == 'Socialmedia Post':
+                cleaned_string = url.replace("\u200B", "")
+                post_todo = api_ivin.post(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = post_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "1",
+                                "Pre condition": "Add the candidate profile for social media view",
+                                "Flow ": "SociaMedia Post",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                " TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                    else:
+                        data = {"Test Case-Id": "1",
+                                "Pre condition": "Add the candidate profile for social media view",
+                                "Flow ": "SociaMedia Post",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                except Exception as e:
+                    data = {"Test Case-Id": "1",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "SociaMedia Post",
+                            "App Name": "Ivin_Pro",
+                            "Expected Output": '404',
+                            "Actual Output": str(post_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "Candidate_Profile",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection1.insert_one(data)
+>               assert post_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/SocialmediaView/' status=400 status_text='Bad Request'>.ok
+
+test_testcases.py:708: AssertionError
Captured stdout call
[{'_id': ObjectId('64d3468776792d708d8c32e3'), 'url': '/UserIvin-API/GetAllworkers/', 'method': 'GET', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': 'nan', 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.6', 'Project_Name': 'Ivin_Pro', 'Test': 'UserIvin Getall Workers'}, {'_id': ObjectId('64d3468776792d708d8c32e2'), 'url': '/UserIvin-API/GetAllStateNames', 'method': 'GET', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': 'nan', 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.5', 'Project_Name': 'Ivin_Pro', 'Test': 'UserIvin Getall StateNames'}, {'_id': ObjectId('64d3468776792d708d8c32e1'), 'url': '/candidate_profile/DeleteSocialmedia/211/', 'method': 'DELETE', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': 'nan', 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.4', 'Project_Name': 'Ivin_Pro', 'Test': 'Socialmedia Delete'}, {'_id': ObjectId('64d3468776792d708d8c32e0'), 'url': '/candidate_profile/UpdateSocialmedia/203/', 'method': 'PUT', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': "{\n  'UserId': 1,\n  'SocialMediaType': 'Telegram',\n  'SocialMediaLink': 'https://playwright.dev/',\n  'SocialMediaDescription': 'Playwright'\n}", 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.3', 'Project_Name': 'Ivin_Pro', 'Test': 'Socialmedia Put'}, {'_id': ObjectId('64d3468776792d708d8c32df'), 'url': '/candidate_profile/GetallSocialmedia/', 'method': 'GET', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': 'nan', 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.2', 'Project_Name': 'Ivin_Pro', 'Test': 'Getall Socialmedia'}, {'_id': ObjectId('64d3468776792d708d8c32de'), 'url': '/candidate_profile/SocialmediaView/', 'method': 'POST', 'headers': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk4ODM1OTE3LCJpYXQiOjE2OTEwNTk5MTcsImp0aSI6IjRkOTY5OGRiZjIxMjRlZThiZjMwOTQ5ZTFmMTM0ZDM0IiwidXNlcl9pZCI6M30.OT9N4Md_koAiGmj_oZny5b1FtniYBBJLGKB5AMWdWMo', 'payload': "{\n  'UserId': 1,\n  'SocialMediaType': 'Telegram',\n  'SocialMediaLink': 'https://playwright.dev/',\n  'SocialMediaDescription': 'Playwright'\n}", 'staging_version': 'v3.2.0-Staging', 'EnvironmentName': 'http://172.105.37.117:8000/', 'Testcase_Version': '1.0.0.1', 'Project_Name': 'Ivin_Pro', 'Test': 'Socialmedia Post'}]
+

Teardown

PASSED test_ivinget 0:00:00.528882

Setup

Call

Teardown

FAILED test_ivinupdate 0:00:00.493673

AssertionError: assert False
+ +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/UpdateSocialmedia/203/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC2A59450>
+
+    @pytest.mark.IvinPro_test
+    def test_ivinupdate(api_ivin: APIRequestContext) -> None:
+        ab = list2
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'PUT' and Test == 'Socialmedia Put':
+                cleaned_string = url.replace("\u200B", "")
+                put_todo = api_ivin.put(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = put_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "3",
+                                "Pre condition": "Updating Social media by using candidate profileid",
+                                "Flow ": "Update",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                " TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                    else:
+                        data = {"Test Case-Id": "3",
+                                "Pre condition": "Enter the valid details",
+                                "Flow ": "Update SocialMedia",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                except Exception as e:
+                    data = {"Test Case-Id": "3",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "Update",
+                            "App Name": "Ivin_Pro",
+                            "Expected Output": '404',
+                            "Actual Output": str(put_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "Candidate_Profile",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection1.insert_one(data)
+>               assert put_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/UpdateSocialmedia/203/' status=400 status_text='Bad Request'>.ok
+
+test_testcases.py:864: AssertionError

Teardown

FAILED test_ivindelete 0:00:00.440584

AssertionError: assert False
+ +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/DeleteSocialmedia/211/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x0000016EC2A59450>
+
+    @pytest.mark.IvinPro_test
+    def test_ivindelete(api_ivin: APIRequestContext) -> None:
+        ab = list2
+        for values in ab:
+            url = values['url']
+            method = values['method']
+            headers = values['headers']
+            payload = values['payload']
+            staging_version = values['staging_version']
+            EnvironmentName = values['EnvironmentName']
+            Testcase_Version = values['Testcase_Version']
+            Project_Name = values['Project_Name']
+            Test = values['Test']
+            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
+            if method == 'DELETE' and Test == 'Socialmedia Delete':
+                cleaned_string = url.replace("\u200B", "")
+                delete_todo = api_ivin.delete(url=str(cleaned_string), headers=headers23, data=payload)
+                try:
+                    test1 = delete_todo.json()
+                    if test1['Status'] == 200:
+                        data = {"Test Case-Id": "4",
+                                "Pre condition": "Delete the Social media for particular candidate profileid",
+                                "Flow ": "Delete method",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "200",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Success",
+                                " TestCase Status API": "Pass TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                    else:
+                        data = {"Test Case-Id": "4",
+                                "Pre condition": "Enter the valid id",
+                                "Flow ": "Delete method",
+                                "App Name": "Ivin_Pro",
+                                "Expected Output": "400",
+                                "Actual Output": str(test1),
+                                "Endpoint Name": str(url),
+                                "Section Name": "Candidate_Profile",
+                                "API Type": "User",
+                                "Status Code": test1['Status'],
+                                "Status": "Fail",
+                                " TestCase Status API": "Fail TestCase",
+                                "Test Run Date": DateTime,
+                                "Test Releated To Version": str(staging_version),
+                                'Environment Name': EnvironmentName,
+                                'TestCase Version': Testcase_Version,
+                                'Project Name': Project_Name}
+                        collection1.insert_one(data)
+                except Exception as e:
+                    data = {"Test Case-Id": "4",
+                            "Pre condition": "Give the correct url&data",
+                            "Flow ": "Delete method",
+                            "App Name": "Ivin_Pro",
+                            "Expected Output": '404',
+                            "Actual Output": str(delete_todo),
+                            "Endpoint Name": str(url),
+                            "Section Name": "Candidate_Profile",
+                            "API Type": "User",
+                            "Status Code": 404,
+                            "Status": "Not Found",
+                            " TestCase Status API": "Fail TestCase",
+                            "Test Run Date": DateTime,
+                            "Test Releated To Version": str(staging_version),
+                            'Environment Name': EnvironmentName,
+                            'TestCase Version': Testcase_Version,
+                            'Project Name': Project_Name}
+                    collection1.insert_one(data)
+>               assert delete_todo.ok
+E               AssertionError: assert False
+E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/DeleteSocialmedia/211/' status=400 status_text='Bad Request'>.ok
+
+test_testcases.py:942: AssertionError

Teardown

PASSED test_ivingetallstates 0:00:03.307245

Setup

Call

Teardown

PASSED test_ivingetallworkers 0:00:00.316731

Setup

Call

Teardown

\ No newline at end of file diff --git a/POC/poc_automation/migrations/__pycache__/0001_initial.cpython-310.pyc b/POC/poc_automation/migrations/__pycache__/0001_initial.cpython-310.pyc deleted file mode 100644 index e6b9d42..0000000 Binary files a/POC/poc_automation/migrations/__pycache__/0001_initial.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/migrations/__pycache__/__init__.cpython-310.pyc b/POC/poc_automation/migrations/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 10a4ef9..0000000 Binary files a/POC/poc_automation/migrations/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/POC/poc_automation/models.py b/POC/poc_automation/models.py index e95da88..b7262c9 100644 --- a/POC/poc_automation/models.py +++ b/POC/poc_automation/models.py @@ -15,7 +15,7 @@ class InputModel(models.Model): objects = models.Manager() class Meta: - db_table = 'Input_IvinProData' + db_table = 'Poc_Input_IvinPro' class lifeeazyModel(models.Model): @@ -32,4 +32,4 @@ class lifeeazyModel(models.Model): objects = models.Manager() class Meta: - db_table = 'Input_LifeeazyData' + db_table = 'Poc_Input_Lifeeazy' diff --git a/POC/poc_automation/report.html b/POC/poc_automation/report.html index 6913134..a2f779c 100644 --- a/POC/poc_automation/report.html +++ b/POC/poc_automation/report.html @@ -3,25 +3,11 @@
Test Report

Summary

14
6 failed 8 passed

Tests

test_sample_testcases.py 68 0:00:34.375546

PASSED test_getalergies 0:00:02.584031

Setup

Captured stdout setup
8 entries
-

Call

Captured stdout call
7
-/User/GetLabLevelsByFamilyId/1
-/User/AnthropometricsGetByUserId/1/
-/User/RemoveUserApi/291/
-/User/UserAddressUpdate/133/
-/User/AllergiesGetApi/
-/User/Allergies/
-/User/AnthropometricsGetByFamilyById/1
-

Teardown

PASSED test_example 0:00:01.127254

Setup

Call

Captured stdout call
6
-/User/GetLabLevelsByFamilyId/1
-/User/AnthropometricsGetByUserId/1/
-/User/RemoveUserApi/291/
-/User/UserAddressUpdate/133/
-/User/AllergiesGetApi/
-/User/Allergies/
-

Teardown

FAILED test_lifeeazypost 0:00:00.772662

AssertionError: assert False
- +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/Allergies/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD4730>
+    
Test Report

Summary

6
3 failed 3 passed

Tests

test_testcases.py 33 0:00:04.834689

FAILED test_lifeeazypost 0:00:01.644355

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/Allergies/' status=400 status_text='Bad Request'>.ok

Setup

Captured stdout setup
6 entries
+

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000020354DE1AE0>
 
+    @pytest.mark.Lifeeazy_test
     def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None:
         ab = list1
         for values in ab:
@@ -58,7 +44,7 @@
                                 'Environment Name': EnvironmentName,
                                 "TestCase Version": Testcase_Version,
                                 "Project Name": Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1), "mani")
@@ -82,7 +68,7 @@
                                 'Environment Name': EnvironmentName,
                                 'TestCase Version': Testcase_Version,
                                 'Project Name': Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1),"mani")
@@ -107,7 +93,7 @@
                             'Environment Name': EnvironmentName,
                             'TestCase Version': Testcase_Version,
                             'Project Name': Project_Name}
-                    collection1.insert_one(data)
+                    collection2.insert_one(data)
                     # if values in list1:
                     #     list1.remove(values)
                     #     print(len(list1), "mani")
@@ -117,9 +103,10 @@
 E               AssertionError: assert False
 E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/Allergies/' status=400 status_text='Bad Request'>.ok
 
-test_sample_testcases.py:338: AssertionError

Teardown

PASSED test_lifeeazyget 0:00:01.502018

Setup

Call

Teardown

FAILED test_lifeeazyupdate 0:00:01.341278

AssertionError: assert False
- +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/UserAddressUpdate/133/' status=500 status_text='Internal Server Error'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD4730>
+test_testcases.py:156: AssertionError

Teardown

PASSED test_lifeeazyget 0:00:00.503384

Setup

Call

Teardown

FAILED test_lifeeazyupdate 0:00:00.485305

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/UserAddressUpdate/133/' status=500 status_text='Internal Server Error'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000020354DE1AE0>
 
+    @pytest.mark.Lifeeazy_test
     def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None:
         ab = list1
         for values in ab:
@@ -156,7 +143,7 @@
                                 'Environment Name': EnvironmentName,
                                 'TestCase Version': Testcase_Version,
                                 'Project Name': Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1), "mani")
@@ -180,7 +167,7 @@
                                 'Environment Name': EnvironmentName,
                                 'TestCase Version': Testcase_Version,
                                 'Project Name': Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1), "mani")
@@ -204,7 +191,7 @@
                             'Environment Name': EnvironmentName,
                             'TestCase Version': Testcase_Version,
                             'Project Name': Project_Name}
-                    collection1.insert_one(data)
+                    collection2.insert_one(data)
                     # if values in list1:
                     #     list1.remove(values)
                     #     print(len(list1), "mani")
@@ -214,9 +201,10 @@
 E               AssertionError: assert False
 E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/UserAddressUpdate/133/' status=500 status_text='Internal Server Error'>.ok
 
-test_sample_testcases.py:525: AssertionError

Teardown

FAILED test_lifeeazydelete 0:00:01.551486

AssertionError: assert False
- +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/RemoveUserApi/291/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD4730>
+test_testcases.py:347: AssertionError

Teardown

FAILED test_lifeeazydelete 0:00:00.481285

AssertionError: assert False
+ +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/RemoveUserApi/291/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_lifeeazy = <playwright._impl._fetch.APIRequestContext object at 0x0000020354DE1AE0>
 
+    @pytest.mark.Lifeeazy_test
     def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None:
         ab = list1
         for values in ab:
@@ -253,7 +241,7 @@
                                 'Environment Name': EnvironmentName,
                                 'TestCase Version': Testcase_Version,
                                 'Project Name': Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1), "mani")
@@ -277,7 +265,7 @@
                                 'Environment Name': EnvironmentName,
                                 'TestCase Version': Testcase_Version,
                                 'Project Name': Project_Name}
-                        collection1.insert_one(data)
+                        collection2.insert_one(data)
                         # if values in list1:
                         #     list1.remove(values)
                         #     print(len(list1), "mani")
@@ -301,7 +289,7 @@
                             'Environment Name': EnvironmentName,
                             'TestCase Version': Testcase_Version,
                             'Project Name': Project_Name}
-                    collection1.insert_one(data)
+                    collection2.insert_one(data)
                     # if values in list1:
                     #     list1.remove(values)
                     #     print(len(list1), "mani")
@@ -311,262 +299,4 @@
 E               AssertionError: assert False
 E                +  where False = <APIResponse url='http://staging-api.vivifyhealthcare.com/User/RemoveUserApi/291/' status=400 status_text='Bad Request'>.ok
 
-test_sample_testcases.py:617: AssertionError

Teardown

PASSED test_example1 0:00:02.042268

Setup

Call

Captured stdout call
5
-/User/GetLabLevelsByFamilyId/1
-/User/RemoveUserApi/291/
-/User/UserAddressUpdate/133/
-/User/AllergiesGetApi/
-/User/Allergies/
-

Teardown

PASSED test_example2 0:00:03.018234

Setup

Call

Captured stdout call
4
-/User/RemoveUserApi/291/
-/User/UserAddressUpdate/133/
-/User/AllergiesGetApi/
-/User/Allergies/
-

Teardown

FAILED test_ivinpost 0:00:02.377819

AssertionError: assert False
- +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/SocialmediaView/' status=400 status_text='Bad Request'>.ok

Setup

Captured stdout setup
6 entries
-

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD75E0>
-
-    def test_ivinpost(api_ivin: APIRequestContext) -> None:
-        ab = list2
-        for values in ab:
-            url = values['url']
-            method = values['method']
-            headers = values['headers']
-            payload = values['payload']
-            staging_version = values['staging_version']
-            EnvironmentName = values['EnvironmentName']
-            Testcase_Version = values['Testcase_Version']
-            Project_Name = values['Project_Name']
-            Test = values['Test']
-            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
-            if method == 'POST' and Test == 'Spost':
-                cleaned_string = url.replace("\u200B", "")
-                post_todo = api_ivin.post(url=str(cleaned_string), headers=headers23, data=payload)
-                try:
-                    test1 = post_todo.json()
-                    if test1['Status'] == 200:
-                        data = {"Test Case-Id": "1",
-                                "Pre condition": "Add the candidate profile for social media view",
-                                "Flow ": "SociaMedia Post",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "200",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Success",
-                                " TestCase Status API": "Pass TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                    else:
-                        data = {"Test Case-Id": "1",
-                                "Pre condition": "Add the candidate profile for social media view",
-                                "Flow ": "SociaMedia Post",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "400",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Fail",
-                                " TestCase Status API": "Fail TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                except Exception as e:
-                    data = {"Test Case-Id": "1",
-                            "Pre condition": "Give the correct url&data",
-                            "Flow ": "SociaMedia Post",
-                            "App Name": "Ivin_Pro",
-                            "Expected Output": '404',
-                            "Actual Output": str(post_todo),
-                            "Endpoint Name": str(url),
-                            "Section Name": "Candidate_Profile",
-                            "API Type": "User",
-                            "Status Code": 404,
-                            "Status": "Not Found",
-                            " TestCase Status API": "Fail TestCase",
-                            "Test Run Date": DateTime,
-                            "Test Releated To Version": str(staging_version),
-                            'Environment Name': EnvironmentName,
-                            'TestCase Version': Testcase_Version,
-                            'Project Name': Project_Name}
-                    collection2.insert_one(data)
->               assert post_todo.ok
-E               AssertionError: assert False
-E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/SocialmediaView/' status=400 status_text='Bad Request'>.ok
-
-test_sample_testcases.py:878: AssertionError

Teardown

PASSED test_ivinget 0:00:02.468406

Setup

Call

Teardown

FAILED test_ivinupdate 0:00:01.191471

AssertionError: assert False
- +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/UpdateSocialmedia/203/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD75E0>
-
-    def test_ivinupdate(api_ivin: APIRequestContext) -> None:
-        ab = list2
-        for values in ab:
-            url = values['url']
-            method = values['method']
-            headers = values['headers']
-            payload = values['payload']
-            staging_version = values['staging_version']
-            EnvironmentName = values['EnvironmentName']
-            Testcase_Version = values['Testcase_Version']
-            Project_Name = values['Project_Name']
-            Test = values['Test']
-            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
-            if method == 'PUT' and Test == 'Sput':
-                cleaned_string = url.replace("\u200B", "")
-                put_todo = api_ivin.put(url=str(cleaned_string), headers=headers23, data=payload)
-                try:
-                    test1 = put_todo.json()
-                    if test1['Status'] == 200:
-                        data = {"Test Case-Id": "3",
-                                "Pre condition": "Updating Social media by using candidate profileid",
-                                "Flow ": "Update",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "200",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Success",
-                                " TestCase Status API": "Pass TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                    else:
-                        data = {"Test Case-Id": "3",
-                                "Pre condition": "Enter the valid details",
-                                "Flow ": "Update SocialMedia",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "400",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Fail",
-                                " TestCase Status API": "Fail TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                except Exception as e:
-                    data = {"Test Case-Id": "3",
-                            "Pre condition": "Give the correct url&data",
-                            "Flow ": "Update",
-                            "App Name": "Ivin_Pro",
-                            "Expected Output": '404',
-                            "Actual Output": str(put_todo),
-                            "Endpoint Name": str(url),
-                            "Section Name": "Candidate_Profile",
-                            "API Type": "User",
-                            "Status Code": 404,
-                            "Status": "Not Found",
-                            " TestCase Status API": "Fail TestCase",
-                            "Test Run Date": DateTime,
-                            "Test Releated To Version": str(staging_version),
-                            'Environment Name': EnvironmentName,
-                            'TestCase Version': Testcase_Version,
-                            'Project Name': Project_Name}
-                    collection2.insert_one(data)
->               assert put_todo.ok
-E               AssertionError: assert False
-E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/UpdateSocialmedia/203/' status=400 status_text='Bad Request'>.ok
-
-test_sample_testcases.py:1032: AssertionError

Teardown

FAILED test_ivindelete 0:00:04.813745

AssertionError: assert False
- +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/DeleteSocialmedia/211/' status=400 status_text='Bad Request'>.ok

Setup

Call

api_ivin = <playwright._impl._fetch.APIRequestContext object at 0x000001D9A9DD75E0>
-
-    def test_ivindelete(api_ivin: APIRequestContext) -> None:
-        ab = list2
-        for values in ab:
-            url = values['url']
-            method = values['method']
-            headers = values['headers']
-            payload = values['payload']
-            staging_version = values['staging_version']
-            EnvironmentName = values['EnvironmentName']
-            Testcase_Version = values['Testcase_Version']
-            Project_Name = values['Project_Name']
-            Test = values['Test']
-            headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"}
-            if method == 'DELETE' and Test == 'Sdelete':
-                cleaned_string = url.replace("\u200B", "")
-                delete_todo = api_ivin.delete(url=str(cleaned_string), headers=headers23, data=payload)
-                try:
-                    test1 = delete_todo.json()
-                    if test1['Status'] == 200:
-                        data = {"Test Case-Id": "4",
-                                "Pre condition": "Delete the Social media for particular candidate profileid",
-                                "Flow ": "Delete method",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "200",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Success",
-                                " TestCase Status API": "Pass TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                    else:
-                        data = {"Test Case-Id": "4",
-                                "Pre condition": "Enter the valid id",
-                                "Flow ": "Delete method",
-                                "App Name": "Ivin_Pro",
-                                "Expected Output": "400",
-                                "Actual Output": str(test1),
-                                "Endpoint Name": str(url),
-                                "Section Name": "Candidate_Profile",
-                                "API Type": "User",
-                                "Status Code": test1['Status'],
-                                "Status": "Fail",
-                                " TestCase Status API": "Fail TestCase",
-                                "Test Run Date": DateTime,
-                                "Test Releated To Version": str(staging_version),
-                                'Environment Name': EnvironmentName,
-                                'TestCase Version': Testcase_Version,
-                                'Project Name': Project_Name}
-                        collection2.insert_one(data)
-                except Exception as e:
-                    data = {"Test Case-Id": "4",
-                            "Pre condition": "Give the correct url&data",
-                            "Flow ": "Delete method",
-                            "App Name": "Ivin_Pro",
-                            "Expected Output": '404',
-                            "Actual Output": str(delete_todo),
-                            "Endpoint Name": str(url),
-                            "Section Name": "Candidate_Profile",
-                            "API Type": "User",
-                            "Status Code": 404,
-                            "Status": "Not Found",
-                            " TestCase Status API": "Fail TestCase",
-                            "Test Run Date": DateTime,
-                            "Test Releated To Version": str(staging_version),
-                            'Environment Name': EnvironmentName,
-                            'TestCase Version': Testcase_Version,
-                            'Project Name': Project_Name}
-                    collection2.insert_one(data)
->               assert delete_todo.ok
-E               AssertionError: assert False
-E                +  where False = <APIResponse url='http://172.105.37.117:8000/candidate_profile/DeleteSocialmedia/211/' status=400 status_text='Bad Request'>.ok
-
-test_sample_testcases.py:1109: AssertionError

Teardown

PASSED test_ivingetall 0:00:05.417862

Setup

Call

Teardown

PASSED test_ivingetall1 0:00:04.167011

Setup

Call

Teardown

\ No newline at end of file +test_testcases.py:441: AssertionError

Teardown

PASSED test_lifeeazyanthrobyfamid 0:00:01.123106

Setup

Call

Teardown

PASSED test_lifeeazyanthrobyuserid 0:00:00.597255

Setup

Call

Teardown

\ No newline at end of file diff --git a/POC/poc_automation/serializers.py b/POC/poc_automation/serializers.py index 66e2a2c..4ffcb18 100644 --- a/POC/poc_automation/serializers.py +++ b/POC/poc_automation/serializers.py @@ -2,32 +2,31 @@ from .models import InputModel,lifeeazyModel -class MyModelSerializer(serializers.ModelSerializer): +class IvinSerializer(serializers.ModelSerializer): class Meta: model = InputModel fields = '__all__' -class lifeSerializer(serializers.ModelSerializer): + +class IvinProjectSerializer(serializers.ModelSerializer): + class Meta: + model = InputModel + fields = ['Project_Name'] + +class lifeeazySerializer(serializers.ModelSerializer): objects = None class Meta: model = lifeeazyModel fields = '__all__' -class lifeeazySerializer(serializers.ModelSerializer): +class lifeeazyProjectSerializer(serializers.ModelSerializer): class Meta: model = lifeeazyModel fields = ['Project_Name'] -class MydataSerializer(serializers.ModelSerializer): - class Meta: - model = InputModel - fields = '__all__' -class ProjectSerializer(serializers.ModelSerializer): - class Meta: - model = InputModel - fields = ['Project_Name'] + # def create(self, validated_data): diff --git a/POC/poc_automation/test_sample_testcases.py b/POC/poc_automation/test_testcases.py similarity index 81% rename from POC/poc_automation/test_sample_testcases.py rename to POC/poc_automation/test_testcases.py index bc7b124..c2fdea2 100644 --- a/POC/poc_automation/test_sample_testcases.py +++ b/POC/poc_automation/test_testcases.py @@ -20,15 +20,15 @@ except: myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient[a] -collection1 = mydb["Output_FirstData"] -collection2 = mydb["Output_SecondData"] +collection1 = mydb["Poc_Output_IvinPro"] +collection2 = mydb["Poc_Output_Lifeeazy"] client = MongoClient('mongodb://localhost:27017/') db = client['poc'] -results_collection1 = db['Input_LifeeazyData'] -results_collection2 = db['Input_IvinProData'] +results_collection1 = db['Poc_Input_IvinPro'] +results_collection2 = db['Poc_Input_Lifeeazy'] def get1_entries(): - c = results_collection1.find().sort("_id", -1).limit(8) + c = results_collection2.find().sort("_id", -1).limit(6) entries = [] for i in c: entries.append(i) @@ -36,7 +36,7 @@ def get1_entries(): return entries def get2_entries(): - k = results_collection2.find().sort("_id", -1).limit(6) + k = results_collection1.find().sort("_id", -1).limit(6) entries = [] for j in k: entries.append(j) @@ -44,206 +44,24 @@ def get2_entries(): return entries @pytest.fixture(scope="session") def api_lifeeazy(playwright: Playwright) -> Generator[APIRequestContext, None, None]: - request_context = playwright.request.new_context(base_url="http://staging-api.vivifyhealthcare.com/") global list1 list1 = get1_entries() + n = list1[0]['EnvironmentName'] + request_context = playwright.request.new_context(base_url=str(n)) yield request_context request_context.dispose() @pytest.fixture(scope="session") def api_ivin(playwright: Playwright) -> Generator[APIRequestContext, None, None]: - request_context = playwright.request.new_context(base_url="http://172.105.37.117:8000/") global list2 list2 = get2_entries() + ba = list2[0]['EnvironmentName'] + request_context = playwright.request.new_context(base_url=str(ba)) yield request_context request_context.dispose() - -def test_getalergies(api_lifeeazy: APIRequestContext) -> None: - ac = list1 - for values in ac: - url = values['url'] - method = values['method'] - headers = values['headers'] - payload = values['payload'] - staging_version = values['staging_version'] - EnvironmentName = values['EnvironmentName'] - Testcase_Version = values['Testcase_Version'] - Project_Name = values['Project_Name'] - Test = values['Test'] - headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Allergiesbyuserid Get': - cleaned_string = url.replace("\u200B", "") - get_todo = api_lifeeazy.get(url=str(cleaned_string), headers=headers23) - try: - test1 = get_todo.json() - if test1['Status'] == 200: - data = {"Test Case-Id": "5", - "Pre condition": "Allergies data based on Userid", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": "200", - "Actual Output": str(test1), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": test1['Status'], - "Status": "Success", - " TestCase Status API": "Pass TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) - else: - data = {"Test Case-Id": "5", - "Pre condition": "Enter the correct userid", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": "400", - "Actual Output": str(test1), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": test1['Status'], - "Status": "Fail", - " TestCase Status API": "Fail TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) - except Exception as e: - data = {"Test Case-Id": "5", - "Pre condition": "Give the correct url&data", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": '404', - "Actual Output": str(get_todo), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": 404, - "Status": "Not Found", - " TestCase Status API": "Fail TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) - assert get_todo.ok - -def test_example(api_lifeeazy: APIRequestContext) -> None: - ac = list1 - for values in ac: - url = values['url'] - method = values['method'] - headers = values['headers'] - payload = values['payload'] - staging_version = values['staging_version'] - EnvironmentName = values['EnvironmentName'] - Testcase_Version = values['Testcase_Version'] - Project_Name = values['Project_Name'] - Test = values['Test'] - headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Anthropometricsbyfamilyid Get': - cleaned_string = url.replace("\u200B", "") - get_todo = api_lifeeazy.get(url=str(cleaned_string), headers=headers23) - try: - test1 = get_todo.json() - if test1['Status'] == 200: - data = {"Test Case-Id": "6", - "Pre condition": "Get the Anthropometric data based on FamilyId", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": "200", - "Actual Output": str(test1), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": test1['Status'], - "Status": "Success", - " TestCase Status API": "Pass TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) - else: - data = {"Test Case-Id": "6", - "Pre condition": "Enter the correct familyid", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": "400", - "Actual Output": str(test1), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": test1['Status'], - "Status": "Fail", - " TestCase Status API": "Fail TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) - except Exception as e: - data = {"Test Case-Id": "6", - "Pre condition": "Give the correct url&data", - "Flow ": "Get", - "App Name": "Lifeeazy", - "Expected Output": '404', - "Actual Output": str(get_todo), - "Endpoint Name": str(url), - "Section Name": "User", - "API Type": "User", - "Status Code": 404, - "Status": "Not Found", - " TestCase Status API": "Fail TestCase", - "Test Run Date": DateTime, - "Test Releated To Version": str(staging_version), - 'Environment Name': EnvironmentName, - 'TestCase Version': Testcase_Version, - 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1),) - for j in list1: - print(j['url']) - assert get_todo.ok - +@pytest.mark.Lifeeazy_test def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None: ab = list1 for values in ab: @@ -280,7 +98,7 @@ def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, "TestCase Version": Testcase_Version, "Project Name": Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -304,7 +122,7 @@ def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1),"mani") @@ -329,7 +147,7 @@ def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -337,6 +155,8 @@ def test_lifeeazypost(api_lifeeazy: APIRequestContext) -> None: # print(j['url']) assert post_todo.ok + +@pytest.mark.Lifeeazy_test def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: ab = list1 for values in ab: @@ -376,7 +196,7 @@ def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -400,7 +220,7 @@ def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -424,7 +244,7 @@ def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -432,6 +252,8 @@ def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: # print(j['url']) assert get_todo.ok + +@pytest.mark.Lifeeazy_test def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None: ab = list1 for values in ab: @@ -468,7 +290,7 @@ def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -492,7 +314,7 @@ def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -516,7 +338,7 @@ def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -524,6 +346,8 @@ def test_lifeeazyupdate(api_lifeeazy: APIRequestContext) -> None: # print(j['url']) assert put_todo.ok + +@pytest.mark.Lifeeazy_test def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None: ab = list1 for values in ab: @@ -560,7 +384,7 @@ def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -584,7 +408,7 @@ def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -608,7 +432,7 @@ def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) + collection2.insert_one(data) # if values in list1: # list1.remove(values) # print(len(list1), "mani") @@ -616,7 +440,9 @@ def test_lifeeazydelete(api_lifeeazy: APIRequestContext) -> None: # print(j['url']) assert delete_todo.ok -def test_example1(api_lifeeazy: APIRequestContext) -> None: + +@pytest.mark.Lifeeazy_test +def test_lifeeazyanthrobyfamid(api_lifeeazy: APIRequestContext) -> None: ac = list1 for values in ac: url = values['url'] @@ -629,14 +455,14 @@ def test_example1(api_lifeeazy: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Anthropometricsbyuserid Get': + if method == 'GET' and Test == 'Anthropometricsbyfamilyid Get': cleaned_string = url.replace("\u200B", "") get_todo = api_lifeeazy.get(url=str(cleaned_string), headers=headers23) try: test1 = get_todo.json() if test1['Status'] == 200: - data = {"Test Case-Id": "7", - "Pre condition": "Get the Anthropometric data based on UserId", + data = {"Test Case-Id": "5", + "Pre condition": "Get the Anthropometric data based on FamilyId", "Flow ": "Get", "App Name": "Lifeeazy", "Expected Output": "200", @@ -652,15 +478,15 @@ def test_example1(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1)) + # for j in list1: + # print(j['url']) else: - data = {"Test Case-Id": "7", - "Pre condition": "Enter the correct userid", + data = {"Test Case-Id": "5", + "Pre condition": "Enter the correct familyid", "Flow ": "Get", "App Name": "Lifeeazy", "Expected Output": "400", @@ -676,14 +502,14 @@ def test_example1(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1)) + # for j in list1: + # print(j['url']) except Exception as e: - data = {"Test Case-Id": "7", + data = {"Test Case-Id": "5", "Pre condition": "Give the correct url&data", "Flow ": "Get", "App Name": "Lifeeazy", @@ -700,15 +526,17 @@ def test_example1(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1),) + # for j in list1: + # print(j['url']) assert get_todo.ok -def test_example2(api_lifeeazy: APIRequestContext) -> None: + +@pytest.mark.Lifeeazy_test +def test_lifeeazyanthrobyuserid(api_lifeeazy: APIRequestContext) -> None: ac = list1 for values in ac: url = values['url'] @@ -721,14 +549,14 @@ def test_example2(api_lifeeazy: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Lablevelbyfamilyid Get': + if method == 'GET' and Test == 'Anthropometricsbyuserid Get': cleaned_string = url.replace("\u200B", "") get_todo = api_lifeeazy.get(url=str(cleaned_string), headers=headers23) try: test1 = get_todo.json() if test1['Status'] == 200: - data = {"Test Case-Id": "8", - "Pre condition": "Lablevel details of family member by using familyid", + data = {"Test Case-Id": "6", + "Pre condition": "Get the Anthropometric data based on UserId", "Flow ": "Get", "App Name": "Lifeeazy", "Expected Output": "200", @@ -744,15 +572,15 @@ def test_example2(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1)) + # for j in list1: + # print(j['url']) else: - data = {"Test Case-Id": "8", - "Pre condition": "Enter the correct familyid", + data = {"Test Case-Id": "6", + "Pre condition": "Enter the correct userid", "Flow ": "Get", "App Name": "Lifeeazy", "Expected Output": "400", @@ -768,14 +596,14 @@ def test_example2(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1)) + # for j in list1: + # print(j['url']) except Exception as e: - data = {"Test Case-Id": "8", + data = {"Test Case-Id": "6", "Pre condition": "Give the correct url&data", "Flow ": "Get", "App Name": "Lifeeazy", @@ -792,16 +620,18 @@ def test_example2(api_lifeeazy: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection1.insert_one(data) - if values in list1: - list1.remove(values) - print(len(list1)) - for j in list1: - print(j['url']) + collection2.insert_one(data) + # if values in list1: + # list1.remove(values) + # print(len(list1)) + # for j in list1: + # print(j['url']) assert get_todo.ok +@pytest.mark.IvinPro_test def test_ivinpost(api_ivin: APIRequestContext) -> None: ab = list2 + print(ab) for values in ab: url = values['url'] method = values['method'] @@ -813,7 +643,7 @@ def test_ivinpost(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'POST' and Test == 'Spost': + if method == 'POST' and Test == 'Socialmedia Post': cleaned_string = url.replace("\u200B", "") post_todo = api_ivin.post(url=str(cleaned_string), headers=headers23, data=payload) try: @@ -836,7 +666,7 @@ def test_ivinpost(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "1", "Pre condition": "Add the candidate profile for social media view", @@ -855,7 +685,7 @@ def test_ivinpost(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "1", "Pre condition": "Give the correct url&data", @@ -874,9 +704,10 @@ def test_ivinpost(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert post_todo.ok +@pytest.mark.IvinPro_test def test_ivinget(api_ivin: APIRequestContext) -> None: ab = list2 for values in ab: @@ -890,7 +721,7 @@ def test_ivinget(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Sgetall': + if method == 'GET' and Test == 'Getall Socialmedia': cleaned_string = url.replace("\u200B", "") get_todo = api_ivin.get(url=str(cleaned_string), headers=headers23) try: @@ -913,7 +744,7 @@ def test_ivinget(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "2", "Pre condition": "Enter the valid details", @@ -932,7 +763,7 @@ def test_ivinget(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "2", "Pre condition": "Give the correct url&data", @@ -951,9 +782,10 @@ def test_ivinget(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert get_todo.ok +@pytest.mark.IvinPro_test def test_ivinupdate(api_ivin: APIRequestContext) -> None: ab = list2 for values in ab: @@ -967,7 +799,7 @@ def test_ivinupdate(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'PUT' and Test == 'Sput': + if method == 'PUT' and Test == 'Socialmedia Put': cleaned_string = url.replace("\u200B", "") put_todo = api_ivin.put(url=str(cleaned_string), headers=headers23, data=payload) try: @@ -990,7 +822,7 @@ def test_ivinupdate(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "3", "Pre condition": "Enter the valid details", @@ -1009,7 +841,7 @@ def test_ivinupdate(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "3", "Pre condition": "Give the correct url&data", @@ -1028,9 +860,10 @@ def test_ivinupdate(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert put_todo.ok +@pytest.mark.IvinPro_test def test_ivindelete(api_ivin: APIRequestContext) -> None: ab = list2 for values in ab: @@ -1044,7 +877,7 @@ def test_ivindelete(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'DELETE' and Test == 'Sdelete': + if method == 'DELETE' and Test == 'Socialmedia Delete': cleaned_string = url.replace("\u200B", "") delete_todo = api_ivin.delete(url=str(cleaned_string), headers=headers23, data=payload) try: @@ -1067,7 +900,7 @@ def test_ivindelete(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "4", "Pre condition": "Enter the valid id", @@ -1086,7 +919,7 @@ def test_ivindelete(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "4", "Pre condition": "Give the correct url&data", @@ -1105,10 +938,11 @@ def test_ivindelete(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert delete_todo.ok -def test_ivingetall(api_ivin: APIRequestContext) -> None: +@pytest.mark.IvinPro_test +def test_ivingetallstates(api_ivin: APIRequestContext) -> None: ab = list2 for values in ab: url = values['url'] @@ -1121,7 +955,7 @@ def test_ivingetall(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Getall StateNames': + if method == 'GET' and Test == 'UserIvin Getall StateNames': cleaned_string = url.replace("\u200B", "") get_todo = api_ivin.get(url=str(cleaned_string), headers=headers23) try: @@ -1144,7 +978,7 @@ def test_ivingetall(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "5", "Pre condition": "Enter the valid details", @@ -1163,7 +997,7 @@ def test_ivingetall(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "5", "Pre condition": "Give the correct url&data", @@ -1182,10 +1016,11 @@ def test_ivingetall(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert get_todo.ok -def test_ivingetall1(api_ivin: APIRequestContext) -> None: +@pytest.mark.IvinPro_test +def test_ivingetallworkers(api_ivin: APIRequestContext) -> None: ab = list2 for values in ab: url = values['url'] @@ -1198,7 +1033,7 @@ def test_ivingetall1(api_ivin: APIRequestContext) -> None: Project_Name = values['Project_Name'] Test = values['Test'] headers23 = {'Content-Type': 'application/json', 'Authorization': f"Bearer {headers}"} - if method == 'GET' and Test == 'Getall Workers': + if method == 'GET' and Test == 'UserIvin Getall Workers': cleaned_string = url.replace("\u200B", "") get_todo = api_ivin.get(url=str(cleaned_string), headers=headers23) try: @@ -1221,7 +1056,7 @@ def test_ivingetall1(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) else: data = {"Test Case-Id": "6", "Pre condition": "Enter the valid details", @@ -1240,7 +1075,7 @@ def test_ivingetall1(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) except Exception as e: data = {"Test Case-Id": "6", "Pre condition": "Give the correct url&data", @@ -1259,5 +1094,5 @@ def test_ivingetall1(api_ivin: APIRequestContext) -> None: 'Environment Name': EnvironmentName, 'TestCase Version': Testcase_Version, 'Project Name': Project_Name} - collection2.insert_one(data) + collection1.insert_one(data) assert get_todo.ok diff --git a/POC/poc_automation/testcases_Ivin.xlsx b/POC/poc_automation/testcases_Ivin.xlsx index 213fa4c..b5a2d08 100644 Binary files a/POC/poc_automation/testcases_Ivin.xlsx and b/POC/poc_automation/testcases_Ivin.xlsx differ diff --git a/POC/poc_automation/testcases_lifeeazy.xlsx b/POC/poc_automation/testcases_lifeeazy.xlsx index 91fe359..18d3ac9 100644 Binary files a/POC/poc_automation/testcases_lifeeazy.xlsx and b/POC/poc_automation/testcases_lifeeazy.xlsx differ diff --git a/POC/poc_automation/urls.py b/POC/poc_automation/urls.py index 9176f26..8db9c20 100644 --- a/POC/poc_automation/urls.py +++ b/POC/poc_automation/urls.py @@ -4,16 +4,16 @@ # from .test_excel import objects urlpatterns = [ - path('post/', IvinExcelUpload.as_view(), name='ivin upload'), - path('getall/', Ivingetall.as_view(), name='getall ivin details'), - path('project/', IvinProjectname.as_view(), name='project-name'), - path('projectname/', IvinProject.as_view(), name='projectname'), + path('upload/', IvinExcelUpload.as_view(), name='ivin upload'), + path('getalldetails/', Ivingetall.as_view(), name='getall ivin details'), + path('projectname/', IvinProjectname.as_view(), name='project-name'), + path('project/', IvinProject.as_view(), name='projectname'), path('put/', IvinUpdate.as_view(), name='update'), path('delete/', IvinDelete.as_view(), name='delete'), - path('lifepost/', lifeeazyExcelUpload.as_view(), name='lifeeazy-data'), - path('lifegetall/', lifeeazygetall.as_view(), name='lifeeazy-getall'), - path('lifeget/', lifeeazyProjectname.as_view(), name='lifeeazy-projectname'), - path('lifegetproject/', lifeeazygetproject.as_view(), name='projectname'), + path('post/', lifeeazyExcelUpload.as_view(), name='lifeeazy-data'), + path('getall/', lifeeazygetall.as_view(), name='lifeeazy-getall'), + path('pname/', lifeeazyProjectname.as_view(), name='lifeeazy-projectname'), + path('getprojectname/', lifeeazygetproject.as_view(), name='projectname'), # path('object//',objects.as_view()) ] diff --git a/POC/poc_automation/views.py b/POC/poc_automation/views.py index 75d2c3d..e320804 100644 --- a/POC/poc_automation/views.py +++ b/POC/poc_automation/views.py @@ -1,24 +1,24 @@ from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import generics -from .serializers import MyModelSerializer,MydataSerializer, ProjectSerializer, lifeSerializer, lifeeazySerializer +from .serializers import * from rest_framework.generics import GenericAPIView import pandas as pd from .models import * class IvinExcelUpload(GenericAPIView): - serializer_class = MyModelSerializer + serializer_class = IvinSerializer def post(self, request): df = pd.read_excel(r'F:\poc-automatica\POC\poc_automation\testcases_Ivin.xlsx') rows = df.to_dict(orient='records') - serializer = MyModelSerializer(data=rows, many=True) + serializer = IvinSerializer(data=rows, many=True) if serializer.is_valid(): serializer.save() - return Response("Data uploaded successfully") + return Response("IvinPro Upload Successfully") else: return Response(serializer.errors, status=400) @@ -26,21 +26,20 @@ def post(self, request): class Ivingetall(APIView): def get(self, request): queryset = InputModel.objects.all() - serializer = MyModelSerializer(queryset, many=True) + serializer = IvinSerializer(queryset, many=True) return Response(serializer.data) class IvinProjectname(generics.GenericAPIView): - queryset = MydataSerializer - + queryset = IvinProjectSerializer def get(self, request, Project_Name): project_name = InputModel.objects.filter(Project_Name=Project_Name) - serializer = MydataSerializer(project_name,many=True) + serializer = IvinProjectSerializer(project_name,many=True) return Response(serializer.data) class IvinProject(generics.GenericAPIView): - serializer_class = ProjectSerializer + serializer_class = IvinProjectSerializer def post(self, request): projectname = request.data.get("Project_Name") # print(projectname) @@ -49,7 +48,7 @@ def post(self, request): class IvinUpdate(generics.GenericAPIView): - serializer_class = ProjectSerializer + serializer_class = IvinProjectSerializer def put(self, request, pk): try: instance = InputModel.objects.get(pk=pk) @@ -61,7 +60,7 @@ def put(self, request, pk): return Response("Record updated successfully") class IvinDelete(generics.GenericAPIView): - serializer_class = ProjectSerializer + serializer_class = IvinProjectSerializer def delete(self, request, pk): try: instance = InputModel.objects.get(pk=pk) @@ -73,16 +72,16 @@ def delete(self, request, pk): class lifeeazyExcelUpload(GenericAPIView): - serializer_class = lifeSerializer + serializer_class = lifeeazySerializer def post(self, request): df = pd.read_excel(r'F:\poc-automatica\POC\poc_automation\testcases_lifeeazy.xlsx') rows = df.to_dict(orient='records') - serializer = lifeSerializer(data=rows, many=True) + serializer = lifeeazySerializer(data=rows, many=True) if serializer.is_valid(): serializer.save() - return Response("Upload successful") + return Response("Lifeeazy Upload Successfully") else: return Response(serializer.errors, status=400) @@ -90,21 +89,21 @@ def post(self, request): class lifeeazygetall(APIView): def get(self, request): - queryset = lifeeazyModel.object.all() - serializer_class = lifeSerializer(queryset, many=True)# Add the queryset attribute here + queryset = lifeeazyModel.objects.all() + serializer_class = lifeeazySerializer(queryset, many=True)# Add the queryset attribute here return Response(serializer_class.data) class lifeeazyProjectname(generics.GenericAPIView): - queryset = lifeSerializer + queryset = lifeeazyProjectSerializer def get(self, request, Project_Name): - project_name = lifeeazyModel.object.filter(Project_Name=Project_Name) - serializer = lifeSerializer(project_name,many=True) + project_name = lifeeazyModel.objects.filter(Project_Name=Project_Name) + serializer = lifeeazyProjectSerializer(project_name,many=True) return Response(serializer.data) class lifeeazygetproject(generics.GenericAPIView): - serializer_class = lifeeazySerializer + serializer_class = lifeeazyProjectSerializer def post(self, request): projectname = request.data.get("Project_Name") # print(projectname) @@ -112,3 +111,24 @@ def post(self, request): return Response('Done lifeeazy') +class lifeeazyUpdate(generics.GenericAPIView): + serializer_class = lifeeazySerializer + def put(self, request, pk): + try: + instance = lifeeazyModel.objects.get(pk=pk) + except lifeeazyModel.DoesNotExist: + return Response("Record not found", status=404) + serializer = self.get_serializer(instance, data=request.data, partial=True) + serializer.is_valid(raise_exception=True) + serializer.save() + return Response("Update the records") + +class lifeeazyDelete(generics.GenericAPIView): + serializer_class = lifeeazySerializer + def delete(self, request, pk): + try: + instance = lifeeazyModel.objects.get(pk=pk) + except lifeeazyModel.DoesNotExist: + return Response("Record not found", status=404) + instance.delete() + return Response("Record deleted successfully") diff --git a/README.md b/README.md index fd93c04..46810a4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ -

Multiple TestCases for Multiple Products

+

Multiple TestCases for Multiple Products/Projects: using Fixtures

-Python-based API testing and automation tool that allows testers and developers to efficiently organize, execute, and manage test cases for multiple projects or products. The project utilizes Django as the web framework and MongoDB as the backend database for seamless data storage. -It offers a user-friendly interface for grouping API collections by product (e.g.,Lifeeazy and IvinPro) and uploading test cases for each product.The tool automates the execution of test cases, captures the data, and stores the results in MongoDB. - +Python-based API testing and automation tool that allows testers and developers to efficiently organize, execute, and manage test cases for multiple projects or products. The project utilizes Django as the web framework and MongoDB as the backend database for seamless data storage, this tool offers a user-friendly interface that enables testers and developers to effectively group API collections by specific products, such as "Lifeeazy" and "IvinPro." Users can also uploading testcases for each product.The ability to run a single project file, allowing testers to focus on either "Lifeeazy" or "IvinPro" testing. As tests are executed, The tool automates the execution of test cases, captures the data, and stores the results in MongoDB. # Prerequisites: @@ -19,8 +17,8 @@ It offers a user-friendly interface for grouping API collections by product (e.g * Install necessary dependencies: pip install pytest - pip install playwright pip install requests + pip install pymongo # Setup your project: @@ -58,7 +56,7 @@ It offers a user-friendly interface for grouping API collections by product (e.g * Use a library like pandas to parse the Excel file and extract the relevant information. -* Accept test case data in a standardized format, including API endpoints, request payloads, and expected responses, etc. +* Accept test case data in a standardized format, including API endpoints, request payloads, and expected responses, status, status_code, version, etc. * To run the command in the Terminal: @@ -72,24 +70,71 @@ It offers a user-friendly interface for grouping API collections by product (e.g * For example, save the Lifeeazy test cases to the "lifeeazy_test_cases" collection and the IvinPro test cases to the "ivinpro_test_cases" collection. +# Define Custom Markers: + +* In the conftest.py file, define the custom markers using the pytest_configure hook. This hook is automatically called by pytest during configuration. + +* Custom markers help you categorize the test cases based on different criteria, in this case, based on the product being tested. + +* In this case, we will define markers for Lifeeazy_test and IvinPro_test. + +* For Example: + + conftest.py + + import pytest + + def pytest_configure(config): + config.addinivalue_line("markers", "IvinPro_test: Marker for test cases related to Lifeeazy product.") + config.addinivalue_line("markers", "Lifeeazy_test: Marker for test cases related to Ivin_Pro product.") + # Writing Playwright Test Cases: * Once the data is saved in MongoDB, you might perform API testing. -* Utilize Playwright to write test cases for each product's APIs separately (e.g., Lifeeazy and IVINPro). +* Utilize Playwright to write test cases for each product's(e.g., Lifeeazy and IvinPro), and write individual test functions and use the appropriate custom marker to tag each test function with the corresponding product. + +* Inside each test function, use Playwright APIs to send requests (e.g., GET, POST, PUT, DELETE) to the API endpoints and capture the responses. + +* Implement assertions to validate the responses and perform checks to ensure the API behaves as expected. - - Send a specific request to the endpoint (e.g., GET, POST, PUT, DELETE) with the necessary parameters. - - Capture and validate the response received from the API endpoint. +# Fixture Setup: -* Ensure that each Playwright test case corresponds to a specific API endpoint and captures the relevant response data. +* After writing the test cases and define a fixture in conftest.py to set up the Playwright instance. -# Test Case Execution: +* Define a fixture in conftest.py to set up the Playwright instance and the page instance to be used in each test function. + +* Fixtures are functions that provide reusable setup and teardown logic for your tests. + +* In this case, the playwright fixture sets up the Playwright instance, and the page fixture creates a new page for each test function. + +* For Example: + + import pytest + from playwright.sync_api import APIRequestContext, Playwright + from typing import Generator + + @pytest.mark.Lifeeazy_test + def test_lifeeazyget(api_lifeeazy: APIRequestContext) -> None: + if method == 'GET' and Test == 'Allergies Get': + get_todo = api_lifeeazy.get(url=str("Your-url"), headers="Your-Token") + assert get_todo.ok + + +# Test Case Execution: + +* After setting up the test cases, you can run only one product(Lifeeazy or IvinPro) following the command: + + pytest --template=html1/index.html --report=report.html -k Lifeeazy_test + OR -* Execute the Playwright test cases for both "Lifeeazy" and "Ivinpro" APIs. + pytest --template=html1/index.html --report=report.html -k IvinPro_test + +* Execute the test cases for both "Lifeeazy" and "Ivinpro" APIs. * To run this script, need to be in directory and run the following command : - pytest --template=html1/index.html --report=report.html + pytest --template=html1/index.html --report=report.html # Saving Test Results to MongoDB: