Ase PPT-3
Ase PPT-3
In a product-oriented tool, the compiled source and compile test will result in a
single file that contains all the compiled code known as source.so and tests.so. The
run test generates file called testreports.zip.
A product-oriented build system ensures order of execution. It invokes Run test after
compiled source and compiled test with Timestamps generated in file for each task.
In compiling C/C++, the build ensures that the source code files are compiled only if it is
changed from the last build, known as Incremental Build.
In languages that run virtual machine, the compiler just creates the Bytecode and the Virtual
Machines Just In Time (JIT) compiler does the optimization at the runtime.
BUILD AND DEPLOYMENT SCRIPTING
Large projects need script for build, test and packaging the application.
For example,
Build Tools
Build tool has two important essential features, that include
all those things that the build tool does, and
all those things the build tool depends.
Product-oriented -describe all the activities in terms of product they generate such as executables.
Example: Make build tool performance depends on certain prerequisites to be executed exactly once.
The compiled source generates source.so and compile test will result in tests.so. The run test generates file
called testreports.zip.
The build system ensures to invoke Run test after compiled source and test with Timestamps for each task.
The various builds tool includes
1. Make Build Tool
2. Ant Build Tool
3. Nant Build Tool
4. NAnt and MSBuild Build Tools
5. Maven Build Tool
5. Rake Build Tool
6. Buildr Build Tool
7. Psake Build Tool
Make
Powerful product-oriented Build tool, capable of tracking dependencies within a Build and Components
with change.
Drawbacks
1.With complex applications and a large number of dependencies between the components increases the complexity of
rules build inside the Make becomes much harder to Debug. The teams solve this complexity by
creating a make-file for each directory and keeping at top and recursively runs the make-file in each of the
subdirectories. This leads to spread of make-files that include build information and processes of the make process.
2.make-files are susceptible to very hard to find class of Bugs. For example, sometimes in the command script, if White
spaces are included in the place of Tab unknowingly, the script will not work.
3.Make-files relies on shell to do any function as a result the make-files are specific to an Operating System (OS).
Due to these problems, the Make built tool is rarely used as in commercial applications.
C++ developers, use SCons in preference to Make, it . This can build files written in Python, and makes it powerful.
Ant
Apache
By the development of cross-platform applications in Java, caused Make tool with many limitations. Therefore, Java community
combined Make with XML to build Apache Build tool, that is fully cross platform tool that has a set of tasks written in Java to
perform common operations such as compilation and file system manipulation. This enabled easy extension of any new tasks
written in Java and made this a de-facto build tool for Java projects.
Ant is a task-oriented tool whose runtime components are written in Java. But scripts use an external DSL written in XML. This
combination gives powerful cross-platform capabilities, making it extremely flexible and powerful, but has several shortcomings.
Disadvantages:
•Ant requires build scripts for performing compile, create .Jar files, run Test etc are written in declarative XML language
are difficult to model and write. The declarative language syntax creates confusion to the developers, which generated
build statistics difficult to understand.
Disadvantages
project that are not confirming to Mavens structure and life cycle, it is extremely difficult to work with this and forces
development team to structure their projects according to Maven's requirement dictating inflexibility.
Maven also uses DSL written in XML, makes it difficult to code when needed to be extended. Maven solves this by the use
of several plugins.
The default Maven core is very small with a self-updating configuration. To make it functional, it downloads it's own plugin
from the internet. Every time when maven is run, it tries to update itself and as a result of the upgrade or downgrade of
plugins can result in unpredictable build failure.
Long time is required to restructure a build, If the versions of the dependencies used by Maven is not effectively tracked,
can may end up in Dependency problems and breakages due to change in the version.
Rake
Rake is product-oriented tool as well as a task-oriented tool.
Rake is a general purpose, build and scripting tool for Ruby language.
It uses an internal domain-specific language DSL in Ruby.
Rake scripting uses plain ruby script and uses rubies API to carry out the task.
It can create powerful platform-independent build-files with good understanding of dependencies.
It has used general-purpose language which is available for normal development and maintaining the build
scripts. Along with this, in case of occurrence of bug in execution, the Rake build script has a stack structure to
help the developer understand what went wrong.
Ruby provides classes open for extension and can add more methods to Rake classes from within the build script
for debugging purpose.
Disadvantages
•Needs good runtime on the platform
•Needs interaction with Ruby gems for the execution.
Buildr
Buildr is built on top of Rake. Everything that can be done in Rake can also be done in Buildr.
Faster than Maven.
This is simpler and has the power of Rake.
This is a new generation build tool that include builder, gradle, and Gantt.
Extremely simple to customize tasks, and create new one.
Better dependency management and easy completion of multi-project build.
Buildr or Gradle are preferred replacements for Ant or Maven with new java projects.
Psake
Basic of Psake is an internal DSL written in power shell.
supports task-oriented dependency network.
This is meant for Windows users.
Principles and Practices of Build and Deployment Scripting
Artifact repository
•The modern continuous integration servers provide an artifact repository to store reports, binaries to be reused in
the later stages of the pipeline.
•Does not store any failed stage in deployment pipeline.
•Allows to track back any version/release of software and to connect with any instance of the deployment pipeline
and the revisions in the version control system.
•Provides a web interface for the team to access the reports and binaries.
•Dedicated artifacts repository such as Nexus and other Maven style repository managers can handle binaries and
for storing reports.
Artifact repository process
1)A team member in the delivery team commits a change.
2)The continuation continues integration server runs the commit stage.
3)On successful completion, the binaries as well as any reports and
metadata are saved to the artifact repository.
4)The continuation in continuous integration server, the deployment
pipeline retrieves the binaries created by the commit stage and deploys to
a production like test and environment.
5)The continuous integration server runs the ‘acceptance test’ and reuse
the binaries created by the commit stage.
6)On the successful completion of the acceptance test, the release
candidate is marked as having passed the ‘acceptance test’.
7)The testers obtain the list of all binaries which have passed acceptance
test and the press of a button runs automated process to deploy them into
manual testing environment.
Artifact repository process (Contn..)
8)Next, Testers perform ‘manual testing’.
9)On successful completion of manual Testing, testers update the
status of the release candidate to indicate. It has ‘passed manual
testing’.
10)Next, the continuous integration server retrieves, the latest
candidate that has passed acceptance, testing or manual, testing
depending upon the stage in the pipeline configuration from the
artifact repository and deploys. The application to the production test
environment.
11)Next, the capacity tests are run against the release can rate.
12)On successful completion of the capacity test, the status of the
candidate is updated to “capacity tested “.
13)This is repeated for as many stages in the pipeline.
14)Once the code has passed all the relevant stages, it is ready for
release. It can be released by anybody with appropriate
authorization.
15)And the conclusion of the release process, the RC is marked as
“released”.
Commit Tests Suite, Principles and Practices.
There are some important principles and practices that govern the design of a commit tests suite.
Unit test forms the vast majority of the test. Should be fast to execute. The application fails to build if the test
used is not sufficiently fast.
Covers 80% of the code base, and gives a good confidence that the application will pass.
The unit test starts with unit test cases and should complete in seconds.
In comparison to unit test the acceptance test are only few in number, which is subdivided into service test and
UI tests.
Service test and the UI test take longer time to execute because they run against the full running system.
These levels ensure that the application is working and delivering the expected business value.
There are several design strategies which is required for designing commit test.
These are used to achieve the goal to minimize the scope of any given test and keep it focused on testing one
aspect of this system.
They include:
1. Avoid the user interface
2. Use Dependency injection.
3. Avoid the Database.
4. Avoid a Synchrony in Unit Test.
5. Use Test Doubles.
6. Minimize State in test.
7. Faking time
8. Brute force
Avoid the user interface
Since the user interface is the most obvious place where bugs occur. The natural tendency is to over focus with test
efforts fetching more code. Therefore, the best recommendation with commit test is to avoid the test via UI. Because,
the UI involves a lot of components or levels of software under it and this may be problematic and takes effort and
time to get all the paces, ready for the test before, executing the test itself.
Faking time: Time is a serious problem in automated testing process. Sometimes the test requires 500 milliseconds
before processing with the next step. Sometimes it needs to do something different as the time shifts to February 29
of a leap year. All of these cases are very tricky and hard to deal with and can be potentially disastrous while. Doing
the unit testing status if it is considered with the real system clock, the best strategy for any time-based behaviour is
to abstract the need for time information into a separate class. That is under the developer’s control. The dependency
injection is done to inject the wrapper of the system level time behaviour. Here the time stopped or moved affects the
behaviour of our clock class or the abstraction used which is fully under control.
Brute Force: Developers always wish for a fast commit cycle. The speed of the commit cycle should have the ability to
identify the most common errors, which are likely to be introduced. The optimization process is involved and works
solely through trial and error. In some cases, it is better to accept slower commit stage than to spend too much time,
optimizing the test for speed or reducing the proportion of bugs got. Normally the aim is to keep the commit stage
under 10 minutes. Using Build Grid can make the commit run faster.