1666933920
Chrome extension to generate UI unit/integration tests for solidjs
You can also use it for react or preact with little config tweaks.
Writing UI tests is boring yet extremely important. This extension is meant to make it more fun and attract developers to write more tests.
First, you need to build it.
You can use Docker:
$ docker-compose up
$ docker exec -it docker solid_test_recorder yarn build
or run these on your machine:
$ yarn install
$ yarn build
Then, upload /dist directory as an unpacked extension. See this link.
As soon as you open Chrome DevTools, in console, you'll get access to $str
(Solid Test Recorder) global var. You can execute $str.help
command for available commands.
The usual flow would be:
$str.clear // to start new test file
$str.describe = 'my component'
$str.it = 'should do something'
$str.expect.toBeInTheDocument = true // use element inspector to choose the element, assert type and whether it's positive or negation
You'll be also often capturing events e.g.:
$str.capture.click // or any available DOM event
// click at the button in the browser
$str.stopCapturing
// and then again...
$str.expect.toBeChecked = false // or any availble assert type in testing library
To see the results which will open as 2 vertical editors:
$str.seeResult // to close $str.closeEditor
In the first one you'll see your test file, and the second is API mock data generated from the actual network requests.
In order to use the test, your setupVitest.ts
in the root directory should look like this and you should create a ./test/mocked-requests.json
file.
.
├── test
│ └── mocked-requests.json
└── setupVitest.ts
Configuration: | |
$str.config.codeTemplates | allows to edit the code template used when generation test file |
$str.config.excludedRequests | allows to specify list of URLs to ignore when capturing requests |
Testing: | |
$str.describe | creates a new test file with a given description |
$str.it | creates a new test case with a given description |
$str.expect.* | adds a new asser on a currently selected element |
$str.capture.* | starts event capturing i.e. auto-generation user events and subsequent requests |
$str.stopCapturing | stops event capturing |
$str.seeResult | opens editor with a generated test file and request mock |
$str.editTest | allows to reposition or remove test cases and test steps and setting their active cursors |
Changing current test file/case: | |
$str.use.file | allows to switch to a given test file |
$str.use.case | allows to switch to a given test case |
Controlling editor: | |
$str.applyChanges | saves changes and closes editor(s) |
$str.closeEditor | discards any changes and closes editor(s) |
Data collections: | |
$str.$requests | captured HTTP requests |
$str.$files | test files |
$str.$cases | test cases |
Dangerous:
$str.clear
- removes all the test data
Visit solidjs discord channel where I'll be posting updates. Don't hesitate to DM for any questions related to the project.
The codebase needs to be converted to TypeScript before it can be workable by a team. Also, I have an idea how to e2e test it, and this would also need to happen before any major logic changes. Anyway, feel free to create issues and PRs, just want to highlight the priorities.
Author: chris-czopp
Source Code: https://github.com/chris-czopp/solid-test-recorder
License: MIT license
1596754901
The shift towards microservices and modular applications makes testing more important and more challenging at the same time. You have to make sure that the microservices running in containers perform well and as intended, but you can no longer rely on conventional testing strategies to get the job done.
This is where new testing approaches are needed. Testing your microservices applications require the right approach, a suitable set of tools, and immense attention to details. This article will guide you through the process of testing your microservices and talk about the challenges you will have to overcome along the way. Let’s get started, shall we?
Traditionally, testing a monolith application meant configuring a test environment and setting up all of the application components in a way that matched the production environment. It took time to set up the testing environment, and there were a lot of complexities around the process.
Testing also requires the application to run in full. It is not possible to test monolith apps on a per-component basis, mainly because there is usually a base code that ties everything together, and the app is designed to run as a complete app to work properly.
Microservices running in containers offer one particular advantage: universal compatibility. You don’t have to match the testing environment with the deployment architecture exactly, and you can get away with testing individual components rather than the full app in some situations.
Of course, you will have to embrace the new cloud-native approach across the pipeline. Rather than creating critical dependencies between microservices, you need to treat each one as a semi-independent module.
The only monolith or centralized portion of the application is the database, but this too is an easy challenge to overcome. As long as you have a persistent database running on your test environment, you can perform tests at any time.
Keep in mind that there are additional things to focus on when testing microservices.
Test containers are the method of choice for many developers. Unlike monolith apps, which lets you use stubs and mocks for testing, microservices need to be tested in test containers. Many CI/CD pipelines actually integrate production microservices as part of the testing process.
As mentioned before, there are many ways to test microservices effectively, but the one approach that developers now use reliably is contract testing. Loosely coupled microservices can be tested in an effective and efficient way using contract testing, mainly because this testing approach focuses on contracts; in other words, it focuses on how components or microservices communicate with each other.
Syntax and semantics construct how components communicate with each other. By defining syntax and semantics in a standardized way and testing microservices based on their ability to generate the right message formats and meet behavioral expectations, you can rest assured knowing that the microservices will behave as intended when deployed.
It is easy to fall into the trap of making testing microservices complicated, but there are ways to avoid this problem. Testing microservices doesn’t have to be complicated at all when you have the right strategy in place.
There are several ways to test microservices too, including:
What’s important to note is the fact that these testing approaches allow for asynchronous testing. After all, asynchronous development is what makes developing microservices very appealing in the first place. By allowing for asynchronous testing, you can also make sure that components or microservices can be updated independently to one another.
#blog #microservices #testing #caylent #contract testing #end-to-end testing #hoverfly #integration testing #microservices #microservices architecture #pact #testing #unit testing #vagrant #vcr
1620983255
Automation and segregation can help you build better software
If you write automated tests and deliver them to the customer, he can make sure the software is working properly. And, at the end of the day, he paid for it.
Ok. We can segregate or separate the tests according to some criteria. For example, “white box” tests are used to measure the internal quality of the software, in addition to the expected results. They are very useful to know the percentage of lines of code executed, the cyclomatic complexity and several other software metrics. Unit tests are white box tests.
#testing #software testing #regression tests #unit tests #integration tests
1666933920
Chrome extension to generate UI unit/integration tests for solidjs
You can also use it for react or preact with little config tweaks.
Writing UI tests is boring yet extremely important. This extension is meant to make it more fun and attract developers to write more tests.
First, you need to build it.
You can use Docker:
$ docker-compose up
$ docker exec -it docker solid_test_recorder yarn build
or run these on your machine:
$ yarn install
$ yarn build
Then, upload /dist directory as an unpacked extension. See this link.
As soon as you open Chrome DevTools, in console, you'll get access to $str
(Solid Test Recorder) global var. You can execute $str.help
command for available commands.
The usual flow would be:
$str.clear // to start new test file
$str.describe = 'my component'
$str.it = 'should do something'
$str.expect.toBeInTheDocument = true // use element inspector to choose the element, assert type and whether it's positive or negation
You'll be also often capturing events e.g.:
$str.capture.click // or any available DOM event
// click at the button in the browser
$str.stopCapturing
// and then again...
$str.expect.toBeChecked = false // or any availble assert type in testing library
To see the results which will open as 2 vertical editors:
$str.seeResult // to close $str.closeEditor
In the first one you'll see your test file, and the second is API mock data generated from the actual network requests.
In order to use the test, your setupVitest.ts
in the root directory should look like this and you should create a ./test/mocked-requests.json
file.
.
├── test
│ └── mocked-requests.json
└── setupVitest.ts
Configuration: | |
$str.config.codeTemplates | allows to edit the code template used when generation test file |
$str.config.excludedRequests | allows to specify list of URLs to ignore when capturing requests |
Testing: | |
$str.describe | creates a new test file with a given description |
$str.it | creates a new test case with a given description |
$str.expect.* | adds a new asser on a currently selected element |
$str.capture.* | starts event capturing i.e. auto-generation user events and subsequent requests |
$str.stopCapturing | stops event capturing |
$str.seeResult | opens editor with a generated test file and request mock |
$str.editTest | allows to reposition or remove test cases and test steps and setting their active cursors |
Changing current test file/case: | |
$str.use.file | allows to switch to a given test file |
$str.use.case | allows to switch to a given test case |
Controlling editor: | |
$str.applyChanges | saves changes and closes editor(s) |
$str.closeEditor | discards any changes and closes editor(s) |
Data collections: | |
$str.$requests | captured HTTP requests |
$str.$files | test files |
$str.$cases | test cases |
Dangerous:
$str.clear
- removes all the test data
Visit solidjs discord channel where I'll be posting updates. Don't hesitate to DM for any questions related to the project.
The codebase needs to be converted to TypeScript before it can be workable by a team. Also, I have an idea how to e2e test it, and this would also need to happen before any major logic changes. Anyway, feel free to create issues and PRs, just want to highlight the priorities.
Author: chris-czopp
Source Code: https://github.com/chris-czopp/solid-test-recorder
License: MIT license
1599859380
Nowadays API testing is an integral part of testing. There are a lot of tools like postman, insomnia, etc. There are many articles that ask what is API, What is API testing, but the problem is How to do API testing? What I need to validate.
Note: In this article, I am going to use postman assertions for all the examples since it is the most popular tool. But this article is not intended only for the postman tool.
Let’s directly jump to the topic.
Let’s consider you have an API endpoint example http://dzone.com/getuserDetails/{{username}} when you send the get request to that URL it returns the JSON response.
My API endpoint is http://dzone.com/getuserDetails/{{username}}
The response is in JSON format like below
JSON
{
"jobTitle": "string",
"userid": "string",
"phoneNumber": "string",
"password": "string",
"email": "user@example.com",
"firstName": "string",
"lastName": "string",
"userName": "string",
"country": "string",
"region": "string",
"city": "string",
"department": "string",
"userType": 0
}
In the JSON we can see there are properties and associated values.
Now, For example, if we need details of the user with the username ‘ganeshhegde’ we need to send a **GET **request to **http://dzone.com/getuserDetails/ganeshhegde **
Now there are two scenarios.
1. Valid Usecase: User is available in the database and it returns user details with status code 200
2. Invalid Usecase: User is Unavailable/Invalid user in this case it returns status with code 404 with not found message.
#tutorial #performance #api #test automation #api testing #testing and qa #application programming interface #testing as a service #testing tutorial #api test
1598916060
The demand for delivering quality software faster — or “Quality at Speed” — requires organizations to search for solutions in Agile, continuous integration (CI), and DevOps methodologies. Test automation is an essential part of these aspects. The latest World Quality Report 2018–2019 suggests that test automation is the biggest bottleneck to deliver “Quality at Speed,” as it is an enabler of successful Agile and DevOps adoption.
Test automation cannot be realized without good tools; as they determine how automation is performed and whether the benefits of automation can be delivered. Test automation tools is a crucial component in the DevOps toolchain. The current test automation trends have increased in applying artificial intelligence and machine learning (AI/ML) to offer advanced capabilities for test optimization, intelligent test generation, execution, and reporting. It will be worthwhile to understand which tools are best poised to take advantage of these trends.****
#automation-testing #automation-testing-tools #testing #testing-tools #selenium #open-source #test-automation #automated-testing