pydev nosetests test run - pydev

Seems like a silly question but I've been unable to figure it out...
I'd like to use eclipse/pyunit to run all my tests. I've configured the test runner to be the nose test runner.
Now I'd like for pyunit to use nose

You can right-click a folder/file and choose Run as > Python unittest or if you have the file open in an editor, you can use 'Ctrl+F9' to run the tests (and even filter to select the test(s) you want to run).
Note: for this to work with nose you have to select the nose test runner in the preferences (window > preferences > pydev > pyunit) -- and the same is true if you're using the py.test runner (but note that if you're using regular unittest tests, the default runner should work fine).

I found this solution:
On the main menu, go to Windows->Preference->PyDev->PyUnit
Under "test runner" choose Nose test runner.
Apply
Ok

Related

debug stepping java code when running cucumber feature file in Eclipse

What I do:
Set up fresh Cucumber maven project using "cucumber-archetype" from io.cucumber in Eclipse 2022-09
Set break points in StepDefinition java source
Run "Debug as Cucumber Feature" on feature file open in editor**
Stepfilters disabled to make sure I'm not filtering anything out
What happens:
"Step into" moves ahead as with normal debugging, but does not go into any source to show line by line which java code is executing.
Expected:
"Step into" to go into source files to show line by line which code is executing, just as happens doing any other debugging with junit5 tests.
What I have tried:
Converting to Cucumber nature
Did maven update project
Project content
A test project contains these test scope dependencies, beyond imports cucumber-bom and junit-bom:
cucumber-java 7
cucumber-junit-platform-engine 7
junit-platform-suite 1.9.1
junit-jupiter 5.9.1
…so nothing more complicated than a base project is needed to get this behavior.
My questions:
Are my expectations of step debugging here unreasonable?
Have I perhaps missed some vital set up step for a cucumber project in Eclipse? Please note I have basically described above what set up I've done as this is an archetype.
If not, how could I set it up to allow stepping into code also when running a Cucumber feature file in debug mode?
** This is the only way to execute the feature file in Eclipse that I know of.
Here's one solution: Run the Cucumber runner java source file as a JUnit test in debug mode, instead of the feature file directly:
Right click on the Cucumber runner java source file
Select "Debug as" > "Junit Test" in the popup menu
This method both gets the input data as well as evaluation results from the Cucumber feature file and renders test results in the JUnit view as well (albeit not 100% useful). Most importantly code stepping into source now works as expected.

Eclipse Pydev adding PYTHONPATH=../:. before running a pytest module

I am developing something in Python in Eclipse PyDev. Per the instructions from my assignment, I need to run this program like so:
PYTHONPATH=../:. python grade_analysis.py
However I am just running the program with the standard Run button and (no surprise) it's not working correctly. It is a unit test that claims it runs 0 tests.
Does anyone know how to run this specific file with that pythonpath in Eclipse PyDev? I've been playing with settings in the Run Configuration and no luck
You have to configure those paths to be source folders inside of PyDev (a source folder is the folder that should be in the PYTHONPATH).
See: http://www.pydev.org/manual_101_project_conf2.html for details.

Can't run groovy script in Groovy Grails Tool Suite

I installed Groovy Grails Tool Suite Version: 3.5.0.RELEASE on a Windows system.
I have created a new 'Groovy' project using the eclipse Groovy project wizard. My project contains one script called 'HelloGroovy.groovy'. When I right click on my script, and choose 'Run As', I do not see any option to run my script except for 'Run Configurations'. I want to see a groovy script option instead. Is there something I need to do to set up my ide further?
I believe your problem is that you have a space in the path to your workspace. I just tried recreating your situation and when there is no space, it works. When there is a space (e.g. C:\Documents and Settings\Foo\Bar\workspace) the menu option doesn't show. I raised https://jira.codehaus.org/browse/GRECLIPSE-1737 to cover fixing it.

How to run only one test in TestCase in NetBeans PHP?

I can run all tests for current file, but how to run only one test?
There are buttons in the Test Results pane to rerun only the tests that failed during the previous run, but I know of no way to run a single test. Right-click a test in that same pane to see if you get an option to run it alone. I'm not at work to test out that theory.
There is a way to do it netbeans: Click Window -> Ide Tools -> Terminal and type:
phpunit --filter '/::testName$/' MyTest.php
Then click Enter.
as far as I know there is no button or something in Netbeans that does that. So using terminal seems like the easiest way. It still is quite convenient though, because it should remember the history and later on you can just copy paste the test name.
Note that you may have to navigate to the test folder first or specify path to your Test file first in case Netbeans terminal doesn't open in your test project folder already

Eclipse: bind some key for all unit tests

I practice TDD and run my tests very often. Eclipse has a nice command to run the last-launched configuration. But when I invoke the command in some unit test class, Eclipse runs only the tests for current unit test class. I want run all my unit tests instead.
Yes, I can use the mouse to invoke the command that runs all JUnit tests, but, to repeat: I run tests very often.
You need to change eclipse's run mode. By default, it will try to run whatever is selected or being edited. You want to it always run the "last thing executed".
Go to Window->Preferences->Run/Debug->Launching
Choose "Always Launch the Previous Application"
Then you can define a TestSuite with all of your test cases and run it, or run all test cases for the project. Once run, you can just keep re-running with F11 or control-F11.
Hope this helps!
-- Scott
Maybe Infinitest is what you need.
You can create a JUnit launch configuration for all of your tests by right clicking the tests folder and choosing "Run As > JUnit Test".
Then see https://stackoverflow.com/a/8176077/255961 which describes how to use the Practically Macro plugin to assign shortcuts to launch configurations.
PS, If for some reason you have tests in more than one folder you can then edit the JUnit launch configuration to work at the project level as well:
To run all unit tests in a project, package or source root, select the item in the package explorer and hit Shift+Alt+X then T (or right click->Run As-> JUnit test).
To get the focus on the package explorer, hit Ctrl+F7 to bring up the "Next View" menu, hit it repeatedly to cycle through the list or hit up and down arrow then enter to select the view.
Once you've run it once, F11 can be set to run the last launched if you tweak the debug preferences (the default is to run for the current selection).
There is also Junit Max. It is not free but very cheap. It will run all your tests every time you save a file and indicate if the tests were successful in the right bottom corner of eclipse.
If a tests fails the line where it fails is marked as an error so you can keep working with the source files and don't have to wait for your tests and have your workflow interrupted.