I have the following line with Newman (works correctly), but I am looking to execute two folders at the same petition. First will be executed Login_full and then another (It is not essential)
newman run Example.postman_collection.json --folder "Login_full" "" -e Environment1.json
How could I read two folders?
Regards
Newman v4.1.0 comes with the ability to run multiple folders, like so:
newman run Example.postman_collection.json --folder "Login_full" --folder "another" -e Environment1.json
For a complete list of changes, check the Newman changelog: https://github.com/postmanlabs/newman/blob/develop/CHANGELOG.yaml
Related
My file structure looks like this:
maindir/
- subdir/
- file1.ts
- file2.ts
- file3.ts
- file4.ts
I'm trying to build typescript interfaces using ts-interface-builder, and I want to match and build all 4 file*.ts files. (ts-interface-builder just builds the types, this question is mainly about the matching pattern / wildcards in Windows Powershell since I'm used to Unix).
I'm currently using this command:
npx ts-interface-builder ./maindir/*.ts
But this only builds file3.ts and file4.ts.
I could use a slightly different command:
npx ts-interface-builder ./maindir/*/*.ts
But it only builds file1.ts and file2.ts.
I tried researching Windows Powershell wildcards but wasn't able to figure it out.
Is there a single command I could use to build all 4 files?
Assuming that your npx command is executed by / from PowerShell:
npx ts-interface-builder (Get-ChildItem ./maindir -Recurse -Filter *.ts).FullName
See also: The Get-ChildItem cmdlet.
Take a look at this directory structure:
/root
/one
go.mod
go.sum
main.go
main_test.go
/two
go.mod
go.sum
main.go
main_test.go
Let's say I'm in the parent directory root/ and I want to run all the tests in all subdirectories. What do I do? I've tried go test./... and got the following error:
go: warning: "./..." matched no packages
no packages to test
Yes, this will not work with go test, which expects to work on a single module rooted in the current directory or its parent. It won't work with nested modules either.
You'll need a shell trick like using find or something equivalent to execute in each module (see Cerise Limón's comment for example). Projects will typically use a Makefile or a test.sh script to run that.
One larger project I was working on has a list of all its modules (https://github.com/google/go-cloud/blob/master/allmodules) and then several scripts that operate on this list. For example the test script just loops through this file and runs go test for each directory, along other things.
You don't necessarily need a separate file listing the modules (the go-cloud project uses that for other management tasks) but it just demonstrates one way large projects with multiple modules handle things.
Promoting #Cerise Limón's comment to answer:
find . -name go.mod -execdir go test ./... \;
Building on other answers here:
find . -name go.mod -execdir go test ./... \;
works but always returns a 0 exit code. I need this to fail my CI if any test fails.
find . -name go.mod -execdir go test ./... \; | grep -zqv FAIL
works for me (note by default grep returns status code 0 if there is a match)
I am looking at the unittest docs and I see that I could put multiple suite blocks in one test file.
However, I would like to have multiple test files and run them all with a single command. I could write a bash script to compile and run each script one after another:
#!/bin/bash
nim c -r test1.nim
nim c -r test2.nim
...
But is there a better way? For example in Python I can automatically discover and run all files of the form test*.py.
Put all your unit tests in a tests directory, running nimble test will run all of them.
I was in a C++ program with google unit test, gtest. I ran and built the projects.
At the end, when I ran git status, it gave some weird untracked files. I do not know where they are from, and how I should remove them please. Using bash.
> git status
On branch A
Untracked files:
(use "git add <file>..." to include in what will be committed)
"../path_of_file1\r"
"../path_of_file2\r"
"../path_of_file3\r"
nothing added to commit but untracked files present (use "git add" to track)
This did not work:
rm -f "path_to_file\r"
Thank you.
I believe git clean should work in most scenarios. I tried the rm without the "", it worked! Thank you all.
rm path_to_file\r (complete by tabs)
You can always remove all untracked (and unignored) files with git clean -f. To be safe, run git clean -n first to see which files will be deleted.
David's answer is a good one, assuming you want to do a full git clean.
Here is another option that lets you delete the files individually: Let your shell complete the file names for you, escaping them as necessary.
For example, if you type
rm path_to_file1
and press Tab, most shells will complete the filename with a proper escape sequence. The precise sequence will be shell-specific, and I'm not clear whether \r is the two characters \ and r or whether it's a single special character, but your shell will know for sure.
I've recently been spoiled by using nodemon in a terminal window, to run my Node.js program whenever I save a change.
I would like to do something similar with some C++ code I have. My actual project has lots of source files, but if we assume the following example, I would like to run make automatically whenever I save a change to sample.dat, program.c or header.h.
test: program sample.dat
./program < sample.dat
program: program.c header.h
gcc program.c -o program
Is there an existing solution which does this?
(Without firing up an IDE. I know lots of IDEs can do a project rebuild when you change files.)
If you are on a platform that supports inotifywait (to my knowledge, only Linux; but since you asked about Make, it seems there's a good chance you're on Linux; for OS X, see this question), you can do something like this:
inotifywait --exclude '.*\.swp|.*\.o|.*~' --event MODIFY -q -m -r . |
while read
do make
done
Breaking that down:
inotifywait
Listen for file system events.
--exclude '.*\.swp|.*\.o|.*~'
Exclude files that end in .swp, .o or ~ (you'll probably want to add to this list).
--event MODIFY
When you find one print out the filepath of the file for which the event occurred.
-q
Do not print startup messages (so make is not prematurely invoked).
-m
Listen continuously.
-r .
Listen recursively on the current directory. Then it is piped into a simple loop which invokes make for every line read.
Tailor it to your needs. You may find inotifywait --help and the manpage helpful.
Here is a more detailed script. I haven't tested it much, so use with discernment. It is meant to keep the build from happening again and again needlessly, such as when switching branches in Git.
#!/bin/sh
datestampFormat="%Y%m%d%H%M%S"
lastrun=$(date +$datestampFormat)
inotifywait --exclude '.*\.swp|.*\.o|.*~' \
--event MODIFY \
--timefmt $datestampFormat \
--format %T \
-q -m -r . |
while read modified; do
if [ $modified -gt $lastrun ]; then
make
lastrun=$(date +$datestampFormat)
fi
done