簡體   English   中英

Karma-Jasmine單元測試語法

[英]Karma-Jasmine unit test syntax

同一.spec.ts文件中可以有多個describe()嗎? 我不是在這里談論嵌套describe

describe('First describe', () => {
  it();
 })
describe('Second describe', () => {
it();
});

在運行測試的任何時候這樣做有沒有風險? 我現在有4 describe.spec來測試不同的場景。 大多數時候,所有測試都通過。 但是,即使期望值正確,某些測試也會隨機失敗。 可以用多重describe引起某些問題嗎? 嵌套起來更好嗎? 這是針對angular4應用

是的,您可以在.spec.ts添加多個describe() ,因為它只是javascript函數。 但是,如果在測試中發現失敗,則需要對其進行調試。

您可以通過以下鏈接找到它: https : //jasmine.github.io/2.1/introduction.html#section-It's_Just_Functions

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM