I would like to run a single test class in a non interactive mode, in a multi module project.
I know how to do it when interactively first launching sbt, then selecting the project, and then using the "testOnly".
How to do it all via one command (or a script)
You can achieve that with the following syntax
sbt "project-name/testOnly classpath.of.Test"
So for example
running the Test biz.neumann.MySpec in the submodule logic you can use this command on the shell:
sbt "logic/testOnly biz.neumann.MySpec"
The " are important otherwise each withespace is interpreted as as an separator for additional arguments.
Related
We use the NUnit console to run our tests in Jenkins and we have many projects that share some tests. We want to be able to run the tests concurrently and to do that we need the tests to look at different databases.
I would like to pass in the project name to the nunit-agent which wouldn't know how to use it, but we would be able to fetch that from the command line arguments running the test and decide which database to look at.
I am open to suggestions.
We currently use "C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" Path\Tests.dll --result=nunit-result1.xml to run the tests
nunit-agent uses arguments to pass information that NUnit needs. For passing information to the test, the standard way is to use the --params command-line option and then access the values from your tests by means of TestContext.Parameters.
I am trying to load different config file per task in sbt, for example I want to be able to run a task like:
sbt devRun
and loads src/main/resources/application.dev.conf while running:
sbt run
will load src/main/resources/application.conf.
As I understand it, we can load different application.conf when running test by putting it on src/test/resource/application.conf, but using different config file for different task (or scope) will need some code on SBT.
I've been trying to google around and usually the suggestion is to use it on run task like:
$ sbt run -Dconfig.resources="application.dev.conf"
But as far as I understand, the above will only load different config on runtime. I have multiple projects with lots of config file. I want to load them dynamically, based on scope / task. What's the best way to do this?
Thanks before.
You can(must) use the javaOptions setting. It represents Java options when sbt runs a forked JVM, e.g. it runs tests in a different JVM process(by default).
javaOptions in Test += "-Dconfig.resource=" + System.getProperty("config.resource", "application.test.conf")
Instead of Test plug in whatever config you have. If you don't explicitly pass a config.resource parameter it will use application.test.conf.
I'm trying to use g8 to generate scala probjects, but under the msysgit bash shell, it does not show the usual prompts, such as organization, etc. The below is the expected output:
>> g8 typesafehub/akka-scala-sbt
Akka 2.0 Project Using Scala and sbt
organization [org.example]: akka.tutorial
package [org.example]: akka.tutorial.first.scala
name [Akka Project In Scala]:
akka_version [2.0]:
version [0.1-SNAPSHOT]:
Applied typesafehub/akka-scala-sbt.g8 in akka-project-in-scala
I do it get this mac and using the Windows cmd.exe console. But under msysgit, it prints out the Akka 2.0 Project Using Scala and sbt and then nothing else, so it looks like it hangs. However it i type in the expected values and hit return it works as expected. The prompts are just not printed to the screen.
Any suggestion on how to get this working properl, since i really would prefer not to resort to cmd.exe
The most of my tests uses database integration with NDbUnit and the isolation mode I use is grouping by them full class name.
Now, I need this config runs on command line 'cause I'll use Jenkins CI.
Is there any way to do this?
You can do this on the mstest.exe commandline using /test
mstest /testcontainer:TestProject1.dll /test:TestProject1.Unittest2
This will execute all the tests within the UnitTest2 class.
If you are using nunit-console.exe, then you can by Category. There is documentation on what you can send to the runner here (http://www.nunit.org/index.php?p=consoleCommandLine&r=2.2). You will likely want to use the /include and /exclude flags.
I developed a simple scala app that uses casbah to query the DB for the command line argument passed to it. For example
$ querydb.scala execution 10
it will run a casbah query to find 10 records matching execution in mongo. Now i have two questions.
1) How do i test this in my local. If i click execute in intellij it is just running the program, i am not able to pass command line arguments to my program.
2) How do i deploy it to run on my server, it is just going to used as console app in my ubuntu server, but im not sure how i should deploy this, which files i should put up on the server and how do i execute it in server, and stuff like that.
Any pointers would be useful for me.
or try to use sbt, IDEA has a plugin with sbt, the wiki of it has an explanation on how to use it.
I usually use sbt directly in Terminal instead of running in IDE.
1) First you need to find "Select Run/Debug Configuration" button at the top of your screen
Click on it and choose edit
Create new one, if you haven't got it yet.
Your program parameters should be written in "Program parameters" field
2) Compile your .scala files with scalac and you'll got .class files.
Then deploy it, as you usually do with java code. Hence you don't need to install scala on target machine - all you need is JDK.