This talk is based on heated discussions about the syntax of asserts. Do you like the good old `assertNotEquals(id, c.getId())` or do you prefer something fancier like `assertThat(id, is(not(equalTo(c.getId()))))`?
We will take a quick look at the differences between asserts in JUnit, TestNG, Hamcrest, fest, AssertJ, and Spock. This topic is at least as important as Vim vs Emacs and tabs vs spaces!
Topic: Software engineering practices
Language: English
Connect python application with postgreSQL database using psycopg2.
Perform DDL & DML operations
Create table , Insert/update/delete and select records
Understand connection & cursor class
This talk is based on heated discussions about the syntax of asserts. Do you like the good old `assertNotEquals(id, c.getId())` or do you prefer something fancier like `assertThat(id, is(not(equalTo(c.getId()))))`?
We will take a quick look at the differences between asserts in JUnit, TestNG, Hamcrest, fest, AssertJ, and Spock. This topic is at least as important as Vim vs Emacs and tabs vs spaces!
Topic: Software engineering practices
Language: English
Connect python application with postgreSQL database using psycopg2.
Perform DDL & DML operations
Create table , Insert/update/delete and select records
Understand connection & cursor class
Building responsive application with Rx - confoo - tamir dresherTamir Dresher
Code examples can be found here: https://github.com/tamirdresher/Rx101
Reactive applications are designed to handle asynchronous events in a way that maximizes responsiveness, resiliency, and elasticity. Reactive Extensions (Rx) is a library that abstracts away the sources of events and provides tools to handle them in a reactive way.
With Rx, filtering events, composing event sources, transforming events, and dealing with errors all become much simpler than with traditional tools and paradigms.
Building responsive applications with Rx - CodeMash2017 - Tamir DresherTamir Dresher
Slides from the CodeMash 2017 conference: http://www.codemash.org/session/creating-a-responsive-application-using-reactive-extensions/
Code example are here: https://github.com/tamirdresher/Rx101
Rx 101 Codemotion Milan 2015 - Tamir DresherTamir Dresher
Slides from my talk about Reactive Extensions (Rx) fundamentals from Codemotion Milan 2015 conference. The demos and other samples can be found in the github repository: https://github.com/tamirdresher/Rx101
Introduction to Reactive Extensions (Rx)Tamir Dresher
Presentations from the june meeting of IDNDUG
http://ariely.info/Communities/IDNDUG/IDNDUG19thJune2013/tabid/171
The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, andparameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers
Hamcrest is a library for creating matchers for usage in unit tests, mocks and UI validation. This talk gives a brief introduction to using and writing Hamcrest matchers.
The topics covered:
* Basic introduction to Hamcrest
* Using Matchers in assertions
* Using Matchers with Mockito
* Writing custom matchers
* Ad-hoc matchers
Building responsive application with Rx - confoo - tamir dresherTamir Dresher
Code examples can be found here: https://github.com/tamirdresher/Rx101
Reactive applications are designed to handle asynchronous events in a way that maximizes responsiveness, resiliency, and elasticity. Reactive Extensions (Rx) is a library that abstracts away the sources of events and provides tools to handle them in a reactive way.
With Rx, filtering events, composing event sources, transforming events, and dealing with errors all become much simpler than with traditional tools and paradigms.
Building responsive applications with Rx - CodeMash2017 - Tamir DresherTamir Dresher
Slides from the CodeMash 2017 conference: http://www.codemash.org/session/creating-a-responsive-application-using-reactive-extensions/
Code example are here: https://github.com/tamirdresher/Rx101
Rx 101 Codemotion Milan 2015 - Tamir DresherTamir Dresher
Slides from my talk about Reactive Extensions (Rx) fundamentals from Codemotion Milan 2015 conference. The demos and other samples can be found in the github repository: https://github.com/tamirdresher/Rx101
Introduction to Reactive Extensions (Rx)Tamir Dresher
Presentations from the june meeting of IDNDUG
http://ariely.info/Communities/IDNDUG/IDNDUG19thJune2013/tabid/171
The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using LINQ operators, andparameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers
Hamcrest is a library for creating matchers for usage in unit tests, mocks and UI validation. This talk gives a brief introduction to using and writing Hamcrest matchers.
The topics covered:
* Basic introduction to Hamcrest
* Using Matchers in assertions
* Using Matchers with Mockito
* Writing custom matchers
* Ad-hoc matchers
Using xUnit as a Swiss-Aarmy Testing ToolkitChris Oldwood
Modern Unit Testing practices act as a conduit for improved software designs that are more amenable to change and can be easily backed by automation for fast feedback on quality assurance. The necessity of reducing external dependencies forces us to design our modules with minimum coupling which can then be leveraged both at the module, component and subsystem levels in our testing. As we start to integrate our units into larger blocks and interface our resulting components with external systems we find ourselves switching nomenclature as we progress from Unit to Integration testing. But is a change in mindset and tooling really required?
The xUnit testing framework is commonly perceived as an aid to Unit Testing but the constraints that it imposes on the architecture mean that it is an excellent mechanism for invoking arbitrary code in a restricted context. Tests can be partitioned by categorisation at the test and fixture level and through physical packaging leading to a flexible test code structure. Throw in its huge popularity and you have a simplified learning curve for expressing more that just unit tests.
Using scenarios from his current system Chris aims to show how you can use a similar format and tooling for unit, component and integration level tests; albeit with a few liberties taken to work around the inherent differences with each methodology.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
3. DIVE INTO THE HISTORY
3
Let’s look over the philosophy of software
testing 100 years ago.
4. DIVE INTO THE HISTORY
Debugging
4
Automated
Testing
Manual Testing
SUnit(1989)
JUnit(2001)
1970’s1950’s
5. DIVE INTO THE HISTORY5
Kent Beck: 1989: "Simple Smalltalk Testing: With Patterns"
6. ”
Software testing it the complex of
techniques include the process of executing
a program or application with the intent of
finding software bugs.
6
7. PLACE OF UNIT TESTS
7
Let’s find place of unit tests in the ocean of
Software Testing.
10. UNIT TESTS
10
Unit tests – part of code that are designed
to ensure the smallest divisible pieces of
code (units or components) are working
the way they were intended.
11. UNIT TESTS
@BeforeClass
public void testBeforeSuite() {
prepareMailService();
}
@Test(groups = "mail")
public void testEmailService() {
MailService service= generateMailService();
Assert.assertNotNull(service);
}
@Test(dependsOnMethods = { "testMailService" }, groups="mail")
public void testSending() {
MailService service= generateMailService();
Assert.assertTrue(service.sendMail(subject, message));
}
11 Test
Configuration
Preparations
Assertions
Grouping
12. UNIT TESTS
Test - part of code, that check logic of another part of code.
Assertions - mechanism for checking results of lome logic,
defines if our unit test will be success or failed.
Configuration - all attributes and properties of test.
Preparations - part of code, that prepares state and context for our tests.
12
13. UNIT TESTS
Grouping - associates unit tests into groups and suites. Each group or suite should
have common property or characteristic.
13
GROUP SUITE
Contains Methods
Depends on Groups
Annotations Config
Runs Separately
Contains Groups
Flex Configuring
Configuration in XML
Runs Separately
15. UNIT TESTS
Test Dependencies. If a dependent method is fail, all the subsequent test methods
will be skipped, NOT failed.
@Test(groups = "mail")
public void testEmailService() {
MailService service= generateMailService();
Assert.assertNotNull(service);
}
@Test(dependsOnMethods = { "testMailService" }, groups="mail")
public void testSending() {
MailService service= generateMailService();
Assert.assertTrue(service.sendMail(subject, message));
}
15
16. UNIT TESTS
Parameterized Tests. Run your single test for different data sets.
@DataProvider
public Object[][] smtpHosts() {
return new Object[][]{ {"smtp.host1"}, {"mail.host2"} };
}
@Test(dataProvider = "smtpHosts", groups="mail")
public void testSending(String host) {
MailService service= generateMailService(host);
Assert.assertTrue(service.sendMail(subject, message));
}
16
21. ARCHITECTURE OF PROJECT21
Let’s imagine component for sending emails, and try to cover it with unit tests.
Services:
▹ MailService - service for sending emails. Based on Javax Mail.
▹ LogsStorage - service for collecting logs about mails sending and flushing it
to persistent storage.
▹ LogsMailService - service for work with emails and logs.
22. PRINCIPLES OF UNIT TESTS
// Bad
@Test(groups = "mail")
public void testEmailSending() {
MailService service= generateMailService();
Assert.assertNotNull(service);
MailBuilder builder= new MailBuilder();
Mail mail = new MailBuilder().
.newMail()
.addSubject("my mail")
.addRecipient(firstRecipient)
.addRecipient(secondRecipient)
.build();
Assert.assertNotNull(mail);
Assert.assertEquals(EXPECT, mail.getSubject());
...
Assert.assertTrue(service.sendMail(mail));
}
22
// Good
@BeforeTest
public void initialize() {
service= generateMailService();
}
@Test(groups = "mail")
public void testEmailSending() {
Assert.assertTrue(
service.sendMail(prepareMail())
);
}
Unit & Simple - each test covers one piece of code.
23. PRINCIPLES OF UNIT TESTS
// Bad
@Test(groups = "mail")
public void testEmailLogsSuccessful() {
mailLogsStorage.logGood();
Assert.assertEquals(1, mailLogsStorage.getCountGood());
Assert.assertEquals(1, mailLogsStorage.getCountAll());
}
@Test(groups = "mail")
public void testEmailLogsFailed() {
mailLogsStorage.logBad();
Assert.assertEquals(1, mailLogsStorage.getCountBad());
Assert.assertEquals(2, mailLogsStorage.getCountAll());
}
23
// Good
@Test(groups = "mail")
public void testEmailLogsSuccessful() {
mailLogsStorage.logGood();
Assert.assertEquals(1, mailLogsStorage.getCountGood());
Assert.assertEquals(1, mailLogsStorage.getCountAll());
}
@Test(groups = "mail")
public void testEmailLogsFailed() {
mailLogsStorage.logBad();
Assert.assertEquals(1, mailLogsStorage.getCountBad());
Assert.assertEquals(1, mailLogsStorage.getCountAll());
}
@AfterMethod
public void cleanAfter() {
mailLogsStorage.cleanState();
}
Independent - test should runs with random order and in parallel.
24. PRINCIPLES OF UNIT TESTS
// Bad
@BeforeTest
public void initialize() {
service= generateMailService();
}
@Test(groups = "mail")
public void testEmailSending() {
Assert.assertTrue(
service.sendMail(prepareGoodMail())
);
}
24
// Good
@BeforeTest
public void initialize() {
service= generateMailService();
}
@Test(groups = "mail")
public void testEmailSendingSuccess() {
Assert.assertTrue(
service.sendMail(prepareGoodMail())
);
}
@Test(groups = "mail")
public void testEmailSendingFailed() {
Assert.assertFalse(
service.sendMail(prepareBadMail())
);
}
Checking all cases - tests for success case is not enough.
25. PRINCIPLES OF UNIT TESTS
// Bad
@Before
public void before() {
service = new LogMailService();
service.setMailService(new MailService());
}
@Test(groups = "mail")
public void testEmailService() {
Assert.assertTrue(service.sendMail(mail));
}
25
// Good
@Before
public void before() {
service = new LogMailService();
}
@Test(groups = "mail")
public void testEmailService() {
MailService mock = mock(MailService.class)
when(mock.sendMail(mail))
.thenReturn(true);
service.setMailService(mock)
Assert.assertTrue(service.sendMail(mail));
times(1, mock.sendMail(mail));
}
Isolate - encapsulated logic should be covered with separated tests.
26. ISOLATION PHILOSOPHY
26
Mocking - creating objects that simulate
the behaviour of real objects to isolate
part of code for unit testing.
28. ISOLATION PHILOSOPHY28
Mocks - simulated objects that mimic the behavior of real objects in controlled
ways.
Partial mocks - object, created as shell for real one, when you need to stub
several methods of an object leaving the remainder free to respond to calls
normally.
29. ISOLATION PHILOSOPHY29
@Before
public void before() {
service = new LogMailService();
}
@Test
public void testEmailService() {
MailService mock = mock(MailService.class)
when(mock.sendMail(mail))
.thenReturn(true);
service.setMailService(mock)
Assert.assertTrue(service.sendMail(mail));
times(1, mock.sendMail(mail));
}
Mocks
32. ISOLATION PHILOSOPHY
What if… we have private factory method?
Class MailService {
...
private Session createMailSession() {
...
}
}
32
33. ISOLATION PHILOSOPHY
Use dark power of
33
OR.. create a new class and move all private methods to this as
public. Use dependency injection and mocking. This can force you to
use an unwanted design. Private methods are not an option.
34. ISOLATION PHILOSOPHY
What if… we have calls to static method of framework?
Class MailService {
...
public Session sendMail() {
...
// Send message
Transport.send(message);
}
}
34
35. ISOLATION PHILOSOPHY
Use dark power of
35
OR... wrap all static method calls in a separate class and use
dependency injection to mock this object. This will create an extra
layer of unnecessary classes in your application. However, this can
of course be useful if you want to encapsulate the framework to be
able to replace it.