Data Transfer Between Tests

Sente facilitates data sharing between tests. To achieve this, you only need to call the following two methods.

exportParameter
importParameter   

exportParameter

Using this method, we export a variable for use in other tests

exportParameter(<key>,<value>);

importParameter

With this method, we can import a previously exported variable. If the variable does not exist, false is returned.

importParameter(<key>);

In the sample1 test, to use a runtime variable named "username" in the sample2 test, we should export it from sample1 and import it in sample2. Please examine the examples below.

tests/sample1.js
const {sente} = require('#libraries');
const { importParameter, exportParameter } = sente;

/* TEST FLOW
***************/
test = async () => {

    // export to username
    let username = await exportParameter('username','selcuksurer');

}   
tests/sample2.js
const {sente} = require('#libraries');
const { importParameter, exportParameter } = sente;

/* TEST FLOW
**************/

test = async () => {

    // import to username   
    let username = await importParameter('username');
    log(username)    

}

Last updated