I'm just confused why the same test works in IntelliJ but not in Eclipse or the Azure build server.
It would help to share the code I think, I just fill out a login Page and click some buttons.
For some reason that's to fast for eclipse and the build server, but I why it works normally on IntelliJ?
I'm new to IntelliJ and I also tried to disable the JUnit Plugin, but this won't help because you can't run any test without it.
EDIT: I also tried it in VS Code, with the Extension Pack for Java and it works the same way like in Eclipse.
I don't know what is different to IntelliJ, but something is wrong there.
I don't know the reason but I guess the problem is that IntelliJ is a little bit slower then the other IDE's on executing JUnit tests / or slower when using Appium.
When I try to run the tests by right-click and selecting "Run.."
It used to work until a few days ago. I use IntelliJ 2021, I tried an older version but I have the same issue, I tried uninstalling most of my plugins, nothing. I also tried searching through similar issues but nothing was of use.
This is how the Run Tab looks
In the Run tab, a list of running tests should be seen, but it is not. My project is a Maven project with Java and Gauge. Do you have any idea what the problem could be? My guess is I either pressed something by mistake or something else is doing this.
Nevermind, I just found the issue, please make sure to have
this checkbox
checked if you use Gauge.
I am not finding any clear documents to start the Swtbot. I am trying couple of days to start it.
Can any one please help me configuring and executing the swtbot?
If you are just starting with SWTBot, it's good to start with running it on Eclipse IDE(assuming you're using Eclipse).
Install SWTBot in Eclipse from update site http://download.eclipse.org/technology/swtbot/releases/latest/.
Now go to Run Configurations and find a section named SWTBot Test on left side.
Right click and create a new SWTBot launch file.
In the Main tab you can configure which class or suite or test method to execute.
You can also configure which product you want to run your tests on.
It'd be more helpful to answer if you provided with how far you have gone.
If you're in IDE (with SWTBot installed in it), just right-click on your Test Case and select "Run As > SWTBot Test Case". This will create a good enough launch configuration (that you can refine later if necessary).
If you're trying to run tests independently of the IDE, please read https://wiki.eclipse.org/SWTBot/Automate_test_execution
I have recently installed NB 7.3.1, and installed the JUnit plugin. In the old days, JUnit was bundled with NetBeans. I used it all that time.
I want to use it now, but I can't find any command, button, tool, etc to cause Netbeans to create the shell unit tests for me.
What am I doing wrong? How do I find it?
Thx
Make sure you have a test folder. Go to your project properties, and under Sources, in Test Package Folders, make sure you have at least one folder where you want to put your test sources.
If the button is still greyed out after that, you can go to File > New File > Unit Tests > JUnit Test. If it gives you an error message, it may help you solve the problem.
I've been trying to understand how to start writing and running JUnit tests.
When I'm reading this article:
http://junit.sourceforge.net/doc/testinfected/testing.htm
I get the the middle of the page and they write, "JUnit comes with a graphical interface to run tests. Type the name of your test class in the field at the top of the window. Press the Run button."
I don't know how to launch this program. I don't even know which package it is in, or how you run a library class from an IDE.
Being stuck, I tried this NetBeans tutorial:
http://www.netbeans.org/kb/docs/java/junit-intro.html
It seemed to be going OK, but then I noticed that the menu options for this tutorial for testing a Java Class Library are different from those for a regular Java application, or for a Java Web App. So the instructions in this tutorial don't apply generally.
I'm using NetBeans 6.7, and I've imported JUnit 4.5 into the libraries folder. What would be the normal way to run JUnit, after having written the tests?
The JUnit FAQ describes the process from the Console, and I'm willing to do that if that is what is typical, but given all that I can do inside netbeans, it seems hard to believe that there isn't an easier way.
Thanks much.
EDIT: If I right-click on the project and select "Test" the output is:
init:
deps-jar:
compile:
compile-test:
test-report:
test:
BUILD SUCCESSFUL (total time: 0 seconds)
This doesn't strike me as the desired output of a test, especially since this doesn't change whether the test condition is true or not.
Any ideas?
One way is to right click on your project in the Projects pane and select "Tests". That will run the JUnit tests. You can also right click on the test file and select "Run Test" and that single file will be ran. The keyboard shortcuts depends on how you have your keymapping set, but you'll see them in the context menus.
You can also have NetBeans autogenerate tests for you by right clicking your source file and then "Tools > Create JUnit Tests".
Re-importing does not appear to be necessary. I had the same issue (imported project, right clicking did not bring up any JUnit test options). I took these steps, which resolved it, using NetBeans 6.8:
Add a folder called "tests" to your project.
Right-click your project and select Properties.
Select Sources.
Under Test Package Folders, click the Add Folder button, and select the "tests" folder.
Right clicking a file + Tools > Create JUnit Tests.
Once a test is created, right-clicking a file + Test File runs the test.
All the above answers are correct, but if you are using in mac little change needed.
Step 1 Write your junit class.
Step 2 Right click on the class ->Tools-> Create/Updates Tests-> Select framework as Junit-> click ok.
Step 3 Right click on the file again ->Test File.
Now it will run as junit, will show the Test Result.
Even though I've accepted an answer, I thought I should mention my difficulty, as someone else may encounter it.
When importing a project from existing sources into NetBeans, if you do not specify a folder for test packages, then NetBeans will not offer the JUnit options on the tools menu.
The only solution I found was to re-import the project. While primitive, it worked.
I had the same issue after imported a eclipse project into NetBeans.
To resolve it, I followed the above steps outlined by alangalloway, but instead of
creating a new folder, I just pointed to the imported test folder.
Maybe in future release, NetBeans can automatically recognize imported test cases.
Thanks.
Had a similar issue. In Netbeans 7.0.1, what worked for me was to locate the project.xml file (i.e. {project}/nbproject/project.xml) and change:
<test-roots/>
to:
<test-roots>
<root id="src.dir"/>
</test-roots>
(in my case the test files are in the same dir as the source dir)