You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by yufeng <yu...@qq.com> on 2019/10/20 10:30:33 UTC

Run unit test cases in node environment

Now the jasimine framework which echarts is using for unit testing runs on the web page? Can we improve it to run test cases in node environment? I recommend using karma, the unit testing tool, and choosing the jasmine framework in the configuration.


The benefits of doing so are:
1. Jasmine framework supports running test cases in node environment, and the test results will be directly displayed in the terminal;
2. Karma is a JavaScript test execution process management tool based on node.js, which can be used to test all mainstream web browsers, and can also be integrated into CI tools.
3. Karma can make the test run in multiple browsers at the same time, such as chrome and Firefox. Some codes run in different browsers with different effects. The test results with karma are closer to the real environment.
4. Karma supports multiple plug-ins, such as code coverage, test reports, etc.
5. Currently, the framework used in UT is jasmine, so there is no need to modify the test cases.


Of course, there are also some problems. For example, some errors about 'window' will be throwed when I try to modify it.


I hope you give some suggestions.

Re: Run unit test cases in node environment

Posted by Yi Shen <sh...@gmail.com>.
Hi Yu Feng,

Thanks for the very detailed suggestion,

Have you compared between Karma and Jest?

On Mon, Oct 21, 2019 at 11:14 AM Ovilia <ov...@gmail.com> wrote:

> Sounds perfect to me.
> So what's the next plan you wish to do?
>
> Wenli
>
>
> On Sun, Oct 20, 2019 at 8:54 PM yufeng <yu...@qq.com> wrote:
>
> > Hi Wenli,
> >
> >
> > Karma is a test runner, Jasmine will be still the testing framework in
> > karma's configuration file.
> >
> >
> >
> >
> > ------------------ 原始邮件 ------------------
> > 发件人: "oviliazhang"<ov...@gmail.com>;
> > 发送时间: 2019年10月20日(星期天) 晚上8:29
> > 收件人: "dev"<de...@qq.com>;
> >
> > 主题: Re: Run unit test cases in node environment
> >
> >
> >
> > Hi Feng,
> >
> > Thanks for bringing this up. It is helpful to enable the unit tests to
> run
> > in the node environment so that we can do the auto test in CI.
> >
> > What's the benefit of using Karma over Jasmine if Jasmine can also
> provide
> > node testing?
> >
> > Wenli
> >
> >
> > On Sun, Oct 20, 2019 at 6:30 PM yufeng <yu...@qq.com> wrote:
> >
> > > Now the jasimine framework which echarts is using for unit testing runs
> > on
> > > the web page? Can we improve it to run test cases in node environment?
> I
> > > recommend using karma, the unit testing tool, and choosing the jasmine
> > > framework in the configuration.
> > >
> > >
> > > The benefits of doing so are:
> > > 1. Jasmine framework supports running test cases in node environment,
> and
> > > the test results will be directly displayed in the terminal;
> > > 2. Karma is a JavaScript test execution process management tool based
> on
> > > node.js, which can be used to test all mainstream web browsers, and can
> > > also be integrated into CI tools.
> > > 3. Karma can make the test run in multiple browsers at the same time,
> > such
> > > as chrome and Firefox. Some codes run in different browsers with
> > different
> > > effects. The test results with karma are closer to the real
> environment.
> > > 4. Karma supports multiple plug-ins, such as code coverage, test
> reports,
> > > etc.
> > > 5. Currently, the framework used in UT is jasmine, so there is no need
> to
> > > modify the test cases.
> > >
> > >
> > > Of course, there are also some problems. For example, some errors about
> > > 'window' will be throwed when I try to modify it.
> > >
> > >
> > > I hope you give some suggestions.
>


-- 
Yi Shen
Apache ECharts(incubating) PPMC

Re: Run unit test cases in node environment

Posted by Ovilia <ov...@gmail.com>.
Sounds perfect to me.
So what's the next plan you wish to do?

Wenli


On Sun, Oct 20, 2019 at 8:54 PM yufeng <yu...@qq.com> wrote:

> Hi Wenli,
>
>
> Karma is a test runner, Jasmine will be still the testing framework in
> karma's configuration file.
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "oviliazhang"<ov...@gmail.com>;
> 发送时间: 2019年10月20日(星期天) 晚上8:29
> 收件人: "dev"<de...@qq.com>;
>
> 主题: Re: Run unit test cases in node environment
>
>
>
> Hi Feng,
>
> Thanks for bringing this up. It is helpful to enable the unit tests to run
> in the node environment so that we can do the auto test in CI.
>
> What's the benefit of using Karma over Jasmine if Jasmine can also provide
> node testing?
>
> Wenli
>
>
> On Sun, Oct 20, 2019 at 6:30 PM yufeng <yu...@qq.com> wrote:
>
> > Now the jasimine framework which echarts is using for unit testing runs
> on
> > the web page? Can we improve it to run test cases in node environment? I
> > recommend using karma, the unit testing tool, and choosing the jasmine
> > framework in the configuration.
> >
> >
> > The benefits of doing so are:
> > 1. Jasmine framework supports running test cases in node environment, and
> > the test results will be directly displayed in the terminal;
> > 2. Karma is a JavaScript test execution process management tool based on
> > node.js, which can be used to test all mainstream web browsers, and can
> > also be integrated into CI tools.
> > 3. Karma can make the test run in multiple browsers at the same time,
> such
> > as chrome and Firefox. Some codes run in different browsers with
> different
> > effects. The test results with karma are closer to the real environment.
> > 4. Karma supports multiple plug-ins, such as code coverage, test reports,
> > etc.
> > 5. Currently, the framework used in UT is jasmine, so there is no need to
> > modify the test cases.
> >
> >
> > Of course, there are also some problems. For example, some errors about
> > 'window' will be throwed when I try to modify it.
> >
> >
> > I hope you give some suggestions.

回复: Run unit test cases in node environment

Posted by yufeng <yu...@qq.com>.
Hi Wenli,


Karma is a test runner, Jasmine will be still the testing framework in karma's configuration file.




------------------ 原始邮件 ------------------
发件人: "oviliazhang"<ov...@gmail.com>;
发送时间: 2019年10月20日(星期天) 晚上8:29
收件人: "dev"<de...@qq.com>;

主题: Re: Run unit test cases in node environment



Hi Feng,

Thanks for bringing this up. It is helpful to enable the unit tests to run
in the node environment so that we can do the auto test in CI.

What's the benefit of using Karma over Jasmine if Jasmine can also provide
node testing?

Wenli


On Sun, Oct 20, 2019 at 6:30 PM yufeng <yu...@qq.com> wrote:

> Now the jasimine framework which echarts is using for unit testing runs on
> the web page? Can we improve it to run test cases in node environment? I
> recommend using karma, the unit testing tool, and choosing the jasmine
> framework in the configuration.
>
>
> The benefits of doing so are:
> 1. Jasmine framework supports running test cases in node environment, and
> the test results will be directly displayed in the terminal;
> 2. Karma is a JavaScript test execution process management tool based on
> node.js, which can be used to test all mainstream web browsers, and can
> also be integrated into CI tools.
> 3. Karma can make the test run in multiple browsers at the same time, such
> as chrome and Firefox. Some codes run in different browsers with different
> effects. The test results with karma are closer to the real environment.
> 4. Karma supports multiple plug-ins, such as code coverage, test reports,
> etc.
> 5. Currently, the framework used in UT is jasmine, so there is no need to
> modify the test cases.
>
>
> Of course, there are also some problems. For example, some errors about
> 'window' will be throwed when I try to modify it.
>
>
> I hope you give some suggestions.

Re: Run unit test cases in node environment

Posted by Ovilia <ov...@gmail.com>.
Hi Feng,

Thanks for bringing this up. It is helpful to enable the unit tests to run
in the node environment so that we can do the auto test in CI.

What's the benefit of using Karma over Jasmine if Jasmine can also provide
node testing?

Wenli


On Sun, Oct 20, 2019 at 6:30 PM yufeng <yu...@qq.com> wrote:

> Now the jasimine framework which echarts is using for unit testing runs on
> the web page? Can we improve it to run test cases in node environment? I
> recommend using karma, the unit testing tool, and choosing the jasmine
> framework in the configuration.
>
>
> The benefits of doing so are:
> 1. Jasmine framework supports running test cases in node environment, and
> the test results will be directly displayed in the terminal;
> 2. Karma is a JavaScript test execution process management tool based on
> node.js, which can be used to test all mainstream web browsers, and can
> also be integrated into CI tools.
> 3. Karma can make the test run in multiple browsers at the same time, such
> as chrome and Firefox. Some codes run in different browsers with different
> effects. The test results with karma are closer to the real environment.
> 4. Karma supports multiple plug-ins, such as code coverage, test reports,
> etc.
> 5. Currently, the framework used in UT is jasmine, so there is no need to
> modify the test cases.
>
>
> Of course, there are also some problems. For example, some errors about
> 'window' will be throwed when I try to modify it.
>
>
> I hope you give some suggestions.