Questions tagged [junit]

JUnit is a unit testing framework for the Java programming language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
476 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....
javabeginer's user avatar
0 votes
0 answers
52 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) ...
DinaD's user avatar
  • 13
0 votes
1 answer
275 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....
DinaD's user avatar
  • 13
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. <!-- ...
user50964's user avatar
0 votes
1 answer
391 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' ...
Hareesha Hilmi's user avatar
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 ...
Santosh Hegde's user avatar
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 ...
andres tamayo's user avatar
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 ...
Anjani Kumar's user avatar
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. ...
Mornon's user avatar
  • 1,107
0 votes
1 answer
909 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 ...
user11702680's user avatar
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 ...
Ashutosh Singh's user avatar
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 ...
user2869520's user avatar
-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 ...
Rebeka Montana's user avatar
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? ...
user11702680's user avatar
0 votes
2 answers
872 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.
Haider Yaqoob's user avatar
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 ...
Akshay Dongar's user avatar
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: ...
dimsonQA's user avatar
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 ...
ps0604's user avatar
  • 131
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 ...
lucasso's user avatar
  • 19
1 vote
3 answers
266 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 ...
lucasso's user avatar
  • 19
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 = "...
dddeee's user avatar
  • 3
-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?
Juanm's user avatar
  • 1
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 ...
Mornon's user avatar
  • 1,107
-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 ...
Syrus's user avatar
  • 1,197
-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); ...
Champ-Java's user avatar
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.
Vel Guru's user avatar
  • 526
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 ...
Vijay Gupta's user avatar
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 ;...
Ashu123's user avatar
  • 111
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?
Zen's user avatar
  • 13
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 ...
Classified's user avatar
0 votes
1 answer
59 views

PhoneGap Android App Automation with Appium

I am using JUnit to make automation test , the context is changed to hybrid App , after tests I`m making output excel file with the result. I am new to the automation and found a way if something is ...
RosS's user avatar
  • 103
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 ...
Shilpa's user avatar
  • 1
-1 votes
1 answer
247 views

How to do unit test of 16 digit Generated Random number [closed]

Here i'm facing one problem that i have to do unit testing of 16 Digits of Generated Random( 9872 5432 8765 0987, 9852 7412 6587 2365.........n) number so these Random Number are generated from Sql ...
SQA's user avatar
  • 119
-3 votes
1 answer
3k views

java.lang.NullPointerException when running a testcase via Selenium webDriver in Chrome

There is my code: LoginPage Class: public class LoginPage { private WebDriver driver; public LoginPage(WebDriver driver) { this.driver = driver; } private By loginField = ...
Nazar's user avatar
  • 41
0 votes
4 answers
9k views

Cucumber test suite: how to pass username and password without hardcoding

I'm building a test suite with Cucumber on Java + Maven + jUnit and I need to pass a username and a password to the test suite so it can log in to the application under test. I don't like the idea of ...
Floella's user avatar
  • 319
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 ...
LaxmiMaddali's user avatar
2 votes
2 answers
611 views

JUnit Assert's message equivalent implementation using Selenium Webdriver's wait method

In JUnit's assertions you have an optional parameter which allows you to to display it when the assertion fails, to allow the tester know what actually failed from a human-friendly perspective. Is ...
gvasquez's user avatar
  • 269
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 ...
SQEnthusiast's user avatar
1 vote
1 answer
255 views

Junit Setup & Teardown when using parallel cucumberJVM with auto generated test runner files

Scenario: I am using a cucumberJVM setup using a parallel cucumberJVM plugin which creates separate runner files for every feature file. I want to handle my setup & teardown independently, since ...
symon's user avatar
  • 934
3 votes
1 answer
646 views

Uncertain as how to test complex method

I have a class which handles when a CardView's drag gets started. I've been looking at tutorials for JUnit and I can't seem to find out how to start testing this method. public class ...
Vinagy's user avatar
  • 33
1 vote
0 answers
188 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 ...
gvasquez's user avatar
  • 269
1 vote
2 answers
598 views

How to reduce Phantom js test execution time for selenium junit test cases

I am using phatnom js driver for my selenium test cases to overcome the headache of chrome driver.I see it is taking lot of time to execute the test cases.I tried html diver prior to phantom.Since ...
Pradeep's user avatar
  • 171
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. ...
mdriver's user avatar
  • 35
3 votes
4 answers
2k views

Unable to locate element as ID changes after refreshing the in Ebay login page

Using JUnit I'm attempting to automate the eBay login. I cannot select the email/username field because field changes id on refresh. Any ideas? input size="40" maxlength="64" name="962970435" id="...
mdriver's user avatar
  • 35
2 votes
1 answer
2k views

Attaching screenshots to JUnit test reports

We run our tests on Jenkins using Protractor generating a JUnit XML test report via JUnitXmlReporter from jasmine-reporters. Is it possible to attach screenshots, with the current state of an ...
alecxe's user avatar
  • 11.4k
3 votes
3 answers
1k views

How to reduce the time of our regression tests - interview question

I recently attended an interview and they asked me: How do you reduce the time of your regression suite? I answered that we trigger only the high level jobs and rest of of our regression we do ...
LaxmiMaddali's user avatar
1 vote
0 answers
572 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 ...
MikeG's user avatar
  • 85
3 votes
0 answers
1k views

How to run same test case in different browsers in Cucumber using Java

New to automation and Cucumber. I have a .feature test case (a simple login function) that I would like to run in multiple browsers in parallel. I want to store the browser properties in a global ...
Guest1234's user avatar
1 vote
1 answer
373 views

Is throwing custom exceptions by test an anti-pattern?

Sometimes, I can see the tests written like that public void shouldDoX() throws SomeCustomException { ... I think throwing custom exceptions is an anti-pattern because it makes analysis of the test ...
dzieciou's user avatar
  • 10.5k
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 = {"...
SanchelliosProg's user avatar