I am trying to configure browser-perf for measuring browser performance metrics. I am able to run it via commandline using
browser-perf --selenium=http://localhost:4444/wd/hub http://yourwebsite.com
However, I want to configure the Node Module API for browser-perf.
Following is the issue:
1. I am not able to find a command to execute the node API browser-perf tests.
2. Also, where do I place the call to browserPerf() - In conf OR in spec ??
If someone can provide steps for the Node API setup, that would be really helpful!
PS: I found protractor-perf conf.js command is used to protractor-perf tests. Just not able to find something similar for browser-perf!
The below link gives all the necessary steps to setup and execute browser-perf tests
https://gist.github.com/axemclion/9594795
Related
I have built an API in Node.js which communicates with a MongoDB as database. I am also using Vitest as my testing library.
I have two databases: prod and test. I want to restrict the access to the test database to only during the testing calls made due to test files ran by Vitest. Is there any way to do the same?
Proposed Solution (Maybe?)
Configure Vitest to setup an ENV flag or a NODE_ENVIRONMENT flag to TESTING whenever npm run test is called, and revert that back to DEVELOPMENT after the command is complete.
Add check while connecting to the database that if the environment is TESTING, only then connect to the test database, otherwise connect to the usual database.
The problem I am facing in this approach is configuring step 1. Any guides on the same? (Or other possible solutions to the problem?)
I want to use Swagger/OpenAPI to standardize documentation efforts. Most of the API's are built with NodeJS and I do integration testing with Mocha & Chai which helps tremendously with quickly making sure the API isn't broken after making changes. From what I understand, using Swagger won't replace my integration test but will make it easy for developers to know how to consume my API. If I can tie my documentation efforts into my test suite, it would make on-going documentation maintenance easier. When i add or modify test, I could update API documents in the same place.
What I was thinking about doing is using YUIDoc or JSDoc which generates API documentation from comments in source. But neither conform to OpenAPI spec. Then I found Swagger-JSdoc and figured I could just put all the comments in my test suite code since I'm already there specifying what to test in the endpoints.
Is there another way/workflow that might be more efficient for new or existing projects? How can I bring my documentation efforts closer to my test suite to improve on-going documentation maintenance?
I just published an npm module for the same. Not sure if you found an alternative, if not please feel free to give it a try.
https://github.com/LmntrX/mocha-swagger/
Install mocha-swagger globally with
npm install -g mocha-swagger
Then execute the following command:
mocha-swagger path/to/project/tests
This command will recursively parse test files in your test directory and generate a basic swagger.json file in current directory.
NB: Please note that the swagger spec generated will only contain your routes, methods and path parameters.
I need to put some tests around a nodejs command line utilities\modules. No browser involved and I'm using a lot of the "fs" module to work the file system, so i'm not sure a browser based test mechanism would work (sandboxing).
any modules that would help here?
Check out Vorpal.js. This lets you create an interactive CLI in node, in which you can then run custom commands to test the various things you want to test.
Disclaimer: I am its author.
Is is possible to run Protractor in any other way except using CLI?
Is there an API call which will simulate the command: 'protractor config file.js'?
I would like to start a test through a node-webkit application, and even though I can connect directly to the ChromeDriver through the directConnect parameter, this is no use if I can't run protractor from inside the script.
Of course, this is in an environment where Node and Protractor aren't available from CLI... simulating a distribution environment where the user doesn't have to install additional apps apart from my node-webkit (hence the node-webkit usage).
Thank you in advance for any pointers!
The protractor command line script boils down to invoking lib/cli.js which mostly deals with parsing commmand-line arguments and then invokes lib/launcher.js to actually start protractor.
I don't think any special concessions have been made in these files to be directly invoked programmatically, but I don't see any particular hurdles either.
How might I setup Jenkins to start my Node.JS Testing Server, run Unit Test probably JSTestDriver/Jasmine, and then top Node.JS?
I can start Node.JS using Execute Shell, but it "hangs" the build (expected since Node runs as a daemon)
I've written an article that explains how I've managed to run my unit tests with Mocha and ant.
The basic idea is:
Set your environment variables so that jenkins can control them
Use mocha's xunit reporter to generate a result report
Use Jenkins' Publish JUnit test result report option to read the result report.
You can read the full article here.
JSTestDriver outputs it's results in a xUnit compliant xml format. Which the Hudson 'xUnit' plugin can then interpret.
We are planning to integrate jsTestDriver into Jenkins. To test our javaScript code in a selection of supported browsers.
there is a plugin to execute nodejs with possibility to choice the nodejs version
https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin