IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
This presentation discusses the following topics:
DBMS Architecture
Relational Algebra
Union and Differences
Selection
Projection
Cartesian Product
Renaming
Join
Limitations of Relational Algebra
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
This presentation discusses the following topics:
DBMS Architecture
Relational Algebra
Union and Differences
Selection
Projection
Cartesian Product
Renaming
Join
Limitations of Relational Algebra
C# - Constants and Literals. The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal.
A method is a code block that contains a series of statements. A program causes the statements to be executed by calling the method and specifying any required method arguments. In C#, every executed instruction is performed in the context of a method.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
C++ is an enhanced version of the C language. C++ includes everything that is part of C language and adds support for object oriented programming (OOP). With very few, very major exceptions, C++ is a superset of C
Structure and Enumeration are used as value type in c#.Value type variables store their data on the stack memory.An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword. C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
C# - Constants and Literals. The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal.
A method is a code block that contains a series of statements. A program causes the statements to be executed by calling the method and specifying any required method arguments. In C#, every executed instruction is performed in the context of a method.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
C++ is an enhanced version of the C language. C++ includes everything that is part of C language and adds support for object oriented programming (OOP). With very few, very major exceptions, C++ is a superset of C
Structure and Enumeration are used as value type in c#.Value type variables store their data on the stack memory.An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword. C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
This presentation provides an overview of key topics in Java class design; also covers best practices/tips and quiz questions. Based on our OCP 8 book.
Java Core | Concurrency in the Java Language and Platform | Fredrik OhrstromJAX London
2011-11-02 | 10:00 AM - 11:00 AM | Victoria
Oracle has initiated a renewal of Java and one of the more important goals is to make it easier to write concurrent software that makes use of all cores in modern hardware. This will require changes both to the language Java as well as its virtual machine. I will describe the latest design that we are working on and demonstrate what can be achieved today using the JRockit JVM and how we can improve concurrency in javac itself.
JCConf 2020 - New Java Features Released in 2020Joseph Kuo
In 2020, Java 14 and 15 are released with many great features, including ZGC, Shenandoah GC, helpful NullPointerExceptions, pattern matching for instanceof, switch expressions, text blocks, records, hidden classes, and sealed classes. They not only improve performance of GC and Java applications, but also introduce new syntax to ease our effort to write more readable and efficient code. Let's take a look at those features!
https://cyberjos.blog/java/seminar/jcconf-2020-new-java-features-released-in-2020/
Create the equivalent of a four function calculator. The program should request the user to enter a number, an operator, and another number. carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. (Using switch statement ).ThesisScientist.com
What is Pure Functional Programming, and how it can improve our application t...Luca Molteni
Pure functional programming is helping developers developing more robust and simpler programs, but it also helps them testing the behaviour of their application in a more predictable way. There are many different approaches to testing and verification of code, and we're constantly reconsidering the best approach to make our code solid, by leveraging concepts like referential transparency and purity to help us avoiding bugs. We explore the meaning of testing, by starting from the simple unit test, moving on to the property based testing and encoding our program invariants in types, with an introduction of some advanced type system concepts such as dependent types.
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences. For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely. This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
WildFly 8 application server
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
ANTLR educational slides. The slides provide a simple introduction to ANTLR, a parser generator and a language application development framework.
By Morteza Zakeri.
ANTLR educational slides. The slides provide a simple introduction to ANTLR, a parser generator and a language application development framework.
By Morteza Zakeri.
ANTLR educational slides. The slides provide a simple introduction to ANTLR, a parser generator and a language application development framework.
By Morteza Zakeri.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
IUST Advanced software engineering course by Dr. Saeed Parsa. Credits of slides belong to Dr. Saeed Parsa and IUST reverse engineering research laboratory. All slides are available publicly due to COVID 19 Pandemic.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
4. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 4
• Test driven development (TDD) is a software development approach.
• In TDD a test is written before writing the code.
• Once the new code passes the test, it is refactored to an acceptable
standard.
TDD ensures that the source code is thoroughly unit tested and leads
to modularized, flexible and extensible code.
TDD focuses on writing only the code necessary to pass tests, making
the design simple and clear.
5. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 5
• The test is written before testing the
functionality
• Ensures that the application is suitable for
testability.
• The functionality is implemented.
• This is referred to as "red green refactor.
• Red means fail and green shows a pass.
• These steps are repeated.
o The first goal of a programmer is to focus
on the task at hand and to pass it.
7. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 7
TDD can lead to more modularized, flexible, and extensible code
Clean code
Leads to better design
Better code documentation
More productive
Good design
8. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 8
My goal is for you to see the rhythm of test-driven development:
1. Quickly add a test
2. Run all tests and see the new one fail
3. Make a little change
4. Run all tests and see them all succeed
5. Refactor to remove duplication
The surprises are likely to be:
How each test can cover a small increment of functionality
How small and ugly the changes can be to make the new tests run
How often the tests are run
How many teensy tiny steps make up the refactorings
9. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 9
1. Create class-diagram/Components-model using a class designer
2. Generate code from the diagram
3. Select a method to test
4. Generate test using Nunit, Junit, …
5. Run the test
6. The test fails
7. Complete the selected method
8. The test passes
9. Clean the code
10. Refactor the code
11. repeat
Unit testing requires that the source code is composed in
such a way that dependencies between modules can be
easily neutralized with mocks. In addition, unit testing
requires that functions are well isolated from each other
10. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 10
Consider the class diagram, shown in the next slide.
The diagram is depicted in the Enterprise Architect environment.
Generate C# code from the class diagram.
Make a C# console application(.sln file).
Add the generated classes to the console application.
Use Nunit to generate test classes and unit test.
14. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 14
///////////////////////////////////////////////////////////
// point.cs
// Implementation of the Class point
// Generated by Enterprise Architect
// Created on: 09-Apr-2020 5:44:14 PM
// Original author: Asus
///////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Geometry;
namespace Geometry {
public class point : GraphicalObject {
15. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 15
public double x;
public double y;
public point(){
}
~point(){
}
///
/// <param name="xCoord"></param>
/// <param name="yCoord"></param>
public point(double xCoord, double yCoord){
}
16. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 16
/// <param name="p"></param>
/// <param name="q"></param>
public static double dist(point p, point q){
return 0;
}
///
/// <param name="p"></param>
/// <param name="q"></param>
public static double distPower2(point p, point q){
return 0;
}
public void draw(){
}
17. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 17
public void dump(){
}
///
/// <param name="p"></param>
/// <param name="q"></param>
/// <param name="r"></param>
public static bool isCoLinear(point p, point q, point r){
return false;
}
///
/// <param name="aPoint"></param>
public Boolean isEqual(point aPoint){
return null;
}
18. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 18
///
/// <param name="xc"></param>
/// <param name="yc"></param>
/// <param name="angel"></param>
public void rotate(int xc, int yc, double angel){
}
///
/// <param name="x_val"></param>
/// <param name="y_val"></param>
public void Set(double x_val, double y_val){
}
}//end point
}//end namespace Geometry
23. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 23
Use NUnit3 in visual studio environment to create test classes.
If Nunit is not installed you will have to install it.
Right click on the name of the method to be tested.
Select “Create unit test option”
A unit is the smallest possible part of a program that can be logically isolated
and tested.
A method, function, procedure, or subroutine is an instance of a unit. Unit
testing is the first phase of testing.
As an example, consider the class point, in C#, listed below:
24. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 24
public class point : GraphicalObject
{
private double x, y;
public point(double xCoord, double yCoord){}
public void Set(double x_val, double y_val) {}
// Computes the distance between the points P and q.
public static double dist(point p, point q) {}
public static double distPower2(point p, point q){}
// Determines whether
public static bool isCoLinear(point p, point q, point r){}
public void dump(){}
public Boolean isEqual(point aPoint){}
// Rotates the point object around the point (xc, yc) for angle.
public void rotate(int xc, int yc, double angel){}
public void draw(){}
}
25. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 25
A unit is the smallest possible part of a program that can be logically isolated
and tested.
A method, function, procedure, or subroutine is an instance of a unit. Unit
testing is the first phase of testing.
As an example, right click on the name of the method “dist” in the class
“point”,
public static double dist(point p, point q) { … }
Select the “create test” option as shown in the bext slide.
If “Nunit” is not installed click on the “Get additional extensions”.
29. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 29
1. Test Cases are copied
into x1, y1, x2 and y2,
respectively.
2. Result is compared
with the retuen value.
30. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 30
The test cases show two points
and their expected distances.
Eg.
[TestCase(0,0, 1,0, Result = 1)]
P1 = (0,0) , P2 = (1,0)
dist(P1, P2) = 1
To run tests select:
Test->Run All Tests
To view test results:
Test->Test Explorer
31. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 31
The previous test fails.
Complete the body of the “dist” method as follows:
// Computes the distance between the points p and q
public static double dist(point p, point q)
{
double res = 0;
if (p.x == q.x) { res = Math.Abs(p.y - q.y); return res; }
if (p.y == q.y) { res = Math.Abs(p.x - q.x); return res; }
double dx = p.x - q.x; double dy = p.y - q.y;
res = Math.Sqrt(dx * dx + dy * dy);
return res;
}
32. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 32
Run the tests again:
Test->Run All Tests
To view test results:
Test->Test Explorer
33. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 33
Complete the test method.
The test fails:
[Test()]
[TestCase(0, 0, 90, 2, 0, Result = new double[2] { 0, 2 })]
[TestCase(0, 0, 90, 1, 1, Result = new double[2] { 0, 1 })]
[TestCase(0, 0, 90, 1, 0, Result = new double[2] { 0, 1 })]
public double[] rotateTest(int xc, int yc, double angel, double x, double y)
{
point p = new point(x, y);
p.rotate(xc, yc, angel);
var result = new double[2];
result[0] = p.x;
result[1] = p.y;
Console.Write(" (x = {0}), y={1}", p.x, p.y);
return result;
}
34. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 34
The previous test fails.
Complete the body of the “rotate” method as follows:
// Rotates “this” object around point (xc, yc) for angle anel1 degree
public void rotate(int xc, int yc, double angel)
{
//point ComparedWith = new point(xc, yc);
angel = angel*3.141592/180;
if (xc == x && yc == y) return;
else
{
double cosa = Math.Cos(angel); double sina = Math.Sin(angel);
double dx = x - xc; double dy = y - yc;
x = (int)Math.Round(cosa * dx - sina * dy + xc);
y = (int)Math.Round(sina * dx + cosa * dy + yc);
}
}
36. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 36
Write all the test cases for testing the “dist” method in a text file, testCases.txt.
0,0,0,1,1
0,0,2,0,2
0,0,3,4,5
0,0,0,0,0
37. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 37
namespace Geometry.Tests
{
[TestFixture()]
public class pointTests
{[Test, TestCaseSource(typeof(MyTestCases), "TestCasesFromFile")]
//[Test, TestCaseSource(typeof(MyTestCases), "TestCases")]
public double distTest(point p, point q)
{
var result = point.dist(p, q);
p.dump(); q.dump(); Console.WriteLine(" distance = {0}", result);
return result;
}
}
38. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 38
public class MyTestCases
{public static IEnumerable TestCasesFromFile
{ get
{ using (StreamReader file = new StreamReader(@"D:TestCases.txt"))
{ string ln;
while ((ln = file.ReadLine()) != null)
{ string[] values = ln.Split(',');
point p = new point(Convert.ToDouble(values[0]),
Convert.ToDouble(values[1]));
point q = new point(Convert.ToDouble(values[2]),
Convert.ToDouble(values[3]));
yield return new TestCaseData(p,
q).Returns(Convert.ToDouble(values[4]));
}
}
}
} } }
40. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 40
Requirements:
toRoman:
should return the Roman numeral representation for all integers 1 to 3999.
should always return a Roman numeral using uppercase letters.
fromRoman:
should take a valid Roman numeral and return the number that it represents.
should only accept uppercase Roman numerals (i.e. it should fail when
given lowercase input).
41. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 41
#roman.py
"""Convert to and from Roman numerals"""
#Define exceptions
class RomanError(Exception): pass
class OutOfRangeError(RomanError): pass
class NotIntegerError(RomanError): pass
class InvalidRomanNumeralError(RomanError): pass
def toRoman(n):
"""convert integer to Roman numeral"""
pass
def fromRoman(s):
"""convert Roman numeral to integer"""
pass
42. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 42
Unittest: testRoman.py
"""Unit test for roman.py"""
import roman
import unittes
knownValues = ( (1, 'I'),.,.,.,..,(3999, 'MMMCMXCIX'))
class TestToRoman(unittest.TestCase):
def testToRomanGood(self):
"""toRoman should give known result with known input"""
for integer, numeral in knownValues:
result = roman.toRoman(integer)
self.assertEqual(numeral, result)
def testNonInteger(self):
"""toRoman should fail with non-integer input"""
self.assertRaises(roman.NotIntegerError, roman.toRoman, 0.5)
43. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 43
class TestFromRoman(unittest.TestCase):
def setup(self):
pass
def tesrdown(self):
pass
def test_knownValues(self):
"""fromRoman should give known result with known input"""
for integer, numeralin knownValues:
result = roman.fromRoman(numeral)
self.assertEqual(integer, result)
def testTooManyRepeatedNumerals(self):
"""fromRoman should fail with too many repeated numerals"""
for s in ('MMMM', 'DD', 'CCCC', 'LL', 'XXXX', 'VV', 'IIII'):
self.assertRaises(roman.InvalidRomanNumeralError, roman.fromRoman, s)
44. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 44
"""Convert to and from Roman numerals"""
#Define exceptions
class RomanError(Exception): pass
class OutOfRangeError(RomanError): pass
class NotIntegerError(RomanError): pass
class InvalidRomanNumeralError(RomanError): pass
#Define digit mapping
romanNumeralMap = (('M', 1000), ('CM', 900), ('D', 500),('CD',
400), ('C', 100), ('XC', 90), ('L', 50),('XL', 40), ('X', 10), ('IX', 9), ('V',
5), ('IV', 4), ('I', 1))
45. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 45
def toRoman(n):
"""convert integer to Roman numeral"""
if not (0 < n < 4000):
raise OutOfRangeError, "number out of range (must be 1..3999)"
if int(n) <> n:
raise NotIntegerError, "non-integers can not be converted"
result = ""
for numeral, integer in romanNumeralMap:
while n >= integer:
result += numeral
n -= integer
return result
def fromRoman(s):
"""convert Roman numeral to integer"""
pass
46. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 46
def fromRoman(s):
"""convert Roman numeral to integer"""
result = 0
index = 0
for numeral, integer in romanNumeralMap:
while s[index:index+len(numeral)] == numeral:
result += integer
index += len(numeral)
return result
47. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 47
The nose.tools module provides a number of testing aids:
Decorators: for restricting test execution time and testing for exceptions,
Assert: methods found in unittest.TestCase (only spelled in pep08 fashion, so
assert_equal rather than assertEqual).
nose.tools.raises(*exceptions)
Test must raise one of expected exceptions to pass.
Example use:
@raises(TypeError, ValueError)
def test_raises_type_error():
raise TypeError("This test passes")
nose.tools.assert_equal
-- Fail if the two objects are unequal
-- as determined by the ‘==’ operator.
nose.tools.assert_false
-- Fail the test if the expression is true.
48. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 48
The overall architecture of the payroll application software consists of three packages.
49. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 49
The “Guard interface” and “Time card reader” are two parallel tasks.
50. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 50
There is a time card reader in
the payroll department, as
well.
51. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 51
To assign a class to a component (In Rational-Rose environment) by:
1. Click on the component.
2. A list of all the classes will pop up.
3. Click on the name of a class,
4. Assign the class to the component.
54. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 54
• [1] Erdogmus, Hakan; Morisio, Torchiano. On the Effectiveness of Test-first Approach to
Programming. Proceedings of the IEEE Transactions on Software Engineering, 31(1). January 2005.
(NRC 47445). Retrieved on 2008-01-14.
• [2] George, Boby; Williams, Laurie. A Structured experiment of test-driven development. 2003.
• [3] E.M. Maximilien, L. Williams; Assessing test-development at IBM, presented at International
Conference of Software Engineering, Portland, OR, 2003.
• [4] Beck, K. Test-Driven Development by Example, Addison Wesley, 2003
http://en.wikipedia.org/wiki/Test_driven_development#Test-Driven_Development_Cycle
• [5] JMock.org, www.jmock.org, Year ?
55. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 55
• What?
• Software testing is the art of measuring and maintaining software quality.
• Why?
• To ensure that user expectations and requirements, business value, non-
functional requirements, such as security, reliability and recoverability,
and operational policies are all met.
• How?
• Testing strategies: Black, white, and gray box testing.*
56. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 56
• How?
• Testing strategies are traditionally divided into black, white, and gray box
testing.
- Black: The inside of the box (“solution implementation”) is dark. Testers focus only on
input and output, typically when performing system and user acceptance testing.
- White: The inside of the box is visible and analyzed as part of the testing.
- Gray: A combination of black and white box testing typically used to test edge cases,
which require an understanding of the internals and expected behavior.
60. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 60
• Microsoft Fakes is a new code isolation framework that can help you isolate code
for testing by replacing other parts of the application with stubs or shims.
• It allows you to test parts of your solution even if other parts of your app haven’t
been implemented or aren’t working yet.
• Microsoft Fakes come in two flavors:
Stubs … replace a class with a small substitute (“stub”) that implements the
same interface.
Shims … modify the compiled code at run time, to inject and run a substitute
(“shim”).
• Stubs are typically used for calls within your solution that you can decouple using
interfaces; shims are used for calls to referenced assemblies for which the code is
not under your control.
61. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 61
• Fakes come in two flavours:
• A shim modifies the compiled code of your application at run time so that
instead of making a specified method call, it runs the shim code that your test
provides. Shims can be used to replace calls to assemblies that you cannot
modify, such .NET assemblies.
• A stub replaces a class with a small substitute that implements the same
interface. To use stubs, you have to design your application so that each
component depends only on interfaces, and not on other components.
62. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 62
We have a class that implements something depends on System library.
using System;
namespace DemoClassLibrary
{
public class Foo
{
public long UtcNowTick()
{
return DateTime.UtcNow.Ticks;
}
}
}
So this UtcNowTick is depends on the
DateTime, and right now we want to test this
function
This is a typical scenario for us to use shim to
test because we cannot control the behaviour
of the system library.
63. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 63
• Add the fake to the desired library
As a result a fake assembly will be created:
after-add-fake.jpg
64. 4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir) 64
So right now, we have the fake assembly for system now, and we can
control the behaviour of system namespace api as below:
65. Resources – TDD & refactoring
test-driven development:
A Practical Guide
Dave Astels
Prentice-Hall/Pearson Education, 2003
ISBN 0-13-101649-0
___________________________
Test-Driven Development:
By Example
Kent Beck
Addison-Wesley, 2003
ISBN 0-321-14653-0
654/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir)
66. Resources – TDD & refactoring
Agile Java - Crafting Code
with Test-Driven
Development
Jeff Langr
Prentice Hall 2005
ISBN 0-13-148239-4
66
4/20/2020 S. Parsa, Associate Professor (www.parsa.iust.ac.ir)