Questions tagged [junit]

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

Filter by
Sorted by
Tagged with
-1
votes
1answer
49 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
171 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); ...
0
votes
1answer
47 views

How to Embed / Attach screenshots when each step is executed in Cucumber

I need to take screenshots after each Steps execution and embed them in the results.i have tried in using the "After" method but its capture only the last screen and displaying in the end of the ...
0
votes
0answers
13 views

Check file generated in Selenium IE [duplicate]

Need to check file is generated. For example, If one filter is given it will generate file in minute, if we give more than one filter then it will take more time. How to do that is selenium and junit
1
vote
1answer
27 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
61 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
560 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
112 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
49 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
359 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
92 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
2k 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
3k 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 ...
1
vote
1answer
3k 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
403 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
56 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
70 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
109 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
279 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
133 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
410 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
74 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. ...
2
votes
4answers
629 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
938 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
733 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
264 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
849 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
191 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
1k 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
240 views

Junit Report Generate

I am using eclipse kepler for the generate testcases 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
1k 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
82 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
15k 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
396 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
821 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, ...
1
vote
2answers
9k 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. ...
2
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
23k 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 ...
2
votes
1answer
958 views

Selenium: Isolating Assert Fail in Excel Data Driven Loop

Firstly I would like to point out that I'm a beginner when it comes to selenium so I apologise if this is not presented appropriately. I would like to incorporate data driven testing into my ...
1
vote
3answers
1k views

I need to run a project build using selenium webdriver/maven/junit with jenkins

I have a selenium webdriver live project build using maven and junit framework. I want to run this using jenkins. I google searched but was able to find information when the project is build using ...
2
votes
2answers
302 views

Which test execution framework for Java has the highest test coverage?

I found TestNG failing occasionally and when I started to investigate I found it has little test coverage. It looks like the test framework itself is poorly tested. Which other test execution ...
1
vote
2answers
5k views

How to run Junit test methods in parallel?

I need to run Junit test methods in a Class parallelly to save time using Threads. I have added the following code in my pom.xml file after referring to a website. please let me know what the next ...
0
votes
1answer
65 views

Is this a good idea to test if text messages are exactly what they are?

I have been told that testing java exceptions' messages is a good thing, but it looks so much like redundancy that I cannot believe it. Consider following fictional code: public class ...
5
votes
5answers
531 views

What should I learn next as QA

I have been working as a software tester for the last 4 years. I have the following skills and day job experience: 1 - Manual Testing of websites & Mobile Applications. 2 - Automation using ...
1
vote
1answer
50 views

How to avoid hidden bugs caused by test doubles?

I just got the Mockito framework for Java to try out mocking with JUnit. Trying it brought me to a basic question that I am sure is obvious but I have had trouble finding any answer for, probably ...
1
vote
1answer
5k views

Using tagged hooks to run tests with different browsers

I've looked at resources like here and here, but these solutions are not working for me. What I want to do: without involving much heavy machinery (unless I have to) and without using a third-party ...
1
vote
1answer
994 views

Change the title of a webpage in JUnit test with Selenium Web Driver

I want to write an automated JUnit test script with Selenium Web Driver to load a Wikipedia page and then change the title of the page loaded. import java.util.regex.Pattern; import java.util....
1
vote
3answers
903 views

Is it worth it to learn an automated testing software as a Java web developer?

I want to learn Selenium web driver (or JUnit), but I'm hesitating on whether to learn it or not because my work is not focused on testing. I do maintain and develop Java web based applications and as ...