Running doctests from Pydev? - pydev

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).

Related

No possbile to set "--workers" via NUnit Engine API

Nunit command line has arg --worker to set LevelOfParallelism
We are running the test programmatically via NUnit Engine (https://docs.nunit.org/articles/nunit-engine/Getting-Started.html)
And I could not find a way to set "worker" in Test Engine or Test Runner
Maybe someone knows how to do this?
I've Google and debugged Test runner - could not find anything
UPDATE:
package = new TestPackage(arguments.Value.testDllPath); package.AddSetting(FrameworkPackageSettings.NumberOfTestWorkers, 8);
Short answer...
Add a setting to the TestPackage you use to get a runner from the engine named "NumberOfTestWorkers" with the value set to the number of workers you want the framework to use.
Details...
This is not actually part of the engine but part of the NUnit framework. The engine is generally framework-agnostic, that is, it doesn't assume you are running tests with the NUnit framework. However, it passes through any settings on the package, which it doesn't understand. It's up to the test framework in use to interpret them.
That's why you can't find the details in the engine documentation, although it could probably be improved by adding a paragraph like the above somewhere. :-)
Bear in mind that writing your own test runner using the engine directly is a somewhat advanced activity. I think the engine docs give you a lot of info about how to get started but you will also need to examine source code of existing open-source runners. For example, looking at the console runner itself, you could have seen this code (reformatted to fit):
if (options.NumberOfTestWorkersSpecified)
package.AddSetting(
FrameworkPackageSettings.NumberOfTestWorkers,
options.NumberOfTestWorkers);
The class FrameworkPackageSettings is part of the runner and includes settings used by the NUnit3 framework and exposed by the runner.
Good luck!

VSCode metals, run specific ten in scalatest

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.

Apama 10.3: Add pysys nature to projects

I am working with Apama 10.3, in Software AG Designer. I have a project that I'd like to add the Pysys nature to my project, but the usual attempts (right-click on project name, project > properties, etc.) don't help. I couldn't find anything in the documentation either.
How can I work with Pysys in Designer, please? I'd like to be able to build my tests via the IDE, for consistency and convenience.
Currently eclipse/Designer doesn't have a PySys nature, but what you can do is add a generic eclipse "Python" nature – which you can do using "PyDev".
And then to launch pysys from eclipse you’ll need to add a launch configuration. There are various options but the most convenient for this purpose is the “external tool” eclipse feature.
You need to invoke pysys.py with the right environment for locating python and also Apama if you want to use it with the Apama extensions. If you’re using PySys with Apama 10.3.1+ this is easy as you can use the new capability of the apama_env.bat script to execute a command e.g. ${apama_home}\bin\apama_env pysys run –n 0 –purge. If you’re on an earlier version I’m afraid you probably need to create a trivial .bat script of your own that first runs apama_env and then pysys %*
You'll want to set the working directory in the eclipse launch config go ${project_loc}/tests so it runs all tests. Or alternatively, ${selected_resource_loc}, to invoke a specific test subtree. You could create separate launch configs for both use cases.

Can you use breakpoints in extension tests?

When writing integration tests for a VSCode extension, are you able to use breakpoints?
I am running the tests in the default hello-world example from the yeoman generator. My breakpoints are not being hit. I had a guess and set stopOnEntry to true in launch.json, however it didn't help.
Thanks
Yes, this should work, if not I suggest you file an issue over at https://github.com/Microsoft/vscode

Jacoco code coverage for remote machine

I tried to find this answer but hardly found it anywhere. I am doing the API testing, In process I need to call the rest API from my local machine. local machine contains the maven project and a framework to call respective rest API.
I need to check the code coverage of remote Rest API and form a report based on the code coverage. please help, how to do that?
Note: I found this link useful but it does not elaborate clearly on what to do?
http://eclemma.org/jacoco/trunk/doc/agent.html
you will probably do a bit of file copying around - depending on the way you run the tests.
JaCoCo runs as a java agent. So you usually add the javaagent parameter as mentioned in the docs you linked to the start script of you application server.
-javaagent:[yourpath/]jacocoagent.jar=[option1]=[value1],[option2]=[value2]
so it would look like:
java -javaagent: -jar myjar.jar
Using tomcat you can add the "-javaagent" part into JAVA_OPTS or CATALINA_OPTS environment variables. Should be similar for other servers.
this will create the jacoco*.exec files. you need to copy those back to your build or CI server to show its results (for ex if you use sonar you need those files before running the sonar reporter). Its important to just include the packages you're interested in.
You can also create one jacoco.exec file per test flavour (jacoco.exec for unit tests, jacoco-it.exec for integration tests, jacoco-at.exec for application tests).
And I would not mix coverage with performance testing - just to mention that too.
There are some examples on stackoverflow for JBoss