How do I test only the seeds in my dbt project? - dbt

How can I test only the seeds folder on my dbt projet??
I've used dbt test, but it tests the entire project (seeds included). I've used dbt test --select seeds but it says: Nothing to do. Try checking your model configs and model specification args
Is there any way to test only the seeds folder?
I've searched everywhere but I couldn't find anything regarding this

From the docs:
# Run tests on all seeds, which use the 'seed' materialization
$ dbt test --select config.materialized:seed

Related

kotlinc -script with multiple files

I have a Kotlin script which I'm using for testing.
In order to run it quickly, I'm using kotlinc -script to evaluate it which prints me the result straight away in the console.
Now, when the script becomes big enough, I want to split it into different submodules/packages. Is it possible to evaluate a script with multiple files with kotlinc?
Note, the setup is only intended for testing purposes that's the reason I don't want to compile it, to avoid an extra step. Imagine doing it stright from the console and you don't want to set up a project with Gradle.
Thanks.
Looks like kscript is the answer.
Install kscript
Import required file: //INCLUDE directory/requiredFile.kts
You can call functions from the requiredFile.kts now.
Run your file with kscript ./mainScript.kts, you may need to chmod +x mainScript.kts
If anyone knows how to do it directly with kotlinc let me know.

Will go test code only referenced in test files be compiled into the binary?

I am wondering what code will be compiled into the go binary if you compile a binary using go build ./... . This will compile a binary that has a cli program. For this cli program, I have test code and non test code. I currently have several flavours of test code:
foo_test.go in package foo_test
foo_internal_test.go in package foo
testutil.go in package testutil that provides test utility functions
No test code is actually referenced in the non test code. The testutil functions are only imported in the test files.
If the test code is infact compiled into the binary , how much of a problem is this?
A go binary only includes code reachable from its main() entry point. For test binaries main() is the test runner.
As to "how much of a problem" it is if it were included... none. It would increase the binary size and compilation time somewhat but otherwise have no impact - code that isn't executed, by definition, does nothing.
I believe that if you have an init() function in an otherwise unreachable file, it will still be linked into the executable.
_test.go files would be still excluded.
This bit us when we had some test helper code that was not in _test files. One had an init() function which ran on the executable startup.

Testing with Cucumber and Selenium:How can i break the sequence of feature file and run in random sequence

I have tried many option but any of them not work as i need. I have created some feature file as i required time by time. so i have a disorder feature file.
I want to run the feature file as i wanted. like.
fil1.feature
fil2.feature
fil3.feature
fil4.feature
so i want to run in this sequence : file3.feature->fil4.feature->fil1.feature.
I have tried #tag, #feature in junit test runner option but its maintain the sequence its run only 3,4 but can't run 1.
So can you tell me how to run feature file randomly???
Cucumber picks up the feature files in alphabetic order from the folder given in the features parameter of the CucumberOptions. So one options would be to rename your feature files alphabetically in the order you want.
After the feature files in the initial folder are read, then the sub folders in the location are picked up alphabetically and the feature files inside them are read. So you can place the file you want to be used later into a sub-folder.
Saying all this, it is not a very good idea to have any dependency between tests which requires a sequence to be maintained.
I got the same stop. Have you solved this problem?
I did some test, use --tags #XXX to controll the sequence is useless, it's just action on different scenarios in a feature file.
so far, I have to do it like this cucumber features/c.feature features/a.feature features/b.feature I think this is a little bit better than rename feature files.
But you may say that: "If there is a lot of feature files......" In my project(ROR), I assigned the statement to ./config/cucumber.yml
In cucumber.yml I define a profile, test_dev: features/c.feature features/a.feature features/b.feature after that, I just to use cucumber -p test_dev and the feature files execute in order.
If you have a butter way, please share with us.

Defining Variable in Custom Target for CMake

I have a CMake file with two targets (say, target1 and target2) defined via "add_custom_target" at the top level of my source directory. I have some external projects in lower level directory. In the extneral project, a "TEST_COMMAND ${Test_Command_Variable}" is defined as part of an ExternalProject_Add().
I would like to change that vaiarble ${Test_Command_Variable} depending on whether I am using custom target1 or target2. Currently, ${Test_Command_Variable} is defined at the top level CMakeLists.txt before either custom targets are defined. I simply want to vary that variable depending on whether target1 or target2 is called. Is there any way to redefine that variable? Maybe do a conditional if statement dependent on whether target1 or target 2 is chosen (this seems like a trivial thing, but I can't find the way to access the "name" of the custom target!).
To clarify: I have two collections of tests. I want to type "make target1" and it runs my first collection of tests. I want to type "make target2" and it tests my second collection of tests. The problem is I also have an external project, where some of the tests are there. The external projects have a TEST_COMMAND(test_command_variable) that does not differentiate between target1 tests and target2 tests. I would like to be able to change that variable depending on whether I run "make target1" or "make target2".
Well, I got it working finally. I did something completely different to meet my objective. I abandoned the goal of trying to toggle variables depending on the target. To be clear, here was my objective:
"make target1" runs only tests in Group 1.
"make target2" runs only tests in Group 2.
I configured each of the tests as per as per this question I asked earlier. My problem was that I had external projects I was trying to pass that variable down so it would toggle Group1 or Group 2 tests depending on the configuration defined at the top level. I knew passing ctest -C group1_configuration flag (or group2_configuration flag for group2 tests)would work, but I couldn't seem to pass down to my external projects. Fortunately, my solution was "simple".
I wrote a shell script that would execute the correct ctest ... -C group1_configuration (or ctest ... -C group2_configuration) and called it test_script1.sh and test_script2.sh. These scripts would move through the build directory and call the aforementioned ctest command in each of the external projects build directories. Then, in my custom target's I defined in the CMakeLists.txt I have it call the shell script and each custom target executes the right shell script, which move through the build directories calling the correct ctest command with the correct configuration flag in each project and external project.

Rails Testing - Break code

I am writing test cases for ROR. The code to test one model/controller is too much . Is there anyway to break the file in different files for testing the same model/controller.
Yes you can split up tests into different files. I believe test::unit requires files to be *_test.rb.
So say you had a test file for a User model. You could have your tests broken up like:
user_validations_test.rb
user_login_test.rb
...
I know you're using test::unit but, same thing goes with RSpec, you can break up your tests into *_spec.rb files.
If you are using rspec for testing, you can simply add more than one file describing the same class. It might be reasonable to create in spec/ directory matching subdirectory, and place all spec files in there.