Questions tagged [junit]
JUnit is a unit testing framework for the Java programming language.
109
questions
1
vote
6
answers
3k
views
Mandatory fields in selenium webdriver not changing the color of the dropdown from red to blue once value is selected?
I am new to Selenium Webdriver , I have an application build in angular 2 and trying to select values in drop down which are mandatory.
1) Select a value from a dropdown; initially the dropdown is ...
0
votes
0
answers
53
views
How to terminate the application and make the launcher return to its call by the stop command?
In question: Need code examples on how to use org.junit.platform.launcher.listeners
problems have been resolved:
Exit – program interruption Pause (true) – stops work before receiving Pause (false)
...
2
votes
3
answers
12k
views
generating html report from soapui test results when running from maven & jenkins
I have a SOAPUI Project file with number of test suits. I have wrote a maven project to run that project file.
I am running that maven project (pom.xml) through jenkins.
As you can see in the pom.xml ...
0
votes
2
answers
86
views
Selenium JUnit tests each with different logged in (authenticated) users
I am using Selenium and JUnit to automate tests.
Lets say there are two tests and each has to authenticate with a different user and perform an action.
Can it be done any smarter than to call an ...
0
votes
0
answers
486
views
Java Cucumber - junit does not run any test
could you tell me why "mvn test" or "mvn verify" does not run any test ? Maybe any dependency is missing ?
package cucumber.Options;
import io.cucumber.junit.Cucumber;
import io....
0
votes
1
answer
278
views
Need code examples on how to use org.junit.platform.launcher.listeners
I run according to the documentation with a test class with 30 tests inside org.junit.platform.launcher.Launcher
I have a function launcher.registerTestExecutionListeners(listener)
registered in org....
1
vote
3
answers
17k
views
How to fix cucumber step does not have matching glue code?
The cucumber feature file has all steps highlighted in yellow and warning is shown as step does not have matching glue code, When I try to run the project as maven test, I am getting null pointer ...
3
votes
3
answers
6k
views
How to execute parallel junit tests with maven surefire
I'm using Selenium WebDriver, Junit 4.9, maven for testing.
Now I need to parallel tests. I added the plugin below, then tried to run it from IntelliJ IDEA 11, but it was still running sequentially.
...
2
votes
2
answers
10k
views
The plugin specification 'com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:' has a problem:
I am getting this error while trying to generate the extent report for cucumber-java and Junit. I am using cucumber version 6.9.1 and grasshopper adapter6. This is my pom.xml file.
<!-- ...
0
votes
1
answer
398
views
What is BrowserGetter in JUnit?
I am a beginner for test automation and following the Test Automation University 'IntelliJ for Test Automation Engineers' course. In chapter 6.3 to create fields and variables use this 'BrowserGetter' ...
6
votes
5
answers
3k
views
How to write unit test for methods with a large number of parameters?
I am asking in case I run into this scenario in the future.
Someone in my company wrote multiple methods with 25 parameters. I don't know how/why it got thru code review. I'm just wondering how ...
0
votes
1
answer
32
views
How to test functions which interacts with databases?
I have a function getEmployeeData() which internally calls generateSQL() to get the SQL and execute it and returns the final result.
Now, how to test this functionality? Having JUnit test to validate ...
2
votes
2
answers
8k
views
What are Selenium, JUnit, Ant and JScover and how they are combined?
I am given a javascript function which takes as input some numbers and returns the max, as a part of a project at the university, and I have to test it, using Selenium, JUnit, Ant and JScover. I have ...
1
vote
0
answers
52
views
Selenium ide Java generated code does not scroll
I am trying to automate a test suite by using selenium IDE, the idea its to generate the tests with the IDE and then export them to a java/jUnit format.
The problem its that the the tests generated in ...
0
votes
1
answer
243
views
Cucumber + Junit + Extend Test Steps (use IDs in next step)
Details:
We currently use Mockito/ Wiremock (in different teams), Junit and Cucumber in our test procedure.
And test cases are functional, but we want to extend them with regard to post procedures.
...
0
votes
2
answers
713
views
Unable to read the parameter value inside a class using TestNG
To achieve parallel execution, I am updating my existing Junit project to TestNG.
The requirement here is to run one scenario in different browsers using TestNG
RunnerClass is as follows:
import ...
0
votes
1
answer
910
views
Cucumber with junit to automate java swing app
I need to automate java swing desktop application and want to run functional scenarios including click on buttons, opening of drop down lists etc
using cucumber. Is there any junit package/class that ...
0
votes
1
answer
105
views
Unable to confirm a JUnit passing result
I created an automated test using JUnit and selenium on ebay that:
navigates to page, logs in, searches for items, adds them to chart, navigates to cart page and counts the items from cart.
...
1
vote
0
answers
189
views
JUnit tearDown implementation for Spring-test's SimpleNamingContextBuilder/DataSource
I'm using this code snippet to mock JDBC Datasources from within Junit4:
@Before
public void setUp() throws Exception {
try {
SimpleNamingContextBuilder builder = new ...
0
votes
0
answers
123
views
How to execute test cases after ide crashed
Kindly suggest if I have 100 test cases after executing 40 Test Cases my IDE was crashed. So, on the next time when I am restarting my Test Cases again the execution should be start from 41 to 100.
I ...
3
votes
3
answers
890
views
Running Junit test parallely with csv test data
I have a csv test data file with 50+ test data in it. I want my JUnit test to process these 50+ test data in parallel than serially. How can we do that? Is there a framework that can do that?
Junit ...
7
votes
3
answers
7k
views
How to test if my application method handles HTTP status 404 of a REST API without actually calling that REST API
I am currently trying to automate some of the testing for my application using JUnit. My application has a method which calls a 3rd party REST API. I need to check if that method is handling HTTP ...
1
vote
0
answers
574
views
Running a Cucumber test runner without executing the tests
One of the Cucumber options is to create a .html report or .json file of the features being run in a given test. Every time you execute a test run, it runs through the tests and at the end of a run ...
0
votes
0
answers
289
views
Junit Report Generate
I am using Eclipse Kepler for the generation of test cases using JUnit.
I have tried the follow through this link https://earlwillis.wordpress.com/2012/01/31/getting-started-with-junit-reports/
But ...
-3
votes
1
answer
64
views
How can i use driver.findelement for All Steps [duplicate]
I need to call google in a test case and with google open enter the information in the fields.
Take a look at my code:
import cucumber.api.PendingException;
import cucumber.api.java.es.Dado;
import ...
1
vote
1
answer
1k
views
Automation solution for PDF content validation using Java [closed]
I am doing POC on PDF content validation which will basically validate the content of PDF files. But I didn't find any solutions.
Solution which I am looking for:
Read the PDF file from a specific ...
0
votes
1
answer
46
views
Best model/design technique for test scripts [closed]
What's the best/most advanced classes design/modelling approach when writing selenium webdriver scripts using Java. Example of one modelling approach is TDD and page object. Can we integrate both?
...
0
votes
2
answers
877
views
what is difference between selenium web driver and junit? [closed]
I am confused about selenium webdriver and junit that are they same? please explain difference between them.
2
votes
2
answers
218
views
Best strategy to test automatically a web application
I have an application that consist of a web server in Java EE (EJBs and JAX-RS RESTful services) and a client module in Angular that runs in a browser.
The components that I can unit test ...
2
votes
2
answers
163
views
java.lang.NullPointerException problem in Selenium Test
I'm learning Selenium POM with Junit and ran into a problem.
java.lang.NullPointerException
at MainPage.clickSignIn(MainPage.java:27)
at MainPageTest.signInTest(MainPageTest.java:28)
My class:
...
1
vote
1
answer
1k
views
How to Embed / Attach screenshots when each step is executed in Cucumber
I need to take a screenshot after each step of execution and embed them in results. I have tried using the "After" method but it captures only the last screen and displays it at the end of the report.
7
votes
7
answers
39k
views
Take screen shots using selenium webdriver
How to take screen shot on both test cases "Positive and Negative" results?
NOTE: Currently, I am working in selenium webdriver (junit) and I did not have an idea about how to code for adding methods ...
1
vote
3
answers
267
views
One Selenium framework to rule them all (or an actively maintained collection of frameworks)
I am looking for most universal, up to date, open source, selenium framework for test automation. Or at least a number of frameworks for different languages.
I am surprised as how every company and ...
0
votes
2
answers
58
views
Automated tests for shop basket - how to handle not known number of arguments in test with Junit
I'm working on test automation for shop basket module and I'm struggling with providing test data using Junit CsvSource in the 'nice way'.
So far my test looks like this
@ParameterizedTest(name = "...
-1
votes
1
answer
38
views
Can I use this library for Junit?
I put this library: import org.apache.commons.io.FileUtils;
but it sends an error The import org.apache.commons.io cannot be resolved
what library is equivalent exist for Junit?
0
votes
3
answers
168
views
How to provide Product Owner with estimates for unit testing?
"How long does it take his developer to write a unit test?" This is exactly the question the project owners keep asking me. The question is not actually how long it takes to write the unit test, but ...
-1
votes
1
answer
173
views
Why tests fail when run in eclipse after creating through selenium IDE?
I have created many tests using Selenium IDE and exported into java files in order to run in eclipse. All tests work properly in Selenium IDE but when I run in eclipse(java file) it creates following ...
4
votes
2
answers
16k
views
How and where to store dynamic result/data using webdriver java
I want to know "How and where to store dynamic (Search results) result/data", I am getting the results and not sure what to do next.
Also, after saving these results I want to use this in another ...
-1
votes
1
answer
3k
views
Caused by: org.openqa.selenium.NoSuchElementException: No such element [closed]
Java Code:
@Test
public void enterApplicationCerdentials(String userName, String password) {
WebElement element;
WebDriverWait wait = new WebDriverWait(driver, 100);
...
2
votes
1
answer
94
views
Junit: how to know which structural units are not covered in test coverage?
I am currently working on running junit tests in Evosuite. Whenever I execute a test case, the structural coverage is not 100%, but around 90% or 85%. Is there a better way to know which structural ...
1
vote
1
answer
88
views
Do Test Runner and Testing Framework exists separately in Java?
As per my knowledge, test runner is any software that takes testing code and as per the configuration, executes the code and collate the results while the testing framework is basically the name given ...
1
vote
4
answers
24k
views
Not able to open the URL using the driver.get method in Selenium after launching the Firefox browser?
I am new to Selenium. I have written a simple script using Junit/Selenium that opens a browser, opens a URL and then quits the browser. But the script isn't working.
Although the browser is launched ...
1
vote
0
answers
137
views
Unable to call custom annotation in selenium test
Unable to call custom annotation in selenium test i am writing a Apache poi selenium junit test - To avoid @RunWith i have tried myown annotation
public class MyTest extends OtherTest {
String a ;...
5
votes
9
answers
2k
views
What are good resources for a manual tester to transition to automation?
Nervously looking at job posts, automation and programming is no longer "good-to-have". It is almost a must.
I'm a manual tester looking to start working towards automated testing/test automation. I ...
1
vote
4
answers
1k
views
Katalon or Java+Junit+Cucumber to automate tests?
We are starting to automate web tests, but we don't know what is the best way to do, what is the best option to start and why?
And what is the best-easy to use for automate Mobile IOS and Android?
1
vote
2
answers
8k
views
JUnit ParallelComputer Runs All Test Classes As One
I'm building automation testing for web application by using JUnit 4.9 and Selenium Webdriver. It's time consuming. So I'm trying to experiment with ParallelComputer.
I'm wondering how can I get ...
2
votes
0
answers
3k
views
Can't run tests from Cucumber feature.file (cucumber.runtime.CucumberException:)
I can run my tests from my runner class without any problem. Here is my Runner-class:
@RunWith(Cucumber.class)
@CucumberOptions(
format = {"pretty", "html:target/cucumber"},
glue = {"...
19
votes
5
answers
137k
views
Webdriver Check if Checkbox is Set and Set it if Not
I am learning Webdriver with JUnit by going through Alan Richardson's Selenium Simplified book and taking translating the exercises/tests from Selenium RC to Webdriver. So far, this has proven to be ...
3
votes
1
answer
6k
views
Unable to run cucumber tests from command line
I know this is the most common question but sorry I am posting this again as I tried all the solutions but couldn't solve the issue,
Problem: I am unable to run my cucumber tests through maven and ...
3
votes
2
answers
19k
views
How to handle InvalidElementStateException in Selenium?
I want to type 'calculator' on google text box so for that i wrote below code, its execute fine but there is 'InvalidElementStateException' message display so please help me how to solve that problem. ...