Comments (7)
TestContext is created before test is executed and gets injected as method parameter to all test actions. So if you want to access the context you should add a test action like this:
action(new AbstractTestAction() { ... });
Each test action has a execute method with TestContext as method parameter. You can add your custom logic the inside the test action execute method.
Hope this helps.
from citrus.
Hi @christophd,
yes, this is clear and this is why I build an retriveVariable(String)
method to get variables from the test context. Are you not willing to just make more information protected
to make the framework more extentable for me?
Cheers,
Andreas
from citrus.
This is not a matter of me being willing to do something or not. We should just discuss the need for some new extension point to the framework. Can you please tell me more about your use case scenario?
Maybe I am also giving you more insight to my thoughts: I am thinking that test runner is able to provide protected access to the test context itself quite easy while test designer would have more problems to do so. This is because of designer's nature to just build and prepare all actions before execution.
Citrus offers both test runner and test designer implementation that should be kept more or less equal in capabilities. I would not be happy with test runner giving access to test context while test designer is not. So I have to look at the designer if I can provide access to the context as well. Let me check this
from citrus.
Ok, this is understandable and a worth thing to think about, consistency over the different approaches. My use cases at the moment are described above and there are not more yet. But I am at the beginning of using Citrus for our E2E-Service-Integration tests. I think we will have to write a lot of custom actions to satisfy our needs and as soon as encounter another problem due to extensibility, I can update this issue.
from citrus.
I had a look at this and cam up with a solution via resource injection. So the test context instance can be injected to your test method. I will be very happy to receive your feedback. Read about it here: http://citrusframework.org/reference/html/index.html#testcase-context-injection
By the way Citrus 2.5 has been released today and this feature is accessible in that release
from citrus.
Hi @christophd, I really like the feature :-) really - even if it will not help that much for the above required extendability. As I have already mentioned, I will gather more experience and come back to you if I will have a more concreate idea.
You can close that ticket if you do not want to implement the RetrieveVariableAction
yourself (or I can create a pull request for it if you want). I know that this feature is just useful using the test runner implementation, getting same variables out of the test context and being able to assert them using normal AssertJ, JUnit, Hamcrest or whatever else assertions ;-)
from citrus.
But is it possible that AssertionException
s of any of the above mentioned libraries are ignore by Citrus. Haven't hat time to look at it in detail but it seems so ;-)
from citrus.
Related Issues (20)
- Test-Context Error handling is not graceful
- Static Access Required for BeanFactoryPostProcessor Bean in CitrusSpringConfig
- update cucumber documentation
- Citrus kafka functionality maven dependency HOT 6
- Issue receiving kafka messages via the same endpoint for multiple tests (quarkus) HOT 2
- Junit parallel test HOT 4
- NullPointerException. Cannot invoke "org.apache.hc.client5.http.io.ManagedHttpClientConnection.isConsistent()" because "conn" is null HOT 3
- HttpServer in kubernetes HOT 3
- Ensuring Unique Message IDs in Citrus Templates for Reliable Test Correlation
- Json transformation with conditions HOT 1
- Citrus for java 11 does not support later versions of TestNG HOT 8
- Binary message not the same as documentation?
- Creating an API Testing Tool for OpenAPI Specifications
- Revert JsonArray order validation
- Improve Test API Code Generator for usage in Java
- Enable Test API Generator for WSDL
- OpenAPI payload in request body has wrong date format
- OpenAPI request always generates random data, even if a body is specified
- NPE when OpenAPI declares a response header without required attribute HOT 1
- remove author headers from source files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from citrus.