In my use case I am setting up a single go test which runs all _test.go in all packages in the project folder. I tried to achieve this using $go test ./... from the src folder of the project
/project-name
/src
/mypack
/dao
/util
When I try to run the test it is asking to install the packages which are used in the imported packages. For example if I import "github.com/go-sql-driver/mysql", it might have used another package github.com/golang/protobuf/proto. I did not manually import the proto package. The application runs without manually importing the inner package. But when I run the tests it fails. But individual package test succeeded. Do I have to install all the packages in the $go test ./... error manually?
Could anyone help me on this?
You need to run go get -t ./... first to get all test deps.
From the go test -h:
The -t flag instructs get to also download the packages required to
build the tests for the specified packages.
Related
I'm trying to do a bunch of unit tests with Cypress. Here's the npm script that runs them:
cypress run --project tests/unit/ --headless
When I run them, it generates the typical plugin/support/videos folders, but I don't need them. Is there any flag that disables the generation of these 3 folders when running the tests?
Thanks!
Just add these generated reports to a .gitignore file in the project's root like so:
# Cypress generated files #
######################
cypress.env.json
cypress.meta.json
cypress/logs/
cypress/videos/*
cypress/screenshots/*
cypress/integration/_generated/*
cypress/data/migration/generated/*.csv
cypress/fixtures/example.json
cypress/build/*
Now, these files will never be version-controlled.
You can also disable video recording with proper configuration in your cypress.json file like so: "video": false.
You can also do it with CLI by overriding your cypress.json.
Currently, there's no way to disable the generation of those files. However, you could remove them by when launching Cypress with an npm script like so:
"clean:launch:test": "rm -rf /cypress/movies && rm -rf /cypress/screenshots && cypress run --project tests/unit/ --headless"
Then you can run it like so: npm run clean:launch:test. It should remove those folders & launch Cypress's unit tests.
I suggest just adding them to .gitignore or configuring Cypress to trash them before each run. You can read about it here.
cypress.json file:
trashAssetsBeforeRuns: true
To disable the creation of video and screenshots folder you can do like in the following command.
cypress run --config video=false,screenshotOnRunFailure=false
To remove plugin/support folders I think they are not generated with current Cypress version so you can just remove them and add to .gitignore.
Video recording can be turned off entirely by setting video to false from within your configuration.
"video": false
https://docs.cypress.io/guides/guides/screenshots-and-videos#Videos
I am new to Jenkins, specially with using python script in Jenkins. The problem I am facing is as follow:
I am trying to run a python script from a python file in the post-build step of the Jenkins. I have added all the plugins required for that purpose to my understanding. i.e I have included Post-BuildScript plugin, python jenkins plugin etc.
Now when I build console output shows invalid script command caused the failure. I have attached the results below. can anybody help me with that please?
In post build step I am providing the full or absolute path to the python script file i.e
ExecutepythonScriptpath
Results
It may be useful to mention here I have also tried using just the path without writing python preceding the path, also tried with forward as well as backward slash in the path. without any success.
I have managed to resolve that issue. There are two parts of solution:
First one is if you want to run simple python script in post-build -->Add a post build step for Execute python Script (That will require you install plugin for post build ) . In that window created after adding post build step you can simply put any python command to run.
Second part of the solution is for, when user would like to run a list of commands from a python script file from the same post build step window in that case user has to make sure to put all the required python files which you want to execute into the Jenkins workspace->project directory(project for which we are running the Jenkins ) .
Moreover, for Python2.7 in order to execute that python script file user simply need to write script as
execfile(file.py)
One more thing to remember is insert python.exe path in the environment variables.
I'm trying to figure out how to get code coverage working with #angular/cli but so far i'm not having much luck.
I started a new project using angular CLI. Basically all i did was ng new test-coverage and once everything was installed in my new project folder, I did a ng test --code-coverage. The tests were run successfully but nothing resembling code coverage was displayed in the browser.
Am I missing some dependencies or something else? Any help will be appreciated.
EDIT:
R. Richards and Rachid Oussanaa were right, the file does get generated and I can access it by opening the index.html.
Now i'm wondering, is there a way I could integrate that into a node command so that the file opens right after the tests are run?
here's what you can do:
install opn-cli which is a cli for the popular opn package which is a cross-platform tool used to open files in their default apps.
npm install -D opn-cli -D to install as dev dependency.
in package.json add a script under scripts as follows
"scripts": {
...
"test-coverage": "ng test --code-coverage --single-run && opn ./coverage/index.html"
}
now run npm run test-coverage
this will run the script we defined. here is an explanation of that script:
ng test --code-coverage --single-run will run tests, with coverage, only ONCE, hence --single-run
&& basically executes the second command if the first succeeds
opn ./coverage/index.html will open the file regardless of platform.
We recently started to migrate from a very old monolithic ant build to gradle. During the setup I realized that the gradle wrapper task only provides a gradlew script for the root project but not for the sub-modules.
Is there a way to also provide "copyies" of this script to the modules that point to the root project gradle directory for the jar?
I use a custom bash script to be able to run gradlew from subdirectories. It looks in the parent directories for a gradlew script and calls it. Using this, you don't need to copy the gradlew script into the subproject directories. Just put the script on your path. The script is available at github: https://gist.github.com/breskeby/5913145
There's no need to provide such copies. Single copy of gradle wrapper is enough and should be placed on the top of project's structure.
If You need to run tasks that are located in subprojects You need to provide a path to such task. E.g.
gradlew :view:module1:jar
Hi All I have gone through many related question to this problem but I am still unable to get the solution. I have installed Zend Server. Now I want to install PHPunit. I have installed pear and then installed PHPUnit.
My Zend Server is installed at
C:\xyz\zend\ZendServer
My pear is installed at
C:\xyz\zend\ZendServer\bin\PEAR
And PHPunit is installed at
C:\xyz\zend\ZendServer\bin\PEAR\pear\PHPUnit
I have added pear path and even PHPUnit path to Envrionmental PATH variable. Then I opened php.ini located at
C:\xyz\zend\ZendServer\etc
and set include_path as
include_path = ".;c:\php\includes;c:\xyz\zend\ZendServer\bin\PEAR\pear;c:\xyz\zend\ZendServer\bin\PEAR\pear\PHPUnit"
Now When I run command at cmd to create zend project, the project is created but I found this note too
Testing Note: PHPUnit was not found in your include_path, therefore no testing action will be created.
Some one please tell me what Am I doing wrong and where to set this include path???
Best Regards :-)
Let's do some old school debugging :)
$ zf create project ./one
Creating project at /path/to/one
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
No PHPUnit!
Locate path/zend-framework/bin/zf.php and add near the top:
var_dump(get_include_path());
Now let's see what the include path looks like:
$ zf create project ./two
string(32) ".:/usr/share/php"
Creating project at /path/to/two
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created
My PHPUnit isn't in the /usr/share/php directory. Let's resolve that by adding PHPUnit to the include path.
e.g. If PHPUnit is in /path/to/phpunit, open the php.ini file and add it to the include path.
Third times a charm:
$ zf create project ./three
string(56) ".:/usr/share/php:/path/to/phpunit"
Creating project at /path/to/three
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
If you've edited the correct php.ini, the var_dump() you added to zf.php will now echo the include path with whatever you modified it to, which in my case it was correct, so now PHPUnit is working.
Now remove the debug code from zf.php