用於測試多個產品/服務的獨立框架還是每個產品/服務的單獨框架?


-2

我想知道使用一個獨立的框架來測試一系列不同的站點,應用程序或服務有哪些優缺點?

讓我們說這些站點中的一些站點組合在一起構成了一個端到端的旅程,並且還涉及到API端點。

對我來說,擁有一個單獨的框架來容納不同站點的API和驗收測試就意味著我們有了一個統一的框架,在這裡我們只需要解決和維護一致的設計模式(PageObject,輔助函數(例如,日期轉換))一次,只有一次。

但是,大多數現代框架傾向於將API和驗收測試置於應用程序內部。例如,通常在Angular應用中使用Karma定義單元測試,並在Protractor中定義端到端測試。這意味著對於每種產品,您都被迫使用特定於該技術解決方案的一組特定工具或範例,並且必須從頭開始編寫東西。

在我看來,使用可以運行API測試和驗收測試並識別不同項目的多合一框架會更好。這可以在許多框架中完成(例如,我一直在研究Cypress.io,CodeceptJS和Webdriver.io)。

擁有一個統一的單一存儲庫和框架來容納所有測試有什麼弊端?

1

Just to reiterate, a Framework is not just a set of tools or languages.

https://smartbear.com/learn/automated-testing/test-automation-frameworks/

A framework is comprised of a combination of practices and tools that are designed to help QA professionals test more efficiently.

These guidelines could include coding standards, test-data handling methods, object repositories, processes for storing test results, or information on how to access external resources.

While these are not mandatory rules and testers can still script or record tests without following them, using an organized framework typically provides additional benefits that would otherwise be missed out on.

So, Cypress.io, CodeceptJS and Webdriver.io for instance are just tools.You can create a all in one framework using any language, you can use requests module in python ,HttpURLConnection or restassured in java etc for API testing. Similar modules wil be available for database testing, performance testing etc. You can develop your on modules also if you like.

But, the already available tools are developed and designed to overcome the challenges in handling issues in SUT. For instance , protractor natively handles asynchronous nature of angularpages and there by makes test execution pretty fast.

If you try to reinvent the wheel, it might end up in following issues:

  1. Cost overhead
  2. More turnover time
  3. Lesser efficiency
  4. More learning curve
  5. Increased complexity
  6. More development time
  7. More human resource requirments

From my experience, the best implementation time and flexibilty for API testing was provided by Robotframework as python natively handles json unlike in java. For UI , protractor-jasmine gave faster turn-around time as it didn't require complex frameworks like testng or maven etc.Protractor-jasmine also allows to play around with low level programing than making the entire thing complex using feature files like in cucumber or keyword tests in robotframework.

Summary:

Like tests are context depended , tools are too. Choose the best solution and not the common solution. Just like we have javascript , angular etc for front end, and , python,java ,.net etc for backend development.