Testing 是否可以使用JSDocs为TestCafe测试编写文档?
我们希望为我们团队的TestCafe测试框架生成一个动态文档。 我们不再使用单独的wiki/单独的文档来维护关于框架的信息,而是探索类似于JSDocs的选项 JSDoc模板如下所示:Testing 是否可以使用JSDocs为TestCafe测试编写文档?,testing,automated-tests,e2e-testing,jsdoc,testcafe,Testing,Automated Tests,E2e Testing,Jsdoc,Testcafe,我们希望为我们团队的TestCafe测试框架生成一个动态文档。 我们不再使用单独的wiki/单独的文档来维护关于框架的信息,而是探索类似于JSDocs的选项 JSDoc模板如下所示: /** * Represents a book. * @constructor * @param {string} title - The title of the book. * @param {string} author - The author of the book. */ 那么,如何使它们对
/**
* Represents a book.
* @constructor
* @param {string} title - The title of the book.
* @param {string} author - The author of the book.
*/
那么,如何使它们对记录我们的TestCafe测试更有意义呢?
谢谢,测试用例是函数调用。JsDoc不是为记录函数调用而构建的。它主要用于记录类、方法和属性声明,而不是调用 其中一种方法是将测试用例代码提取到一个单独的函数中,并对其进行文档记录。例如:
import { Selector } from 'testcafe';
fixture `My fixture`
.page `http://devexpress.github.io/testcafe/example/`;
test('Test a book', async t => {
test_a_book(t, 'title', 'author');
});
/**
* Represents a book.
* @param {string} title - The title of the book.
* @param {string} author - The author of the book.
*/
async function test_a_book(t, title, author) {
await t
.typeText('#title', title)
.typeText('#author', author)
.click('#submit-button')
.takeScreenshot({
path: 'books/book.png',
fullPage: true
});
}
您还可以将您的测试用例逻辑提取到一个文档库中,在这个文档库中您可以记录所有内容
此外,您可以将函数调用定义为@property或创建自定义@tag,但是JsDoc不会为这些解决方法生成好看的文档。测试用例是函数调用。JsDoc不是为记录函数调用而构建的。它主要用于记录类、方法和属性声明,而不是调用 其中一种方法是将测试用例代码提取到一个单独的函数中,并对其进行文档记录。例如:
import { Selector } from 'testcafe';
fixture `My fixture`
.page `http://devexpress.github.io/testcafe/example/`;
test('Test a book', async t => {
test_a_book(t, 'title', 'author');
});
/**
* Represents a book.
* @param {string} title - The title of the book.
* @param {string} author - The author of the book.
*/
async function test_a_book(t, title, author) {
await t
.typeText('#title', title)
.typeText('#author', author)
.click('#submit-button')
.takeScreenshot({
path: 'books/book.png',
fullPage: true
});
}
您还可以将您的测试用例逻辑提取到一个文档库中,在这个文档库中您可以记录所有内容
此外,您可以将函数调用定义为@property或创建自定义@tag,但JsDoc并没有为这些解决方法生成好看的文档。如何实现什么?一旦你创建了一个页面模型,你就可以像处理其他JS代码一样使用常规的JsDoc功能来记录它的成员?一旦创建了页面模型,就可以像使用常规JsDoc功能处理任何其他JS代码一样记录其成员。