基于模型的嵌入式开发流程_如何使用基于模型的测试来改善工作流程
基于模型的嵌入式開發(fā)流程
Unit testing is not enough – so let's start using model-based testing to improve our workflows.
單元測試還不夠–因此,讓我們開始使用基于模型的測試來改善我們的工作流程。
Software testing is an important phase in building a scalable software system that usually has critical functions, business flows/logic, and connected external entities. This distributed nature of software systems induces a certain level of complexity when writing tests for each unit, function, or flow.
軟件測試是構(gòu)建可伸縮軟件系統(tǒng)的重要階段,該系統(tǒng)通常具有關(guān)鍵功能,業(yè)務(wù)流程/邏輯以及連接的外部實體。 在為每個單元,功能或流程編寫測試時,軟件系統(tǒng)的這種分布式性質(zhì)會引起一定程度的復(fù)雜性。
There are various types of testing approaches you can use. The best approach you can employ seamlessly is model-based testing. In simple terms, this means creating a model of your system (more like a digital twin that describes every aspect of the system) and generating a test against the model.
您可以使用多種測試方法。 您可以無縫采用的最佳方法是基于模型的測試。 簡單來說,這意味著創(chuàng)建系統(tǒng)模型(更像是描述系統(tǒng)各個方面的數(shù)字孿生模型)并針對該模型生成測試。
什么是基于模型的測試? (What Is Model-Based Testing?)
First, we need to know that a model is basically the description and representation of how we expect the system to work. The system’s processes can be defined based on the series of input sequences, actions, functions, output, and flow of data starting from input to the output received.
首先,我們需要知道模型基本上是我們期望系統(tǒng)工作方式的描述和表示。 可以基于一系列輸入序列,操作,功能,輸出以及從輸入到接收到的輸出的數(shù)據(jù)流來定義系統(tǒng)的過程。
We must be able to determine all these behaviors while testing, and a model helps us do just that seamlessly. With that, we can then generate tests automatically based on the system models.
我們必須能夠在測試時確定所有這些行為,并且模型可以幫助我們無縫地做到這一點。 這樣,我們便可以基于系統(tǒng)模型自動生成測試。
Basically, model-based testing is a software testing technique in which the test cases are generated from a model that describes the functional aspects of the system under test. This is a new software testing method that employs a secondary, lightweight, time-efficient implementation of a software build which is called a model.
基本上,基于模型的測試是一種軟件測試技術(shù),其中從描述了被測系統(tǒng)功能方面的模型生成測試用例。 這是一種新的軟件測試方法,該方法采用稱為模型的軟件構(gòu)建的次要,輕量級,省時的實現(xiàn)。
We take this model coupled with the system requirements and generate efficient test cases. This software testing method is applicable to both hardware and software testing.
我們將此模型與系統(tǒng)需求結(jié)合起來,并生成有效的測試用例。 此軟件測試方法適用于硬件和軟件測試。
為什么以及如何改善工作流程 (Why and How It Improves Workflow)
Automating tests is unavoidable as it enables faster and more efficient software testing. You can streamline your workflow and use the latest development methodologies to improve it.
自動化測試是不可避免的,因為它可以實現(xiàn)更快,更有效的軟件測試。 您可以簡化工作流程并使用最新的開發(fā)方法進(jìn)行改進(jìn)。
Most software developers and teams find it challenging to create and update test cases in an environment of constantly changing dependencies and requirements.
大多數(shù)軟件開發(fā)人員和團(tuán)隊都發(fā)現(xiàn),在依賴和要求不斷變化的環(huán)境中創(chuàng)建和更新測試用例具有挑戰(zhàn)性。
From employing the simplest functional tests to heavyweight methods like E2E and so many others, there have been numerous testing methods designed for improving testing reliability and effectiveness.
從使用最簡單的功能測試,以重量級的方法,如E2E和許多其他人 ,已經(jīng)有不少測試方法專為提高測試的可靠性和有效性。
There’s absolutely nothing wrong with these methods. However, these test cases have to be written manually for each scenario. Whenever there’s a change in the system requirements, you have to update each test case affected by the change.
這些方法絕對沒有錯。 但是,必須針對每種情況手動編寫這些測試用例。 只要系統(tǒng)要求發(fā)生變化,就必須更新受更改影響的每個測試用例。
Below, you’ll find a graphical exemplification of the model-based testing process:
在下面,您將找到基于模型的測試過程的圖形示例:
These models are used to generate automated test cases using MBT tools as they describe the expected behaviour of the system being tested.
這些模型用于使用MBT工具生成自動化測試用例,因為它們描述了被測系統(tǒng)的預(yù)期行為。
We basically have two steps here:
我們基本上有兩個步驟:
When working with model-based testing, the model creation phase should be part of the software development life cycle and integrated as part of product design from the phase of requirements specification.
在進(jìn)行基于模型的測試時,模型創(chuàng)建階段應(yīng)成為軟件開發(fā)生命周期的一部分,并應(yīng)從需求規(guī)范階段集成為產(chǎn)品設(shè)計的一部分。
This allows the software development team to focus their attention on building a testable product and models that enhance user experience.Model-based testing can improve our workflow by:
這使軟件開發(fā)團(tuán)隊可以將精力集中在構(gòu)建可測試的產(chǎn)品和可增強(qiáng)用戶體驗的模型上。基于模型的測試可以通過以下方式改善我們的工作流程:
如何實施基于模型的測試 (How to Implement Model-Based Testing)
Implementing model-based testing can’t be introduced suddenly to a system, as it has to be done gradually. It will be too much to introduce it to the entire system’s processes and operations.
基于模型的測試的實現(xiàn)不能突然引入系統(tǒng),因為它必須逐步完成。 將其引入整個系統(tǒng)的流程和操作將是太多了。
It’s best fitted for the initial stage of the product, as things are still very minute. It's easy to integrate with the system requirements then, because as things get bigger you get to update just the model.
因為事情仍然很微小,所以它最適合產(chǎn)品的初始階段。 這樣就很容易與系統(tǒng)需求集成,因為隨著事情的發(fā)展,您只需要更新模型即可。
To implement model-based testing you have to start with creating the models. Models can can cover any level of requirements, from business logic to user story, and can be connected to each other.
要實施基于模型的測試,您必須先創(chuàng)建模型。 模型可以涵蓋從業(yè)務(wù)邏輯到用戶故事的任何級別的需求,并且可以彼此連接。
Then you can automatically generate test cases based on the models once they are done creating it. And of course, if you make any changes to the models, the tests will be updated automatically.
然后,一旦完成創(chuàng)建模型,您便可以基于模型自動生成測試用例。 當(dāng)然,如果您對模型進(jìn)行了任何更改,測試將自動更新。
You can easily integrate these tests into your CI processes and tools once you’re able to generate automated tests from models.
一旦能夠從模型生成自動化測試,就可以輕松地將這些測試集成到CI流程和工具中。
基于模型的測試的優(yōu)勢
(Advantages of Model-Based Testing)
基于模型的測試的缺點
(Disadvantages of Model-Based Testing)
與UI測試有何不同 (How it's Different from UI Testing)
Basically we know what model-based testing is now, and we already figured out the benefits of using it over using the traditional testing method.
基本上,我們知道現(xiàn)在基于模型的測試是什么,并且我們已經(jīng)弄清楚了使用它比使用傳統(tǒng)測試方法的好處。
UI (User Interface/Frontend Testing) is a type of software testing that simply involves the process of testing the function of the user interface, making sure the interface of the system is reacting as it’s supposed to.
UI(用戶界面/前端測試)是一種軟件測試 ,僅涉及測試用戶界面功能的過程,以確保系統(tǒng)界面能夠按預(yù)期進(jìn)行響應(yīng)。
This process involves manual testing, and each test scenario has to be written by hand. Any changes made to the UI will break the whole test case unless it's updated along with the changes. It employs the use of WebDrivers and most times Selenium in order to fully simulate the way users interact with the interface and validate the expected output.
此過程涉及手動測試,并且每個測試方案都必須手動編寫。 對UI所做的任何更改都會破壞整個測試用例,除非它與更改一起更新。 它充分利用了WebDrivers和大多數(shù)Selenium的用法,以完全模擬用戶與界面的交互方式并驗證預(yù)期的輸出。
UI testing can be employed in any stage of the product as it clearly doesn’t have much requirement and the learning curve is very easy compared to MBT.
UI測試可以用于產(chǎn)品的任何階段,因為它顯然不需要太多,并且與MBT相比,學(xué)習(xí)曲線非常容易。
The cost of testing is quite low and could be ground down to zero. The time spent can also be little. Maintenance can be very high depending on the complexity of the product interface.
測試成本非常低,可以降低到零。 花費的時間也可以很少。 維護(hù)可能非常高,具體取決于產(chǎn)品界面的復(fù)雜性。
It doesn’t require a very skillful developer or software. Any developer with basic testing knowledge can pick this up. There are so many differences when you look into this more, however, both are good for different use cases.
它不需要非常熟練的開發(fā)人員或軟件。 任何具有基本測試知識的開發(fā)人員都可以掌握。 當(dāng)您對此進(jìn)行更多研究時,有很多差異,但是,兩者都適用于不同的用例。
結(jié)論 (Conclusion)
Model-based testing is a powerful, cost-efficient, and profitable technique for large businesses in the long run.
從長遠(yuǎn)來看,基于模型的測試對于大型企業(yè)而言是一種強(qiáng)大,經(jīng)濟(jì)高效且有利可圖的技術(shù)。
However, introducing this approach to large company processes can be a big challenge, especially when it involves overhauling their entire approach to software development and testing.
但是,將這種方法引入大型公司的流程可能是一個巨大的挑戰(zhàn),尤其是當(dāng)涉及對軟件開發(fā)和測試的整個方法進(jìn)行全面檢查時。
Model-based testing has to become a part of the development workflow, but this comes with its own challenges, including changes to the entire infrastructure. It also makes an already steep learning curve even more challenging.
基于模型的測試必須成為開發(fā)工作流程的一部分,但這帶來了自身的挑戰(zhàn),包括更改整個基礎(chǔ)架構(gòu)。 這也使本已陡峭的學(xué)習(xí)曲線更具挑戰(zhàn)性。
Luckily, there are some things that can help identify when model-based testing can really be useful. For example, if you have an infinite set of systems with requirements you can cover in different ways. Or if you have a distributed or reactive system, that can also be a reason to consider this approach.
幸運的是,有些事情可以幫助您確定何時基于模型的測試真正有用。 例如,如果您有無限多個具有要求的系統(tǒng),則可以用不同的方式進(jìn)行介紹。 或者,如果您有分布式或React性系統(tǒng),那也可能是考慮使用此方法的原因。
Model-based testing can go a long way in testing and save significant time and effort when implemented properly.
基于模型的測試可以在測試中走很長一段路,如果正確實施,可以節(jié)省大量時間和精力。
翻譯自: https://www.freecodecamp.org/news/improve-your-workflow-using-model-based-testing/
基于模型的嵌入式開發(fā)流程
總結(jié)
以上是生活随笔為你收集整理的基于模型的嵌入式开发流程_如何使用基于模型的测试来改善工作流程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到哄小孩睡觉是什么意思
- 下一篇: 为啥会梦到和女朋友分手