is there a way in vscode with metals scala plugin, run specific test scenario ?
Like in IntelliJ ?
If you mean specific test clause in say a scalatest class, I'm pretty sure the answer is "no".
Workaround could be to add a launch configuration and pass args to just run the test you want with -z: https://scalameta.org/metals/docs/editors/vscode.html#via-a-launchjson-configuration
Or just ignore-tag the others.
Related
I'm trying to run a very simple hello world Scala program in IntelliJ IDEA on Mac without using the Scala console configuration. I have followed these steps to largely get started, but I didn't set up the debugger outlined there. There isn't a default run configuration enabled, but I can right-click on my source file and select "Scala Console," as we can see here:
Is there a way to select or edit my configurations to make it so I don't have to use the console? Below are the available configurations.
I simply want there to be a way to run my Scala code and see the generated output in the provided console, which Scala Console isn't doing. Thanks for your time.
Lab6 should be an object, not a class.
This will allow you to run it as a main method
I would like to use a scala REPL console for Gatling to debug some code and evaluate it.
Is there any easy way to do that? Is there a fast way to do a syntax check on Gatling scripts?
If you're using SBT, you can always take advantage of SBT's console task to get Gatling in your classpath and and experiment with its APIs, but you won't be able to execute requests, etc... from the REPL.
The next best solution is to use Gatling's SBT plugin (https://github.com/gatling/gatling-sbt) : using it, you can quickly compile and run your simulations, even launch them on every successful compilation until the result suits you.
I am new to Scala and to using emacs + ensime + sbt setup for my Scala development.
This setup is quite nice and light, but there is one thing which drives me nuts - inability to auto-compile / reload changes into Scala console started from sbt.
I use REPL a lot and would like to be able to start REPL from sbt with console command and test my changes to scala classes from REPL without having to close it and reload every time I make a change.
I come from Erlang environment and this way of development is easy with Erlang but seems to be difficult with SBT. I have the JRebel plug-in installed but it doesn't seem to be working for the situation I described.
Has anybody been able to make something similar work and would be willing to share the configuration steps?
Much appreciated in advance.
There are two things possible in sbt:
Causing automatic recompilation of the project sources triggered by a file change by prefixing a command with ~ (tilde). The console, or console-quick, or console-project commands can be prefixed, too, but you have to exit REPL to make the recompilation happen (just hit Ctrl+D and wait.)
Causing automatic execution of REPL commands just after firing the console. They can be defined as properties (e.g. in build.sbt):
initialCommands in console := """
import some.library._
def someFun = println("Hello")
"""
It's not necessary to define the property separately in consoleQuick because it defaults to the one defined in console, but if you would like to use the console-project command you have to define it separately.
On a final note: remember to leave empty line between every property in an *.sbt file. They're necessary to parse the properties correctly. In the example above there are no blank lines in between so it means that everything goes into the initialCommands property (and that's what we want.)
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.
Is there any straightforward way or should I use an external tool like Nose?
Pydev 1.6.4 provides support for a nose test runner.
http://pydev.org/manual_adv_pyunit.html describes how to configure the nose test runner.
To run doc tests, you'll need to specify the --with-doctest switch for the nose runner.
Xv's answer is correct, unless you have tests that are in external files (like testable specifications) in which case you should add the doctest-extension=txt switch (substituting txt for whatever your extension is).