The application I am working on requires me to call multiple test suites in the current testcase. I know that we can add the resuable command in suport/commands.js
but that is not I am looking for.
testsuiteA.js
describe(This should be called in another, function({
.....
})
it(TestCase1,function(){....})
it(TestCase2,function(){....})
I want to call the entire testSuiteA
in a new testsuiteB or sometimes want to call only specific test cases of that suite. I tried some ways but I am stuck now.
2
Answers
Since the
describe()
andit()
blocks are JavaScript functions, you can create a function that calls them and export that function.Running one spec inside another is possible with
import
orrequire
,see the general idea at How to run all tests in one go
Using
require()
is preferable if you want to structuretestSuiteB
:Doing it this way means you get a well formatted report, and you can still run
testSuiteA
independently (no function wrapper is required).