A test suite has been developed using WebDriver and JUnit4. Its working fine, but now we need to integrate test suite with Jmeter for load testing. The problem is that the classes use the Annotation of "#RunsWith" to test a test case with multiple inputs and JMeter does not support this annotation.
Is there any workaround available ? (I could not find any, but may be some one has tried something)
Is this really a good approach, to first write test cases using web driver
Maybe, you just has old version of JMeter that works only with JUnit 3.x. In such a case you have only 2 choses: rewerite your JUnit in 3.x style or upgrade JMeter.
Related
Is it possible to create tests in JUnit and initialize javafx components like linecharts?
Yes, take a look at TestFX, it supports JUnit 4 and JUnit 5. Haven't seen recent active development on the project, but it works if you aren't looking for very complex tests.
I'm trying to migrate my project to use Junit5. So far I've been using a class "LogSpy" that basically intercepts and saves all the logs so they can be tested easily. Using Junit4 and Spock test I was able to initialize my log interceptor class by using the #Rule annotation (even though it is in a Spock test). After migrating to Junit5 this annotation doesn't seem to initialize the needed log interceptor class and I can't find the reason why. Why did this happen? What are the differences between Junit4 and 5 regarding the #Rule annotation? Is there a way around this issue?
This is how I initialize the LogSpy class. It initializes in JUnit unit tests but not in Spock tests.
#Rule
public LogSpy logSpy = new LogSpy()
From the release notes
JUnit 4 Rules are not supported by spock-core anymore, however, there is a new spock-junit4 module that provides best effort support to ease migration.
In short add the spock-junit4 dependency, if you still need to use JUnit 4 rules.
In the long term, I would suggest to migrate to Spock native extensions.
I have written a Test framework (that supports Selenuim).
The way it works is such that when I create a test I only have to extend the base class..
class NewTest extend BaseTest {
#Test
public ABC() {
this.sel.driver. ....
}
}
My question is how to integrate Cucumber into my framework, where the Framework is the provider of the Selenium driver, db connections,screenshots, ...etc
The idea is to make it in a way that it does not interfere with the Cucumber normal flow of programming.
Also I'm using maven and junit.
#Test is for Junit not for cucumber.
Cucumber using gherkin language
You can check the setup and usage of cucumber from below tutorial
https://www.toolsqa.com/cucumber-tutorial/
My question is how to integrate Cucumber into my framework, where the
Framework is the provider of the Selenium driver, db
connections,screenshots, ...etc
Just create an package and add your classes like db, selenium etc into it, call them in script as we did in normal framework.
Note that cucumber just provide a flow to run the project from feature and using hook. so learn and did poc in cucumber and you will understand where you need to call what.
I am doing load test on my server and using JMeter. Do I have any difference choice??
How can I do integration test and How can I do it? Is there any tool?
I know the concept but I dont know how to apply on my project.
My company required me to do a report on load test. Is there any standard on testing? Such as need to use 50 people access and plot the graph of response time?
Sorry I am new to System analyst.
Junit is a framework to support test cases it doesn't provide the tests themselves.
Load testing tends to be specific to the application so you can use JUnit to support that
but you will have to write the tests yourself.
you could look at jMeter or LoadUI
On the one side, there is a new #RunWith annotation that lets to change unit test framework on the fly.
But on the other side Spring documentations says about org.springframework.test.annotation.ExpectedException:
#deprecated as of Spring 3.1 in favor of using built-in support for declaring expected exceptions in the underlying testing framework (e.g., JUnit, TestNG, etc.)
As a result my code will depend on the unit test framework. Please explain it.
And the 2nd question. At the moment I implement tests with Spring #RunWith annotation. But I also add the jUnit specific org.junit.Test annotation to each test method. Again, if I understand correctly the best way - to write tests, so I could change for example jUnit onto TestNg. And Spring #RunWith helps me to do that. But how can I avoid using of the org.junit.Test annotation?
#RunWith isn't a Spring annotation. It's a JUnit one. It doesn't let you switch between JUnit and TestNG, as you seem to think. Instead, it lets you run JUnit tests in different ways, like with the addition of the Spring Test Framework. In that framework, Spring has provided ExpectedException for some time, but it's no longer needed because recent versions of both JUnit and TestNG provide that functionality now.
You cannot write a test which can run on both JUnit and TestNG, so your code is bound to be dependent on testing framework. #RunWith is not a Spring's annotation for running tests with different testing frameworks, it belongs to JUnit and used to run JUnit with other runners like SpringJUnit4Runner to extend JUnit functionality