Questions tagged [junit]

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

Filter by
Sorted by
Tagged with
-3
votes
1answer
44 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 ...
0
votes
1answer
44 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
2answers
62 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.
0
votes
1answer
95 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 ...
2
votes
2answers
63 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: ...
2
votes
2answers
152 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 ...
0
votes
1answer
27 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 ...
1
vote
3answers
139 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
2answers
35 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
1answer
31 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
3answers
94 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
1answer
67 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 ...
-1
votes
1answer
719 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); ...
1
vote
1answer
421 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.
1
vote
1answer
29 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
0answers
85 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 ;...
1
vote
4answers
883 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?
5
votes
4answers
307 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
1answer
54 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 ...
0
votes
2answers
477 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 ...
-1
votes
1answer
103 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 ...
-3
votes
1answer
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 = ...
0
votes
4answers
4k 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 ...
2
votes
1answer
4k 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 ...
2
votes
2answers
446 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 ...
-1
votes
1answer
59 views

Multiple browser support

Currently, our automation suite runs on chrome (has been designed for chrome). We used cucumber with Java and Selenium. We are trying to make the current automation suite multi-browser compatible. The ...
2
votes
1answer
77 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
1answer
158 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 ...
2
votes
1answer
435 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 ...
1
vote
0answers
152 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 ...
1
vote
2answers
484 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 ...
0
votes
1answer
82 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. ...
3
votes
4answers
832 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="...
2
votes
1answer
1k 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 ...
2
votes
3answers
841 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 ...
1
vote
0answers
320 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 ...
2
votes
0answers
937 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 ...
1
vote
1answer
256 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 ...
2
votes
0answers
2k 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 = {"...
0
votes
0answers
266 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 ...
0
votes
6answers
2k 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 ...
-1
votes
1answer
1k views

How to skip test cases in a JUnit testsuite?

I have created a JUnit test suite that has multiple test cases. A couple of these are for functionality that are currently under implementation. I want to skip these test cases. How do I skip tests ...
0
votes
2answers
87 views

How can I create an @After class that may or may not need to click a delete button?

I am working with some software that schedule reports to go out to clients. Sometimes in running my selenium tests something goes wrong and it does not delete the instance once it is done with it. I ...
0
votes
4answers
18k 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 ...
3
votes
2answers
530 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 ...
1
vote
0answers
22 views

Is it possible for junit and java application to share same sessionFactory? [closed]

I have a Java application(developed using frameworks spring and hibernate) and a JUnit test case for testing the email function. Can I get sessionfactory value when I call a method in Java class from ...
1
vote
1answer
877 views

How to execute selenium webdriver test cases parallely in multiple browser using IntelliJ + JUnit + Java

I wanted to run the test scripts in multiple browsers. Ideally Chrome, FFox, IE11, Opera and Safari. How would be ideal to be able to run that? Here's my stack. IntelliJ + JUnit + Java Any ideas, ...
2
votes
2answers
12k 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. ...
3
votes
2answers
2k views

How to generate test cases for JUnit?

Explanation We are currently using a self-made testing framework/tool, to test services of an client-server application. The framework currently works with own implemented JUnit like assert methods ...
6
votes
2answers
28k views

What is the difference between jUnit & TestNG?

I have started Selenium scripting in my one of the project and I want to know the exact difference between Junit & TestNG. Which one is useful for Tester in Selenium? Any reference link/Site for ...