Gogland Test Configuration always executed with ./ - testing

No matter how I set my build configuration for running my tests the go test tool is always run with ./...
E.G.
runs:
go test -v -cover ./... -run ./svs

Depending on what you need to run you can select different configuration types.
For the one in your picture, Run Kind Directory is selected and that means the IDE will run the tests in the directory you point it at and since the working directory is in the same directory, it will run ./... as that's what it means.
For the Run Kind Package, it will run only the specified package and no other packages, so no /... appended to it.
For the Run Kind File it will run the tests in a single file.
The pattern that you've added, ./svc tells the go tool how to match test names. There you should put valid patterns for test names. If you want to control for which directory / package the tests are run you can use a different run configuration per directory / package since multiple configurations are possible.
Based on your reply you want to run the tests in your whole projects, recursive, without the vendor folder. To do so, create a Run Kind Directory, as you have one already, and make sure sure you are using Go 1.9 as it will automatically ignore the vendor directory when using ./... matching.
Please let me know if you need further details.

Related

How can I run all test files that are in different folders using mocha?

I want to run my mocha test using npm test the problem is that the tests may vary their location.
The locations may be lib/modules/somefolder/test/*-test.js or lib/modules/somefolder/anotherfolder/test/*-test.js
Currently my test script is like this node_modules/.bin/mocha lib/modules/*/test/*-test.js --reporter spec but this won't find the test files located in the second location.
Is there any way to find the tests in both locations?
You should be able to accomplish this by doing ./**/*-test.js. This should find any files with -test.js in the name in any directory relative to the one you are in.

Why many repos have a test folder in the root directory?

Why many repos have a test folder in it?
https://github.com/openstack/swift
https://github.com/openstack/openstack-helm
what's the test folder's function?
how it works?
A folder named test has no special connotation within Git or GitHub. However, it is a common and descriptive name for folders housing unit tests. Unit tests are of course not the only thing you can put there. One might store tests of an entire program or anything at all.
In terms of function, a number of programs provide test drivers to run each program and report what does and doesn’t fail. For example, autotools uses the check target of make to run tests. It’s just a folder, so you can do anything with it.

How to group together certain tests or files when doing a run in Cypress?

I am currently running Cypress and I have folders inside of it, where I have tests located for different applications.
I have a folder entitled "smhw-qa" which contains sub-folders and tests files for this specific application.
This directory apps will also include other applications too in future.
What I wish to do
In order to avoid having to run every test for a run, I wish to only run this specific folder. The location of the folder is as such:
'cypress/integration/apps/smhw-qa'
Over time, there will be more folders and tests added to the apps directory.
I am familiar with how to run a specific file, so doing the following works:
npx cypress run --spec 'cypress/integration/apps/smhw-qa/banners_promos_global/global_search.js'
How can I specify to Cypress which folder to run specifically when I use the npx cypress -run command?
What I have tried already
To run a specific test file I tried:
npx cypress run --project 'cypress/integration/apps/smhw-qa'
But this provides an error instead:
Can't run because no spec files were found.
We searched for any files inside of this folder:
/Users/jaswindersingh/Documents/cypress-automation/automation/cypress/integration/apps/smhw-qa/cypress/integration
Running specific sets of tests by their folders will be much easier for me, and will save time when running a specific suite of tests on our CI platform for example. I will also not need to specify the individual files since this is time-consuming.
It would also mean I can split out my tests and run them on different machines
Do I need to put anything into my test files, or inside of cypress.json or modify anything else, or can this be achieved through the terminal?
What options must I use instead?
Thanks
I think the clue is in the error message, you call
cypress/integration/apps/smhw-qa
and the error message shows
cypress/integration/apps/smhw-qa/cypress/integration
so to use the --project flag you need to replicate the /cypress folder per project, as per this example cypress-test-nested-projects
Folder structure:
package.json
node_modules
src/
clients/
foo/
cypress.json
cypress/
bar/
cypress.json
cypress/
However, I think you might want to use the --spec flag instead. If I understand it correctly, the glob pattern will allow you to keep the current folder structure. Docs
cypress run --spec 'cypress/integration/apps/smhw-qa/**/*'
Through --project you can manage different cypress.json files, the docs says
This enables you to install Cypress in a top level node_modules folder but run Cypress in a nested folder. This is also helpful when you have multiple Cypress projects in your repo.
so you're on the right way, just prepare some project-related cypress.json files

How do you run `go test` when test files are within a module?

When you have pulled in a module, into your project, how do you run test cases within that module?
i.e. I have done:
go get my.repo.com/repo/mymodule
And then try to test something in it:
server> go test src/my.repo.com/repo/mymodule/my_test.go
# command-line-arguments
src/my.repo.com/repo/mymodule/article_test.go:4:2: cannot find package "mymodule" in any of:
Are we supposed to check out our modules separately and test that way? I can't quite work out what to do. It seems that when I go run it knows how to find the module I have fetched, but when I go test, it "can't find it" in the path.
go test expects packages, not folders relative to $GOPATH.
So leave out the leading src/ and the trailing file name, and it'll work:
go test my.repo.com/repo/mymodule
If the current directory is the package folder you want to test, you can even omit it, e.g.
cd $GOPATH/src/my.repo.com/repo/mymodule
go test
For reference see Command go / Test packages, also run
go help test

dart pub test... can you exclude files / directories?

dart/pub v1.10
I have a test/e2e folder that has webdriver.dart tests. 'pub run test' is trying to run the dart files in e2e.
pubspec.yaml
dev_dependencies:
test: '>=0.12.1 <0.13.0'
I've been running the webdriver.dart test as
dart test/e2e/some_test.dart
Was hoping pub/test implemented a transformer... so I just just exclude it in pubspec.yaml. No joy. Can I build a transformer for test?
Ideas? (besides moving the directory out from under test :-))
update
looks like my options are:
pub run test test/unit (specify the directory)
move the e2e folder out of 'test'
You can filter tests using the --name=xxx (where xxx can be a regular expression) or the --plain-name=xxx (just substring comparsion) parameters to filter tests. There is an open issue to add tags as well but I don't know if this is actually planned.
I don't know what you expect a transformer to do. If you use includes/excludes to the transformer configuration this specifies only which files are processed by the transformer but not which files are executed.