简体   繁体   中英

How to integrate Jmeter with mocha unit testing?

I've written a simple uint test by Mocha Library.

describe("simple test", async() =>{

     it("first test" , async()=>{

        assert.equal( 1 , 1);
     })
})

Now I need to perform it by JMeter. But I did not find any source for this.

Is it possible to perform the Mocha testing by JMeter or not?

If yes, how?

As per JMeter project main page :

The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Although JMeter supports JavaScript code execution viaJSR223 Test Elements

在此处输入图像描述

You won't be able to run a Mocha-based tests because Nashorn engine is not something compatible with NodeJS and you won't be able to use load() function as Mocha heavily relies on NodeJS

So the only way to run a Mocha test with JMeter is calling mocha binary from your node_modules folder using OS Process Sampler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM